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: <willemdebruijn.kernel.f136c851c9ee@gmail.com>
Date: Sun, 11 Jan 2026 22:43:19 -0500
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Gal Pressman <gal@...dia.com>, 
 "David S. Miller" <davem@...emloft.net>, 
 Eric Dumazet <edumazet@...gle.com>, 
 Jakub Kicinski <kuba@...nel.org>, 
 Paolo Abeni <pabeni@...hat.com>, 
 Andrew Lunn <andrew+netdev@...n.ch>, 
 netdev@...r.kernel.org
Cc: Shuah Khan <shuah@...nel.org>, 
 Willem de Bruijn <willemb@...gle.com>, 
 Petr Machata <petrm@...dia.com>, 
 Coco Li <lixiaoyan@...gle.com>, 
 linux-kselftest@...r.kernel.org, 
 Gal Pressman <gal@...dia.com>, 
 Nimrod Oren <noren@...dia.com>
Subject: Re: [PATCH net-next 1/2] selftests: drv-net: fix RPS mask handling in
 toeplitz test

Gal Pressman wrote:
> The toeplitz.py test passed the hex mask without "0x" prefix (e.g.,
> "300" for CPUs 8,9). The toeplitz.c strtoul() call wrongly parsed this
> as decimal 300 (0x12c) instead of hex 0x300.
> 
> Use separate format strings for sysfs (plain hex via format()) and
> command line (prefixed hex via hex()).
> 
> Fixes: 9cf9aa77a1f6 ("selftests: drv-net: hw: convert the Toeplitz test to Python")
> Reviewed-by: Nimrod Oren <noren@...dia.com>
> Signed-off-by: Gal Pressman <gal@...dia.com>

Reviewed-by: Willem de Bruijn <willemb@...gle.com>

> ---
>  tools/testing/selftests/drivers/net/hw/toeplitz.py | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/drivers/net/hw/toeplitz.py b/tools/testing/selftests/drivers/net/hw/toeplitz.py
> index d2db5ee9e358..7a9af4af1838 100755
> --- a/tools/testing/selftests/drivers/net/hw/toeplitz.py
> +++ b/tools/testing/selftests/drivers/net/hw/toeplitz.py
> @@ -94,14 +94,17 @@ def _configure_rps(cfg, rps_cpus):
>      mask = 0
>      for cpu in rps_cpus:
>          mask |= (1 << cpu)
> -    mask = hex(mask)[2:]
> +
> +    # sysfs expect hex without '0x' prefix, toeplitz.c needs the prefix
> +    mask_sysfs = format(mask, 'x')

A particular reason not to use the existing slicing?

> +    mask_cmdline = hex(mask)
>  
>      # Set RPS bitmap for all rx queues
>      for rps_file in glob.glob(f"/sys/class/net/{cfg.ifname}/queues/rx-*/rps_cpus"):
>          with open(rps_file, "w", encoding="utf-8") as fp:
> -            fp.write(mask)
> +            fp.write(mask_sysfs)

Alternatively 

-    mask = hex(mask)[2:]
+    mask = hex(mask)

- fp.write(mask)
+ fp.write(mask[2:])

The comment that sysfs and toeplitz.c expect different input is
definitely helpful.

>  
> -    return mask
> +    return mask_cmdline
>  
>  
>  def _send_traffic(cfg, proto_flag, ipver, port):
> -- 
> 2.40.1
> 



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ