linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH HID] HID: bpf: fix cfi stubs for hid_bpf_ops
@ 2024-09-27 14:17 Benjamin Tissoires
  2024-09-27 18:15 ` Jiri Kosina
  2024-10-03 17:11 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Benjamin Tissoires @ 2024-09-27 14:17 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-input, linux-kernel, bpf, stable, Benjamin Tissoires

With the introduction of commit e42ac1418055 ("bpf: Check unsupported ops
from the bpf_struct_ops's cfi_stubs"), a HID-BPF struct_ops containing
a .hid_hw_request() or a .hid_hw_output_report() was failing to load
as the cfi stubs were not defined.

Fix that by defining those simple static functions and restore HID-BPF
functionality.

This was detected with the HID selftests suddenly failing on Linus' tree.

Cc: stable@vger.kernel.org # v6.11+
Fixes: 9286675a2aed ("HID: bpf: add HID-BPF hooks for hid_hw_output_report")
Fixes: 8bd0488b5ea5 ("HID: bpf: add HID-BPF hooks for hid_hw_raw_requests")
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
---
Hi,

This commit should directly go in Linus tree before we start creating
topic branches for 6.13 given that the CI is now failing on our HID
master branch.

Cheers,
Benjamin
---
 drivers/hid/bpf/hid_bpf_struct_ops.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/hid/bpf/hid_bpf_struct_ops.c b/drivers/hid/bpf/hid_bpf_struct_ops.c
index cd696c59ba0f..702c22fae136 100644
--- a/drivers/hid/bpf/hid_bpf_struct_ops.c
+++ b/drivers/hid/bpf/hid_bpf_struct_ops.c
@@ -276,9 +276,23 @@ static int __hid_bpf_rdesc_fixup(struct hid_bpf_ctx *ctx)
 	return 0;
 }
 
+static int __hid_bpf_hw_request(struct hid_bpf_ctx *ctx, unsigned char reportnum,
+				enum hid_report_type rtype, enum hid_class_request reqtype,
+				u64 source)
+{
+	return 0;
+}
+
+static int __hid_bpf_hw_output_report(struct hid_bpf_ctx *ctx, u64 source)
+{
+	return 0;
+}
+
 static struct hid_bpf_ops __bpf_hid_bpf_ops = {
 	.hid_device_event = __hid_bpf_device_event,
 	.hid_rdesc_fixup = __hid_bpf_rdesc_fixup,
+	.hid_hw_request = __hid_bpf_hw_request,
+	.hid_hw_output_report = __hid_bpf_hw_output_report,
 };
 
 static struct bpf_struct_ops bpf_hid_bpf_ops = {

---
base-commit: 13882369ceb9b0953f9f5ff8563bbccfd80d0ffd
change-id: 20240927-fix-hid-bpf-stubs-f80591a673c2

Best regards,
-- 
Benjamin Tissoires <bentiss@kernel.org>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH HID] HID: bpf: fix cfi stubs for hid_bpf_ops
  2024-09-27 14:17 [PATCH HID] HID: bpf: fix cfi stubs for hid_bpf_ops Benjamin Tissoires
@ 2024-09-27 18:15 ` Jiri Kosina
  2024-10-03 17:11 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2024-09-27 18:15 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: linux-input, linux-kernel, bpf, stable

On Fri, 27 Sep 2024, Benjamin Tissoires wrote:

> With the introduction of commit e42ac1418055 ("bpf: Check unsupported ops
> from the bpf_struct_ops's cfi_stubs"), a HID-BPF struct_ops containing
> a .hid_hw_request() or a .hid_hw_output_report() was failing to load
> as the cfi stubs were not defined.
> 
> Fix that by defining those simple static functions and restore HID-BPF
> functionality.
> 
> This was detected with the HID selftests suddenly failing on Linus' tree.
> 
> Cc: stable@vger.kernel.org # v6.11+
> Fixes: 9286675a2aed ("HID: bpf: add HID-BPF hooks for hid_hw_output_report")
> Fixes: 8bd0488b5ea5 ("HID: bpf: add HID-BPF hooks for hid_hw_raw_requests")
> Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
> ---
> Hi,
> 
> This commit should directly go in Linus tree before we start creating
> topic branches for 6.13 given that the CI is now failing on our HID
> master branch.

Applied now to for-6.12/upstream-fixes, thanks Benjamin.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH HID] HID: bpf: fix cfi stubs for hid_bpf_ops
  2024-09-27 14:17 [PATCH HID] HID: bpf: fix cfi stubs for hid_bpf_ops Benjamin Tissoires
  2024-09-27 18:15 ` Jiri Kosina
@ 2024-10-03 17:11 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-03 17:11 UTC (permalink / raw)
  To: Benjamin Tissoires; +Cc: jikos, linux-input, linux-kernel, bpf, stable

Hello:

This patch was applied to netdev/net.git (main)
by Jiri Kosina <jkosina@suse.com>:

On Fri, 27 Sep 2024 16:17:41 +0200 you wrote:
> With the introduction of commit e42ac1418055 ("bpf: Check unsupported ops
> from the bpf_struct_ops's cfi_stubs"), a HID-BPF struct_ops containing
> a .hid_hw_request() or a .hid_hw_output_report() was failing to load
> as the cfi stubs were not defined.
> 
> Fix that by defining those simple static functions and restore HID-BPF
> functionality.
> 
> [...]

Here is the summary with links:
  - [HID] HID: bpf: fix cfi stubs for hid_bpf_ops
    https://git.kernel.org/netdev/net/c/acd5f76fd529

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-03 17:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-27 14:17 [PATCH HID] HID: bpf: fix cfi stubs for hid_bpf_ops Benjamin Tissoires
2024-09-27 18:15 ` Jiri Kosina
2024-10-03 17:11 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).