Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1064253pxb; Wed, 27 Oct 2021 18:36:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIx7GxF0ECKo1iaDQ1nM4EcM/zQ/EFH9i6M8jfo7REozYdC5vAF8FKpXrT4GutJKGTwHOD X-Received: by 2002:a17:902:6bc5:b0:13f:f585:4087 with SMTP id m5-20020a1709026bc500b0013ff5854087mr1233151plt.32.1635384979888; Wed, 27 Oct 2021 18:36:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635384979; cv=none; d=google.com; s=arc-20160816; b=qpzRXqdXnXObYqQ6Z6zhJlStmet2kDC8pXLqtAV5plkoe9bm+jY74Q4Y/5HB6siiOt jvpap4EdRVYQaIlo4pM+97XNqukA3mSf3miZXYh4H1rt5ph3EOzaCR1fW+/ozm+QDLsN NAde35+arJm4l5lA0gNOXmzL7flbttnsQLOK+H7ddrRv2F2JtFpPte3Kd285NxkTFOy/ R5QcG8w2oomyY+9z/TO9ubURDyrNGVn/8RqmbAbvKhKYeBC2orzmPTGa+Jl3vwYOlzcg nxXdVb6f9EmWxUkdJqfbvv9udC7hf7HEjPLE2zfCNPmE08fUFOOAwe2tTIIkMKaskFL5 4E3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=9XTmvWnSjvbb/zjs0ADVHB3IKOIfQCk+VWdWgDlk94E=; b=neBttmgiswToYQiYUMUN1BlNSKYBRyPl0r9WX21qS22YDiKCZxP64LBjoz71MGfZwK +/DuUf8RHL4l1KIMlrIN+iLZ9qo5RKHkcXvwSMCN+Wve6XqbeZn4Xggq0zni+yKI7J+u f9d6+xxnVUtJTF3ik+Lrh3BG1LA8/VjgRmJTgmo+/CXVGbUJIE47Bl8XOLdPI3momssk yJjdhTGMbU1JRyuR0NzPpFPn9K2Y2KZfvP1up3gO20LmMeIFK2AMvSxQ/vihN8U/TnSx QLUiMZxNKucKiy4Mxx6D8F2aNlTU83gspv5ei1o2hMt4fWWT0OQ2e/i1IZ95FFkqDLjI 1PPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n9si2337919plh.326.2021.10.27.18.36.07; Wed, 27 Oct 2021 18:36:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229614AbhJ1Bfz (ORCPT + 99 others); Wed, 27 Oct 2021 21:35:55 -0400 Received: from mga12.intel.com ([192.55.52.136]:42863 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229534AbhJ1Bfz (ORCPT ); Wed, 27 Oct 2021 21:35:55 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10150"; a="210379103" X-IronPort-AV: E=Sophos;i="5.87,188,1631602800"; d="scan'208";a="210379103" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2021 18:33:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,188,1631602800"; d="scan'208";a="486925290" Received: from gupta-dev2.jf.intel.com (HELO gupta-dev2.localdomain) ([10.54.74.119]) by orsmga007.jf.intel.com with ESMTP; 27 Oct 2021 18:33:28 -0700 Date: Wed, 27 Oct 2021 18:35:44 -0700 From: Pawan Gupta To: Alexei Starovoitov , Daniel Borkmann Cc: Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, antonio.gomez.iglesias@intel.com, tony.luck@intel.com, dave.hansen@linux.intel.com, gregkh@linuxfoundation.org Subject: [PATCH ebpf v2 2/2] bpf: Make unprivileged bpf depend on CONFIG_CPU_SPECTRE Message-ID: <882f5c31f48bac75ebaede2a0ec321ec67128229.1635383031.git.pawan.kumar.gupta@linux.intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Disabling unprivileged BPF would help prevent unprivileged users from creating the conditions required for potential speculative execution side-channel attacks on affected hardware. A deep dive on such attacks and mitigation is available here [1]. If an architecture selects CONFIG_CPU_SPECTRE, disable unprivileged BPF by default. An admin can enable this at runtime, if necessary. Signed-off-by: Pawan Gupta [1] https://ebpf.io/summit-2021-slides/eBPF_Summit_2021-Keynote-Daniel_Borkmann-BPF_and_Spectre.pdf --- kernel/bpf/Kconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/bpf/Kconfig b/kernel/bpf/Kconfig index a82d6de86522..510a5a73f9a2 100644 --- a/kernel/bpf/Kconfig +++ b/kernel/bpf/Kconfig @@ -64,6 +64,7 @@ config BPF_JIT_DEFAULT_ON config BPF_UNPRIV_DEFAULT_OFF bool "Disable unprivileged BPF by default" + default y if CPU_SPECTRE depends on BPF_SYSCALL help Disables unprivileged BPF by default by setting the corresponding @@ -72,6 +73,10 @@ config BPF_UNPRIV_DEFAULT_OFF disable it by setting it to 1 (from which no other transition to 0 is possible anymore). + Unprivileged BPF can be used to exploit potential speculative + execution side-channel vulnerabilities on affected hardware. If you + are concerned about it, answer Y. + source "kernel/bpf/preload/Kconfig" config BPF_LSM -- 2.31.1