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] [day] [month] [year] [list]
Message-ID: <a360c048-96f3-486e-a097-e3456a6243a8@redhat.com>
Date: Thu, 13 Feb 2025 12:37:43 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Wojtek Wasko <wwasko@...dia.com>, netdev@...r.kernel.org
Cc: richardcochran@...il.com, vadim.fedorenko@...ux.dev, kuba@...nel.org,
 horms@...nel.org, Anna-Maria Behnsen <anna-maria@...utronix.de>,
 Frederic Weisbecker <frederic@...nel.org>,
 Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH net-next v2 1/3] posix clocks: Store file pointer in clock
 context

Posix clock maintainers have not being CC-ed, adding them.

The whole series is available at:

https://lore.kernel.org/all/20250211150913.772545-1-wwasko@nvidia.com/

On 2/11/25 4:09 PM, Wojtek Wasko wrote:
> Dynamic clocks (e.g. PTP clocks) need access to the permissions with
> which the clock was opened to enforce proper access control.
> 
> Native POSIX clocks have access to this information via
> posix_clock_desc. However, it is not accessible from the implementation
> of dynamic clocks.
> 
> Add struct file* to POSIX clock context for access from dynamic clocks.
> 
> Signed-off-by: Wojtek Wasko <wwasko@...dia.com>
> ---
>  include/linux/posix-clock.h | 6 +++++-
>  kernel/time/posix-clock.c   | 1 +
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h
> index ef8619f48920..40fa204baafc 100644
> --- a/include/linux/posix-clock.h
> +++ b/include/linux/posix-clock.h
> @@ -95,10 +95,13 @@ struct posix_clock {
>   * struct posix_clock_context - represents clock file operations context
>   *
>   * @clk:              Pointer to the clock
> + * @fp:               Pointer to the file used for opening the clock
>   * @private_clkdata:  Pointer to user data
>   *
>   * Drivers should use struct posix_clock_context during specific character
> - * device file operation methods to access the posix clock.
> + * device file operation methods to access the posix clock. In particular,
> + * the file pointer can be used to verify correct access mode for custom
> + * ioctl calls.
>   *
>   * Drivers can store a private data structure during the open operation
>   * if they have specific information that is required in other file
> @@ -106,6 +109,7 @@ struct posix_clock {
>   */
>  struct posix_clock_context {
>  	struct posix_clock *clk;
> +	struct file *fp;
>  	void *private_clkdata;
>  };
>  
> diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c
> index 1af0bb2cc45c..4e114e34a6e0 100644
> --- a/kernel/time/posix-clock.c
> +++ b/kernel/time/posix-clock.c
> @@ -129,6 +129,7 @@ static int posix_clock_open(struct inode *inode, struct file *fp)
>  		goto out;
>  	}
>  	pccontext->clk = clk;
> +	pccontext->fp = fp;
>  	if (clk->ops.open) {
>  		err = clk->ops.open(pccontext, fp->f_mode);
>  		if (err) {




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ