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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250924162518.GA2827867@ax162>
Date: Wed, 24 Sep 2025 09:25:18 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Kees Cook <kees@...nel.org>
Cc: Nicolas Schier <nicolas.schier@...ux.dev>,
	Vegard Nossum <vegard.nossum@...cle.com>,
	Masahiro Yamada <masahiroy@...nel.org>,
	linux-kbuild@...r.kernel.org,
	Sami Tolvanen <samitolvanen@...gle.com>,
	Jonathan Corbet <corbet@....net>,
	Randy Dunlap <rdunlap@...radead.org>, Arnd Bergmann <arnd@...db.de>,
	Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
	Linus Walleij <linus.walleij@...aro.org>,
	Mark Rutland <mark.rutland@....com>,
	Peter Zijlstra <peterz@...radead.org>,
	Puranjay Mohan <puranjay@...nel.org>, linux-kernel@...r.kernel.org,
	linux-doc@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH v3 1/3] kconfig: Fix BrokenPipeError warnings in selftests

On Tue, Sep 23, 2025 at 02:34:17PM -0700, Kees Cook wrote:
> The kconfig test harness ("make testconfig") was generating BrokenPipeError
> warnings when running interactive tests like oldaskconfig and oldconfig:
> 
>   /usr/lib/python3/dist-packages/_pytest/unraisableexception.py:85: PytestUnraisableExceptionWarning: Exception ignored in: <_io.BufferedWriter name=12>
> 
>   Traceback (most recent call last):
>     File "/srv/code/scripts/kconfig/tests/conftest.py", line 127, in oldaskconfig
>       return self._run_conf('--oldaskconfig', dot_config=dot_config,
>              ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>                             interactive=True, in_keys=in_keys)
>                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   BrokenPipeError: [Errno 32] Broken pipe
> 
> The issue occurred when the test framework attempted to write to stdin
> after the conf subprocess had already exited.
> 
> Wrap stdin write operations in try/except to catch BrokenPipeError and
> stop sending more input. Add explicit flush() after writes so we can see
> delivery errors immediately. Ignore BrokenPipeError when closing stdin.
> Explicitly call wait() to validate subprocess termination.
> 
> Signed-off-by: Kees Cook <kees@...nel.org>
> ---

Reviewed-by: Nathan Chancellor <nathan@...nel.org>
Tested-by: Nathan Chancellor <nathan@...nel.org>

> ---
>  scripts/kconfig/tests/conftest.py | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/kconfig/tests/conftest.py b/scripts/kconfig/tests/conftest.py
> index 2a2a7e2da060..d94b79e012c0 100644
> --- a/scripts/kconfig/tests/conftest.py
> +++ b/scripts/kconfig/tests/conftest.py
> @@ -81,7 +81,22 @@ class Conf:
>                  # For interactive modes such as oldaskconfig, oldconfig,
>                  # send 'Enter' key until the program finishes.
>                  if interactive:
> -                    ps.stdin.write(b'\n')
> +                    try:
> +                        ps.stdin.write(b'\n')
> +                        ps.stdin.flush()
> +                    except (BrokenPipeError, OSError):
> +                        # Process has exited, stop sending input
> +                        break
> +
> +            # Close stdin gracefully
> +            try:
> +                ps.stdin.close()
> +            except (BrokenPipeError, OSError):
> +                # Ignore broken pipe on close
> +                pass
> +
> +            # Wait for process to complete
> +            ps.wait()
>  
>              self.retcode = ps.returncode
>              self.stdout = ps.stdout.read().decode()
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ