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: <87ms4icely.fsf@nvidia.com>
Date: Wed, 19 Nov 2025 14:40:41 +0100
From: Petr Machata <petrm@...dia.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: <davem@...emloft.net>, <netdev@...r.kernel.org>, <edumazet@...gle.com>,
	<pabeni@...hat.com>, <andrew+netdev@...n.ch>, <horms@...nel.org>,
	<willemdebruijn.kernel@...il.com>, <shuah@...nel.org>, <sdf@...ichev.me>,
	<krakauer@...gle.com>, <linux-kselftest@...r.kernel.org>, <petrm@...dia.com>,
	<matttbe@...nel.org>
Subject: Re: [PATCH net-next v2 01/12] selftests: net: py: coding style
 improvements


Jakub Kicinski <kuba@...nel.org> writes:

> We're about to add more features here and finding new issues with old
> ones in place is hard. Address ruff checks:
>  - bare exceptions
>  - f-string with no params
>  - unused import
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
>  tools/testing/selftests/net/lib/py/ksft.py | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/net/lib/py/ksft.py b/tools/testing/selftests/net/lib/py/ksft.py
> index 83b1574f7719..56dd9bd060cd 100644
> --- a/tools/testing/selftests/net/lib/py/ksft.py
> +++ b/tools/testing/selftests/net/lib/py/ksft.py
> @@ -1,6 +1,5 @@
>  # SPDX-License-Identifier: GPL-2.0
>  
> -import builtins
>  import functools
>  import inspect
>  import signal
> @@ -163,7 +162,7 @@ KSFT_DISRUPTIVE = True
>          entry = global_defer_queue.pop()
>          try:
>              entry.exec_only()
> -        except:
> +        except Exception:

This used to catch KsftTerminate, which we use for SIGTERM handling, now
it doesn't anymore. I think it could legitimately appear in that context
if SIGTERM si delivered while exec_only() is running.

IMHO it should catch BaseException, like ksft_run() already does.

>              ksft_pr(f"Exception while handling defer / cleanup (callback {i} of {qlen_start})!")
>              tb = traceback.format_exc()
>              for line in tb.strip().split('\n'):
> @@ -181,7 +180,7 @@ KSFT_DISRUPTIVE = True
>      @functools.wraps(func)
>      def wrapper(*args, **kwargs):
>          if not KSFT_DISRUPTIVE:
> -            raise KsftSkipEx(f"marked as disruptive")
> +            raise KsftSkipEx("marked as disruptive")
>          return func(*args, **kwargs)
>      return wrapper
>  

> @@ -199,7 +198,7 @@ KSFT_DISRUPTIVE = True
>              return False
>          try:
>              return bool(int(value))
> -        except:
> +        except Exception:
>              raise Exception(f"failed to parse {name}")

I think this will end up being called from inside the try/except in
ksft_run() and therefore should be OK like this. It's actually more
correct like this, SIGTERM shouldn't cause "failed to parse" errors.

>  
>      if "DISRUPTIVE" in env:


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ