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: <Z8/SQRskrrvSofW7@mev-dev.igk.intel.com>
Date: Tue, 11 Mar 2025 07:03:45 +0100
From: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
To: Jacob Keller <jacob.e.keller@...el.com>
Cc: Tony Nguyen <anthony.l.nguyen@...el.com>,
	Przemek Kitszel <przemyslaw.kitszel@...el.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>,
	Richard Cochran <richardcochran@...il.com>,
	Ruud Bos <kernel.hbk@...il.com>,
	Paul Barker <paul.barker.ct@...renesas.com>,
	Niklas Söderlund <niklas.soderlund@...natech.se>,
	Bryan Whitehead <bryan.whitehead@...rochip.com>,
	UNGLinuxDriver@...rochip.com,
	Raju Lakkaraju <Raju.Lakkaraju@...rochip.com>,
	Florian Fainelli <florian.fainelli@...adcom.com>,
	Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
	Andrew Lunn <andrew@...n.ch>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Russell King <linux@...linux.org.uk>,
	Jonathan Lemon <jonathan.lemon@...il.com>,
	Lasse Johnsen <l@...johnsen.me>,
	Vadim Fedorenko <vadim.fedorenko@...ux.dev>,
	intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org,
	linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH net 1/5] igb: reject invalid external timestamp requests
 for 82580-based HW

On Mon, Mar 10, 2025 at 03:16:36PM -0700, Jacob Keller wrote:
> The igb_ptp_feature_enable_82580 function correctly checks that unknown
> flags are not passed to the function. However, it does not actually check
> PTP_RISING_EDGE or PTP_FALLING_EDGE when configuring the external timestamp
> function.
> 
> The data sheet for the 82580 product says:
> 
>   Upon a change in the input level of one of the SDP pins that was
>   configured to detect Time stamp events using the TSSDP register, a time
>   stamp of the system time is captured into one of the two auxiliary time
>   stamp registers (AUXSTMPL/H0 or AUXSTMPL/H1).
> 
>   For example to define timestamping of events in the AUXSTMPL0 and
>   AUXSTMPH0 registers, Software should:
> 
>   1. Set the TSSDP.AUX0_SDP_SEL field to select the SDP pin that detects
>      the level change and set the TSSDP.AUX0_TS_SDP_EN bit to 1.
> 
>   2. Set the TSAUXC.EN_TS0 bit to 1 to enable timestamping
> 
> The same paragraph is in the i350 and i354 data sheets.
> 
> The wording implies that the time stamps are captured at any level change.
> There does not appear to be any way to only timestamp one edge of the
> signal.
> 
> Reject requests which do not set both PTP_RISING_EDGE and PTP_FALLING_EDGE
> when operating under PTP_STRICT_FLAGS mode via PTP_EXTTS_REQUEST2.
> 
> Fixes: 38970eac41db ("igb: support EXTTS on 82580/i354/i350")
> Signed-off-by: Jacob Keller <jacob.e.keller@...el.com>
> ---
>  drivers/net/ethernet/intel/igb/igb_ptp.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
> index f9457055612004c10f74379122063e8136fe7d76..b89ef4538a18d7ca11325ddc15944a878f4d807e 100644
> --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
> +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
> @@ -509,6 +509,11 @@ static int igb_ptp_feature_enable_82580(struct ptp_clock_info *ptp,
>  					PTP_STRICT_FLAGS))
>  			return -EOPNOTSUPP;
>  
> +		/* Both the rising and falling edge are timstamped */
> +		if (rq->extts.flags & PTP_STRICT_FLAGS &&
> +		    (rq->extts.flags & PTP_EXTTS_EDGES) != PTP_EXTTS_EDGES)
> +			return -EOPNOTSUPP;
> +
>  		if (on) {
>  			pin = ptp_find_pin(igb->ptp_clock, PTP_PF_EXTTS,
>  					   rq->extts.index);

Thanks for fixing
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>

In igb_ptp_feature_enable_i210() there is the same check for both edges
but also PTP_ENABLE_FEATURE is tested. There is no need for it here, or
it is redundant even in i210?

> 
> -- 
> 2.48.1.397.gec9d649cc640

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ