Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3986271pxb; Fri, 11 Feb 2022 12:16:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXS3ceIktcmjUDxo//njnnT8ZKOsFSlqV7p2Tb6uebi/wHPT4AB8dWXm1mCcAURrey33RK X-Received: by 2002:a17:90b:701:: with SMTP id s1mr2078571pjz.60.1644610571204; Fri, 11 Feb 2022 12:16:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644610571; cv=none; d=google.com; s=arc-20160816; b=zIOyErfdNRCISU+EDnLWMGCnlRWtjSDqnfWgcsZkfY6s4nIV2L1+fK3Y7QzXG4VPbr efcukLZmQhfsD7ubHWXsfJGgfpaXe7FFWOEaezFhzOjilNTdnwFWl5hPv4AW8H2JLU73 m2QCJv5StYSwUlLOHAxbd+Pg61oKjrJf//Nj0UcajKQoPA0zJ4ZArmLu4etn+LIfFsLM MjJ+GSrKTf1VNedxrvbDzqoDNh06epsIhSGMxbFdSnma68ZXYw0IxbvUI+J6GII+pG6a CO82yMf6gOYJqsQS5WyV40aHZ/IhXpJfJTotiXJ/39qphwCb2TojSe/3tyodQTnBWIeV xDlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=YraWKfqsRQTiuvaOTNcXdvGedGI4n4o1rRLhfD0Z+z0=; b=PKmpbnLnnJXFxCqnYkVxRA6vJQlOSAMe0tdn83mLhwOyzXeFhn9A1eOhqXFp/OAg9u dwFfe0gX0MCn9ws11D6DCHiwnN2bb67rV9Irf3FiqTjektpOaLd4cEQCY4j7g46ISTaq 5JM4qxgkFYK2cmnelaXS+c+1Yw/5scsA49mqXqXW+iCSIglah1I/mcRBTtgq/+zC2HuD 0/JewHipJ8q47cYOCt+W83RSn+t6p0DR54Fv9Eii3Hxw2p3JVccnHKpcfojBqCd5vFZk UW/FKzp4hS3rz5d4PdJ/vB9YfPu3BFkLLv7K02zYVq3sazb8FtKlhqLm8J4zYMWa8UW3 ScvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j5si6634829plh.604.2022.02.11.12.15.56; Fri, 11 Feb 2022 12:16:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348334AbiBKI5p (ORCPT + 99 others); Fri, 11 Feb 2022 03:57:45 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:46548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347897AbiBKI5l (ORCPT ); Fri, 11 Feb 2022 03:57:41 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1DD8B1B7 for ; Fri, 11 Feb 2022 00:57:38 -0800 (PST) Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxWMr7JAZin3sAAA--.392S4; Fri, 11 Feb 2022 16:57:33 +0800 (CST) From: Tiezhu Yang To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh Cc: Xuefeng Li , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH bpf-next 2/2] bpf: Make BPF_JIT_DEFAULT_ON selectable in Kconfig Date: Fri, 11 Feb 2022 16:57:31 +0800 Message-Id: <1644569851-20859-3-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1644569851-20859-1-git-send-email-yangtiezhu@loongson.cn> References: <1644569851-20859-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf9DxWMr7JAZin3sAAA--.392S4 X-Coremail-Antispam: 1UD129KBjvJXoW7tFyrZF4UJF1xJw1xXrWfuFg_yoW8Wry3p3 yYqw1SkryDXr13Kay7Aa4xCF45GryDXw1UCFsrX34UXF43Aas7Zr4vqw17XFW3ZF92gFW5 tFWS93WkZa1UGrDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPG14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_Jryl82xGYIkIc2 x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oVCq3wAS 0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Gr0_Cr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628vn2kIc2 xKxwCY02Avz4vE14v_GFyl42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1l x2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14 v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IY x2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87 Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIF yTuYvjfUnuWlDUUUU X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, it is not possible to set bpf_jit_enable to 1 by default and the users can change it to 0 or 2, it seems bad for some users, make BPF_JIT_DEFAULT_ON selectable to give them a chance. Signed-off-by: Tiezhu Yang --- kernel/bpf/Kconfig | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/kernel/bpf/Kconfig b/kernel/bpf/Kconfig index 88409f8..28b7d71 100644 --- a/kernel/bpf/Kconfig +++ b/kernel/bpf/Kconfig @@ -54,6 +54,7 @@ config BPF_JIT config BPF_JIT_ALWAYS_ON bool "Permanently enable BPF JIT and remove BPF interpreter" depends on BPF_SYSCALL && HAVE_EBPF_JIT && BPF_JIT + select BPF_JIT_DEFAULT_ON help Enables BPF JIT and removes BPF interpreter to avoid speculative execution of BPF instructions by the interpreter. @@ -62,8 +63,16 @@ config BPF_JIT_ALWAYS_ON set to 1 and setting any other value than that will return in failure. config BPF_JIT_DEFAULT_ON - def_bool ARCH_WANT_DEFAULT_BPF_JIT || BPF_JIT_ALWAYS_ON - depends on HAVE_EBPF_JIT && BPF_JIT + bool "Defaultly enable BPF JIT and remove BPF interpreter" + default y if ARCH_WANT_DEFAULT_BPF_JIT + depends on BPF_SYSCALL && HAVE_EBPF_JIT && BPF_JIT + help + Enables BPF JIT and removes BPF interpreter to avoid speculative + execution of BPF instructions by the interpreter. + + When CONFIG_BPF_JIT_DEFAULT_ON is enabled but CONFIG_BPF_JIT_ALWAYS_ON + is disabled, bpf_jit_enable is set to 1 by default and can be changed + to 0 or 2. config BPF_UNPRIV_DEFAULT_OFF bool "Disable unprivileged BPF by default" -- 2.1.0