Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7279583imu; Wed, 14 Nov 2018 14:46:21 -0800 (PST) X-Google-Smtp-Source: AJdET5dRxnhrLv3ghkBb+uNYLe5bfYEZPy8V7yFN+jSbs4umjw9gIHUbT3q7dqQdavKynbyxFSWu X-Received: by 2002:a17:902:bf49:: with SMTP id u9mr3723262pls.4.1542235581583; Wed, 14 Nov 2018 14:46:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542235581; cv=none; d=google.com; s=arc-20160816; b=RF8PtUaC4cdkLrIqV6kHsKc9fPoiMP3StKM41+cU/Gal7fI10zfkH4JCCVzR5zr7JP P6uMdygJt8LpdxMvL+owF2IUlyeVTVDf0fr5gQ/a3MA9E8LyJ2EPbxDR4WLRQr1UGmBw ZJugAOjnUgHanM9fFs89gBuN8+lCcUENMmZhFuECG2+ti7EIy30ocuZagrKpeHIfogiF r437xK5ZWOHBHDsbxaF88aVR0NVM58P1H2bc3W+9UvZz1RsfxLc/t8H668ovnnj9eopr AUjmUt0PY7BMlhZK1OZfQKkLj8BR4MeOE0ZKLzCRoBNw1kO0bPzidMQWdStwolnzVhr2 rzqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=bDrDv3jjf4AE3lMv+NcJDKTKfI15SpvO40fhsyGs7Kg=; b=AxjHSUUeaETnwJYUZuBKqSJnt0Hk+cZEx8GvoRdGhdcGUK7Mt97VznwqxpjMY/iuGg xaTCydqLBE7Vgw+qeZiZfcsuK0m+Z/TnB7d8N4uAWfnHwkDSvVYE/hGPK11AD8dDIVo6 lcMPS8IqgYdZSS7Qob08dSxzHay4FRYVy5/JFVGfvmKKSFIOgd19y92zDm9H1u2u8qC5 Qn0jrQTnEEalsuD61Wtj7ZrOS3nKRsRznRGs8DbDcIETr4vc86HyGJqSinv769gK3M+u DY6chEV1R+KcYfTS05VGeD5udeDlXz2ZjDkutTnbUnqL5fV8lX7LiKdpkbn8UjiZSjeg HiZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NtWv6eIV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 26si5246513pgu.190.2018.11.14.14.46.06; Wed, 14 Nov 2018 14:46:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NtWv6eIV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728344AbeKOI1Q (ORCPT + 99 others); Thu, 15 Nov 2018 03:27:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:34416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726774AbeKOI1P (ORCPT ); Thu, 15 Nov 2018 03:27:15 -0500 Received: from sasha-vm.mshome.net (unknown [64.114.255.114]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DCFCD2251C; Wed, 14 Nov 2018 22:22:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542234132; bh=T/g1PKjIxt36jDugOCzHFIdEDuLm7q/Xa1dPF39PNew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NtWv6eIVx2JjPzIgUzDjhHmEyxUBK9ocwlOb2ARTbSrj3OUX2djVCgCg9UwZlkCz3 22q3sdXratygVpD4PtGm8Ic0TvKAbdsAfqJxesMXzYuNX2ZzkYiz4XKWdNTKEOqZEU WOzSanu2SL0jAsOuxZzqNFWqc2Qo3Qa1SWXgJi38= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Daniel Borkmann , Sandipan Das , Song Liu , Alexei Starovoitov , Sasha Levin Subject: [PATCH AUTOSEL 4.19 15/73] bpf: fix bpf_prog_get_info_by_fd to return 0 func_lens for unpriv Date: Wed, 14 Nov 2018 17:21:09 -0500 Message-Id: <20181114222207.98701-15-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181114222207.98701-1-sashal@kernel.org> References: <20181114222207.98701-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Borkmann [ Upstream commit 28c2fae726bf5003cd209b0d5910a642af98316f ] 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 Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- kernel/bpf/syscall.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 8339d81cba1d..3002e3cdc033 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -1961,6 +1961,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; } -- 2.17.1