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: <03fa25f0-b7f5-4b3e-8a93-0637d0222719@linux.dev>
Date: Wed, 29 Oct 2025 20:33:55 +0000
From: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
To: Carolina Jubran <cjubran@...dia.com>,
 Richard Cochran <richardcochran@...il.com>,
 Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
 <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
 Dragos Tatulea <dtatulea@...dia.com>, Tariq Toukan <tariqt@...dia.com>
Subject: Re: [PATCH net] ptp: Allow exposing cycles only for clocks with
 free-running counter

On 29/10/2025 08:38, Carolina Jubran wrote:
> The PTP core falls back to gettimex64 and getcrosststamp when
> getcycles64 or getcyclesx64 are not implemented. This causes the CYCLES
> ioctls to retrieve PHC real time instead of free-running cycles.
> 
> Reject PTP_SYS_OFFSET_{PRECISE,EXTENDED}_CYCLES for clocks without
> free-running counter support since the result would represent PHC real
> time and system time rather than cycles and system time.
> 
> Fixes: faf23f54d366 ("ptp: Add ioctl commands to expose raw cycle counter values")
> Signed-off-by: Carolina Jubran <cjubran@...dia.com>
> Reviewed-by: Dragos Tatulea <dtatulea@...dia.com>
> Reviewed-by: Tariq Toukan <tariqt@...dia.com>
> ---
>   drivers/ptp/ptp_chardev.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index 8106eb617c8c..c61cf9edac48 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -561,10 +561,14 @@ long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd,
>   		return ptp_mask_en_single(pccontext->private_clkdata, argptr);
>   
>   	case PTP_SYS_OFFSET_PRECISE_CYCLES:
> +		if (!ptp->has_cycles)
> +			return -EOPNOTSUPP;
>   		return ptp_sys_offset_precise(ptp, argptr,
>   					      ptp->info->getcrosscycles);
>   
>   	case PTP_SYS_OFFSET_EXTENDED_CYCLES:
> +		if (!ptp->has_cycles)
> +			return -EOPNOTSUPP;
>   		return ptp_sys_offset_extended(ptp, argptr,
>   					       ptp->info->getcyclesx64);
>   	default:

Fair point.
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@...ux.dev>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ