Message ID | 20221206145936.922196-4-benjamin.tissoires@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2876352wrr; Tue, 6 Dec 2022 07:10:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf4hJDWnU71rny1xxyxJkpo16TmsVLXiAHRG0MtmBKbXm0pNUHsIeOAMICkKGqzF4BkzyKDw X-Received: by 2002:aa7:c988:0:b0:46b:aedf:f330 with SMTP id c8-20020aa7c988000000b0046baedff330mr24979143edt.76.1670339410394; Tue, 06 Dec 2022 07:10:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670339410; cv=none; d=google.com; s=arc-20160816; b=fSjmWHcBd+qmvWsrGVnsM4I35VF5WPeAH4Vq3Y3AQ0c8e5/e6Mt5KaQNgeV56ACVbw 2wJLknXMZ/3OwNE+iMegjXdp3Lep7Ksehpnfvdrld095XfTXWNKn0xTfvZ2GH9U/uNSS +gZmGCFH85fDqA2VbHeikPHlRnR6WKE03Wv4bWJbeLuUMX7ZM29A77r+c4j2V3mc5qMN qZOfhc1sOK2DEELbB/R454aMnPcuKFB5iK+jD/g11G5qGv2dwB8pqKH8vbb0zvOswmaU URlZhQQKLdLSC/U/7svSaTHb7inrsoGTRqL54Suxf1CX/PdzF24R0JQp/g1pPy7ZR2aD jcVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oqtAUCO0SEZJgsVoKCePLBtYNI2eYf5kC10HYrGr3GM=; b=0oiFnihjH7WpwHwdxYYqYD7i9vProoQbpF84/FFp9Tl0N1cVGAvTIkXzybcEzq3qtE O/LdWBw/tb6ddYGZy02kTOQInDOu29fDLFRRbE/D5JR5eaDhSv2herVA3t3nNBjxpwSd 4dppHFp3GZm/rTZ0karPwWGxJRyS/PzvtMJl5+wEgQmVbc/XWKYlJQELpChEkocbMxPN VLrCBQ39TruJydocv87wk5COKkcL6fnq6aqjK4NEXjgTvhi4ty7NQwWLrnnY3gL1JXb9 B65lXJHYKITUHhi7/sS2nBUJo0jRquPCm4OdaIeLPN2iBUrllf+JyoSlgw0H/PjeKG05 ek4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bss7Qsjf; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he30-20020a1709073d9e00b007a1e33462c1si4527564ejc.268.2022.12.06.07.09.46; Tue, 06 Dec 2022 07:10:10 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=bss7Qsjf; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234765AbiLFPHs (ORCPT <rfc822;jaysivo@gmail.com> + 99 others); Tue, 6 Dec 2022 10:07:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234965AbiLFPGd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 6 Dec 2022 10:06:33 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8257E2EF3F for <linux-kernel@vger.kernel.org>; Tue, 6 Dec 2022 06:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670338791; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oqtAUCO0SEZJgsVoKCePLBtYNI2eYf5kC10HYrGr3GM=; b=bss7Qsjfj5RkHNZpk468Su77VGlq7Qx+hH8nhAwzbIp6Hsiu/X3I7e3B6qckKw4Nh8XHfz QeF6XANJ7SDxC2n6WWUnffkD5LHf49kJwtr+wGGEIP727E7UI34jN7/6Wch7xlbDYQL5+N brcZsYnUfgoZes0H6wrFscbkm8GCsPw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-620-Q6O4LbPCNOWLfG69VKMC1g-1; Tue, 06 Dec 2022 09:59:48 -0500 X-MC-Unique: Q6O4LbPCNOWLfG69VKMC1g-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 340DB811E75; Tue, 6 Dec 2022 14:59:48 +0000 (UTC) Received: from plouf.redhat.com (unknown [10.39.193.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9327F4A9254; Tue, 6 Dec 2022 14:59:46 +0000 (UTC) From: Benjamin Tissoires <benjamin.tissoires@redhat.com> To: Jiri Kosina <jikos@kernel.org>, Florent Revest <revest@chromium.org>, Jon Hunter <jonathanh@nvidia.com>, Alexei Starovoitov <alexei.starovoitov@gmail.com>, Daniel Borkmann <daniel@iogearbox.net>, Andrii Nakryiko <andrii@kernel.org> Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Benjamin Tissoires <benjamin.tissoires@redhat.com> Subject: [PATCH HID for-next v3 3/5] HID: bpf: enforce HID_BPF dependencies Date: Tue, 6 Dec 2022 15:59:34 +0100 Message-Id: <20221206145936.922196-4-benjamin.tissoires@redhat.com> In-Reply-To: <20221206145936.922196-1-benjamin.tissoires@redhat.com> References: <20221206145936.922196-1-benjamin.tissoires@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751477817267629373?= X-GMAIL-MSGID: =?utf-8?q?1751477817267629373?= |
Series |
HID: bpf: remove the need for ALLOW_ERROR_INJECTION and Kconfig fixes
|
|
Commit Message
Benjamin Tissoires
Dec. 6, 2022, 2:59 p.m. UTC
As mentioned in the link below, having JIT and BPF is not enough to
have fentry/fexit/fmod_ret APIs. This resolves the error that
happens on a system without tracing enabled when hid-bpf tries to
load itself.
Link: https://lore.kernel.org/r/CABRcYmKyRchQhabi1Vd9RcMQFCcb=EtWyEbFDFRTc-L-U8WhgA@mail.gmail.com
Fixes: f5c27da4e3c8 ("HID: initial BPF implementation")
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
no changes in v3
changes in v2:
- dropped ALLOW_ERROR_INJECTION requirement
---
drivers/hid/bpf/Kconfig | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Tue, Dec 6, 2022 at 3:59 PM Benjamin Tissoires <benjamin.tissoires@redhat.com> wrote: > > As mentioned in the link below, having JIT and BPF is not enough to > have fentry/fexit/fmod_ret APIs. This resolves the error that > happens on a system without tracing enabled when hid-bpf tries to > load itself. > > Link: https://lore.kernel.org/r/CABRcYmKyRchQhabi1Vd9RcMQFCcb=EtWyEbFDFRTc-L-U8WhgA@mail.gmail.com > Fixes: f5c27da4e3c8 ("HID: initial BPF implementation") > Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> > > --- > > no changes in v3 > > changes in v2: > - dropped ALLOW_ERROR_INJECTION requirement Florent, can I keep your reviewed-by on this patch? Jon, may I ask you to do one more testing with the full v3 applied on top of for-next? Cheers, Benjamin > --- > drivers/hid/bpf/Kconfig | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/hid/bpf/Kconfig b/drivers/hid/bpf/Kconfig > index 298634fc3335..03f52145b83b 100644 > --- a/drivers/hid/bpf/Kconfig > +++ b/drivers/hid/bpf/Kconfig > @@ -4,7 +4,8 @@ menu "HID-BPF support" > config HID_BPF > bool "HID-BPF support" > default HID_SUPPORT > - depends on BPF && BPF_SYSCALL > + depends on BPF && BPF_SYSCALL && \ > + DYNAMIC_FTRACE_WITH_DIRECT_CALLS > help > This option allows to support eBPF programs on the HID subsystem. > eBPF programs can fix HID devices in a lighter way than a full > -- > 2.38.1 >
On Wed, Dec 7, 2022 at 3:58 PM Benjamin Tissoires <benjamin.tissoires@redhat.com> wrote: > > On Tue, Dec 6, 2022 at 3:59 PM Benjamin Tissoires > <benjamin.tissoires@redhat.com> wrote: > > > > As mentioned in the link below, having JIT and BPF is not enough to > > have fentry/fexit/fmod_ret APIs. This resolves the error that > > happens on a system without tracing enabled when hid-bpf tries to > > load itself. > > > > Link: https://lore.kernel.org/r/CABRcYmKyRchQhabi1Vd9RcMQFCcb=EtWyEbFDFRTc-L-U8WhgA@mail.gmail.com > > Fixes: f5c27da4e3c8 ("HID: initial BPF implementation") > > Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> > > > > --- > > > > no changes in v3 > > > > changes in v2: > > - dropped ALLOW_ERROR_INJECTION requirement > > Florent, can I keep your reviewed-by on this patch? Yes! :) Reviewed-by: Florent Revest <revest@chromium.org> Thank you for the updated series, I think it's cleaner than relying on error injection indeed. I still believe that, in the future, BPF should offer a proxy config to expose if BPF tracing is supported because 1- the implementation of BPF tracing could someday change 2- to be exactly correct, ftrace direct call isn't _really_ a sufficient condition either: the BPF JIT also needs to implement the arch_prepare_bpf_trampoline function. Currently, there is no config to check if that feature is available. But as agreed in a previous thread, that consolidation can be done separately. For now your patch looks good enough to me already.
diff --git a/drivers/hid/bpf/Kconfig b/drivers/hid/bpf/Kconfig index 298634fc3335..03f52145b83b 100644 --- a/drivers/hid/bpf/Kconfig +++ b/drivers/hid/bpf/Kconfig @@ -4,7 +4,8 @@ menu "HID-BPF support" config HID_BPF bool "HID-BPF support" default HID_SUPPORT - depends on BPF && BPF_SYSCALL + depends on BPF && BPF_SYSCALL && \ + DYNAMIC_FTRACE_WITH_DIRECT_CALLS help This option allows to support eBPF programs on the HID subsystem. eBPF programs can fix HID devices in a lighter way than a full