From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sandipan Das Subject: Re: [PATCH bpf] bpf: fix bpf_prog_get_info_by_fd to return 0 func_lens for unpriv Date: Fri, 2 Nov 2018 16:25:05 +0530 Message-ID: References: <20181102103546.4499-1-daniel@iogearbox.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, Sandipan Das , Song Liu To: Daniel Borkmann , ast@kernel.org Return-path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57870 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726016AbeKBUB5 (ORCPT ); Fri, 2 Nov 2018 16:01:57 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wA2ArjFm141743 for ; Fri, 2 Nov 2018 06:55:12 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ngm31augg-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 02 Nov 2018 06:55:11 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 2 Nov 2018 10:55:10 -0000 In-Reply-To: <20181102103546.4499-1-daniel@iogearbox.net> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 02/11/18 4:05 PM, Daniel Borkmann wrote: > While dbecd7388476 ("bpf: get kernel symbol addresses via syscall") > zeroed info.nr_jited_ksyms in bpf_prog_get_info_by_fd() for queries > from unprivileged users, commit 815581c11cc2 ("bpf: get JITed image > lengths of functions via syscall") forgot about doing so and therefore > returns the #elems of the user set up buffer which is incorrect. It > also needs to indicate a info.nr_jited_func_lens of zero. > > Fixes: 815581c11cc2 ("bpf: get JITed image lengths of functions via syscall") > Signed-off-by: Daniel Borkmann > Cc: Sandipan Das > Cc: Song Liu > --- > kernel/bpf/syscall.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c > index ccb9327..1ea5ce1 100644 > --- a/kernel/bpf/syscall.c > +++ b/kernel/bpf/syscall.c > @@ -2078,6 +2078,7 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, > info.jited_prog_len = 0; > info.xlated_prog_len = 0; > info.nr_jited_ksyms = 0; > + info.nr_jited_func_lens = 0; > goto done; > } > Looks good. Thanks for fixing this. - Sandipan