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: <97fd7c74-bfb5-4ff1-9698-e60d7b3c9a11@t-8ch.de>
Date: Mon, 15 Sep 2025 10:45:20 +0200
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Benjamin Berg <benjamin@...solutions.net>
Cc: linux-um@...ts.infradead.org, Willy Tarreau <w@....eu>, 
	linux-kselftest@...r.kernel.org, Arnaldo Carvalho de Melo <acme@...hat.com>, 
	linux-kernel@...r.kernel.org, Tiwei Bie <tiwei.btw@...group.com>, 
	Benjamin Berg <benjamin.berg@...el.com>
Subject: Re: [PATCH 4/9] tools/nolibc/dirent: avoid errno in readdir_r

On 2025-09-15 09:11:10+0200, Benjamin Berg wrote:
> From: Benjamin Berg <benjamin.berg@...el.com>
> 
> Using errno is not possible when NOLIBC_IGNORE_ERRNO is set. Use
> sys_lseek instead of lseek as that avoids using errno.
> 
> Fixes: 665fa8dea90d ("tools/nolibc: add support for directory access")
> Signed-off-by: Benjamin Berg <benjamin.berg@...el.com>

Acked-by: Thomas Weißschuh <linux@...ssschuh.net>

> ---
>  tools/include/nolibc/dirent.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/include/nolibc/dirent.h b/tools/include/nolibc/dirent.h
> index 758b95c48e7a..61a122a60327 100644
> --- a/tools/include/nolibc/dirent.h
> +++ b/tools/include/nolibc/dirent.h
> @@ -86,9 +86,9 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
>  	 * readdir() can only return one entry at a time.
>  	 * Make sure the non-returned ones are not skipped.
>  	 */
> -	ret = lseek(fd, ldir->d_off, SEEK_SET);
> -	if (ret == -1)
> -		return errno;
> +	ret = sys_lseek(fd, ldir->d_off, SEEK_SET);
> +	if (ret < 0)
> +		return -ret;
>  
>  	entry->d_ino = ldir->d_ino;
>  	/* the destination should always be big enough */
> -- 
> 2.51.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ