lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b49e2350-610a-4841-921d-3bdbf6defea4@infradead.org>
Date: Fri, 15 Mar 2024 08:55:41 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: Benjamin Tissoires <bentiss@...nel.org>, Jiri Kosina <jikos@...nel.org>,
 Benjamin Tissoires <benjamin.tissoires@...hat.com>,
 Jonathan Corbet <corbet@....net>, Shuah Khan <shuah@...nel.org>
Cc: linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
 bpf@...r.kernel.org, linux-doc@...r.kernel.org,
 linux-kselftest@...r.kernel.org
Subject: Re: [PATCH v4 5/7] HID: bpf: allow to inject HID event from BPF



On 3/15/24 07:44, Benjamin Tissoires wrote:
> It can be interesting to inject events from BPF as if the event were
> to come from the device.
> For example, some multitouch devices do not all the time send a proximity
> out event, and we might want to send it for the physical device.
> 
> Compared to uhid, we can now inject events on any physical device, not
> just uhid virtual ones.
> 
> Signed-off-by: Benjamin Tissoires <bentiss@...nel.org>
> 
> ---
> 
> no changes in v4
> 
> no changes in v3
> 
> no changes in v2
> ---
>  Documentation/hid/hid-bpf.rst      |  2 +-
>  drivers/hid/bpf/hid_bpf_dispatch.c | 29 +++++++++++++++++++++++++++++
>  drivers/hid/hid-core.c             |  1 +
>  include/linux/hid_bpf.h            |  2 ++
>  4 files changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/hid/hid-bpf.rst b/Documentation/hid/hid-bpf.rst
> index a575004d9025..0765b3298ecf 100644
> --- a/Documentation/hid/hid-bpf.rst
> +++ b/Documentation/hid/hid-bpf.rst
> @@ -179,7 +179,7 @@ Available API that can be used in syscall HID-BPF programs:
>  -----------------------------------------------------------
>  
>  .. kernel-doc:: drivers/hid/bpf/hid_bpf_dispatch.c
> -   :functions: hid_bpf_attach_prog hid_bpf_hw_request hid_bpf_hw_output_report hid_bpf_allocate_context hid_bpf_release_context
> +   :functions: hid_bpf_attach_prog hid_bpf_hw_request hid_bpf_hw_output_report hid_bpf_input_report hid_bpf_allocate_context hid_bpf_release_context
>  
>  General overview of a HID-BPF program
>  =====================================
> diff --git a/drivers/hid/bpf/hid_bpf_dispatch.c b/drivers/hid/bpf/hid_bpf_dispatch.c
> index a5b88b491b80..e1a650f4a626 100644
> --- a/drivers/hid/bpf/hid_bpf_dispatch.c
> +++ b/drivers/hid/bpf/hid_bpf_dispatch.c
> @@ -508,6 +508,34 @@ hid_bpf_hw_output_report(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz)
>  	kfree(dma_data);
>  	return ret;
>  }
> +
> +/**
> + * hid_bpf_input_report - Inject a HID report in the kernel from a HID device
> + *
> + * @ctx: the HID-BPF context previously allocated in hid_bpf_allocate_context()
> + * @type: the type of the report (%HID_INPUT_REPORT, %HID_FEATURE_REPORT, %HID_OUTPUT_REPORT)
> + * @buf: a %PTR_TO_MEM buffer
> + * @buf__sz: the size of the data to transfer
> + *
> + * @returns %0 on success, a negative error code otherwise.

Minimum change:

      @returns:

Preferred change:

      Returns:

"@returns" is not documented.

> + */
> +__bpf_kfunc int
> +hid_bpf_input_report(struct hid_bpf_ctx *ctx, enum hid_report_type type, u8 *buf,
> +		     const size_t buf__sz)
> +{


-- 
#Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ