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: <DFZIS0QDDD56.1ZB0WZUXPR5IZ@garyguo.net>
Date: Tue, 27 Jan 2026 16:41:40 +0000
From: "Gary Guo" <gary@...yguo.net>
To: "Tamir Duberstein" <tamird@...nel.org>, "Miguel Ojeda"
 <ojeda@...nel.org>, "Boqun Feng" <boqun.feng@...il.com>, "Gary Guo"
 <gary@...yguo.net>, Björn Roy Baron
 <bjorn3_gh@...tonmail.com>, "Benno Lossin" <lossin@...nel.org>, "Andreas
 Hindborg" <a.hindborg@...nel.org>, "Alice Ryhl" <aliceryhl@...gle.com>,
 "Trevor Gross" <tmgross@...ch.edu>, "Danilo Krummrich" <dakr@...nel.org>,
 "Alex Gaynor" <alex.gaynor@...il.com>, "Fiona Behrens" <me@...enk.dev>,
 "Boris-Chengbiao Zhou" <bobo1239@....de>
Cc: "Kees Cook" <kees@...nel.org>, <rust-for-linux@...r.kernel.org>,
 <linux-kernel@...r.kernel.org>, <stable@...r.kernel.org>, "Daniel Almeida"
 <daniel.almeida@...labora.com>
Subject: Re: [PATCH v2] scripts: generate_rust_analyzer.py: avoid FD leak

On Tue Jan 27, 2026 at 4:35 PM GMT, Tamir Duberstein wrote:
> Use `pathlib.Path.read_text()` to avoid leaking file descriptors.
>
> Fixes: 8c4555ccc55c ("scripts: add `generate_rust_analyzer.py`")
> Cc: stable@...r.kernel.org
> Reviewed-by: Daniel Almeida <daniel.almeida@...labora.com>
> Reviewed-by: Fiona Behrens <me@...enk.dev>
> Reviewed-by: Trevor Gross <tmgross@...ch.edu>
> Signed-off-by: Tamir Duberstein <tamird@...nel.org>
> ---
> Changes in v2:
> - Use pathlib.Path.read_text. (Levi Zim)
> - Drop errant Tested-by tag. (Miguel Ojeda)
> - Link to v1: https://patch.msgid.link/20260122-rust-analyzer-fd-leak-v1-1-945577813b20@kernel.org
> ---
>  scripts/generate_rust_analyzer.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
> index 3b645da90092..152bd3705303 100755
> --- a/scripts/generate_rust_analyzer.py
> +++ b/scripts/generate_rust_analyzer.py
> @@ -190,9 +190,10 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit
>  
>      def is_root_crate(build_file, target):
>          try:
> -            return f"{target}.o" in open(build_file).read()
> +            contents = build_file.read_text()

Couldn't this just be

    return f"{target.o}" in build_file.read_text()

?

Best,
Gary

>          except FileNotFoundError:
>              return False
> +        return f"{target}.o" in contents
>  
>      # Then, the rest outside of `rust/`.
>      #
>
> ---
> base-commit: 2af6ad09fc7dfe9b3610100983cccf16998bf34d
> change-id: 20260122-rust-analyzer-fd-leak-b247830d666e
>
> Best regards,
> --  
> Tamir Duberstein <tamird@...nel.org>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ