From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2748C0015E for ; Tue, 25 Jul 2023 10:56:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232862AbjGYK4b (ORCPT ); Tue, 25 Jul 2023 06:56:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231416AbjGYK4H (ORCPT ); Tue, 25 Jul 2023 06:56:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FE561FEB for ; Tue, 25 Jul 2023 03:53:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E92AB61655 for ; Tue, 25 Jul 2023 10:53:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05553C433C9; Tue, 25 Jul 2023 10:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1690282385; bh=oyJMKpX+tRVslhuKNrHjM4kIgy+eIZlE7fR7+clRX28=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hDQUueKyjyW4PAuCmEI7vOh9i5KqoLuOLx2B+CDzKeYiHd1X+6DK1o4rQeN554MOY 2cHCSHKy2odBJBzw8teumGtpok1/KcpYU9+CByLJ/O70qwH/+PPXzVcxNg1sOTpH8g tn+oNRSwi6DVUyZOBApOmPSeW7aR/JH2ld5rb900= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kui-Feng Lee , Andrii Nakryiko , Yonghong Song , Sasha Levin Subject: [PATCH 6.4 111/227] bpf: Print a warning only if writing to unprivileged_bpf_disabled. Date: Tue, 25 Jul 2023 12:44:38 +0200 Message-ID: <20230725104519.380038361@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230725104514.821564989@linuxfoundation.org> References: <20230725104514.821564989@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Kui-Feng Lee [ Upstream commit fedf99200ab086c42a572fca1d7266b06cdc3e3f ] Only print the warning message if you are writing to "/proc/sys/kernel/unprivileged_bpf_disabled". The kernel may print an annoying warning when you read "/proc/sys/kernel/unprivileged_bpf_disabled" saying WARNING: Unprivileged eBPF is enabled with eIBRS on, data leaks possible via Spectre v2 BHB attacks! However, this message is only meaningful when the feature is disabled or enabled. Signed-off-by: Kui-Feng Lee Signed-off-by: Andrii Nakryiko Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20230502181418.308479-1-kuifeng@meta.com Signed-off-by: Sasha Levin --- kernel/bpf/syscall.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index f1c8733f76b83..5524fcf6fb2a4 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -5394,7 +5394,8 @@ static int bpf_unpriv_handler(struct ctl_table *table, int write, *(int *)table->data = unpriv_enable; } - unpriv_ebpf_notify(unpriv_enable); + if (write) + unpriv_ebpf_notify(unpriv_enable); return ret; } -- 2.39.2