public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] rtld: properly handle root directory in load path (bug 30435)
@ 2023-05-16 14:37 Andreas Schwab
  2023-05-25  2:03 ` Siddhesh Poyarekar
  2023-05-25 12:33 ` Adhemerval Zanella Netto
  0 siblings, 2 replies; 4+ messages in thread
From: Andreas Schwab @ 2023-05-16 14:37 UTC (permalink / raw)
  To: libc-alpha

Don't strip the trailing slash when checking for existence of a load path
element to handle the special case of the root directory.
---
 elf/dl-load.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elf/dl-load.c b/elf/dl-load.c
index 39c63ff1b3..2aa487b49a 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1859,7 +1859,7 @@ open_path (const char *name, size_t namelen, int mode,
 		     test whether there is any directory at all.  */
 		  struct __stat64_t64 st;
 
-		  buf[buflen - namelen - 1] = '\0';
+		  buf[buflen - namelen] = '\0';
 
 		  if (__stat64_time64 (buf, &st) != 0
 		      || ! S_ISDIR (st.st_mode))
-- 
2.40.1


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rtld: properly handle root directory in load path (bug 30435)
  2023-05-16 14:37 [PATCH] rtld: properly handle root directory in load path (bug 30435) Andreas Schwab
@ 2023-05-25  2:03 ` Siddhesh Poyarekar
  2023-05-25 12:33 ` Adhemerval Zanella Netto
  1 sibling, 0 replies; 4+ messages in thread
From: Siddhesh Poyarekar @ 2023-05-25  2:03 UTC (permalink / raw)
  To: Andreas Schwab, libc-alpha



On 2023-05-16 10:37, Andreas Schwab via Libc-alpha wrote:
> Don't strip the trailing slash when checking for existence of a load path
> element to handle the special case of the root directory.
> ---
>   elf/dl-load.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

LGTM.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

> 
> diff --git a/elf/dl-load.c b/elf/dl-load.c
> index 39c63ff1b3..2aa487b49a 100644
> --- a/elf/dl-load.c
> +++ b/elf/dl-load.c
> @@ -1859,7 +1859,7 @@ open_path (const char *name, size_t namelen, int mode,
>   		     test whether there is any directory at all.  */
>   		  struct __stat64_t64 st;
>   
> -		  buf[buflen - namelen - 1] = '\0';
> +		  buf[buflen - namelen] = '\0';
>   
>   		  if (__stat64_time64 (buf, &st) != 0
>   		      || ! S_ISDIR (st.st_mode))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rtld: properly handle root directory in load path (bug 30435)
  2023-05-16 14:37 [PATCH] rtld: properly handle root directory in load path (bug 30435) Andreas Schwab
  2023-05-25  2:03 ` Siddhesh Poyarekar
@ 2023-05-25 12:33 ` Adhemerval Zanella Netto
  2023-05-25 12:37   ` Siddhesh Poyarekar
  1 sibling, 1 reply; 4+ messages in thread
From: Adhemerval Zanella Netto @ 2023-05-25 12:33 UTC (permalink / raw)
  To: libc-alpha, Andreas Schwab, Siddhesh Poyarekar



On 16/05/23 11:37, Andreas Schwab via Libc-alpha wrote:
> Don't strip the trailing slash when checking for existence of a load path
> element to handle the special case of the root directory.
> ---
>  elf/dl-load.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/elf/dl-load.c b/elf/dl-load.c
> index 39c63ff1b3..2aa487b49a 100644
> --- a/elf/dl-load.c
> +++ b/elf/dl-load.c
> @@ -1859,7 +1859,7 @@ open_path (const char *name, size_t namelen, int mode,
>  		     test whether there is any directory at all.  */
>  		  struct __stat64_t64 st;
>  
> -		  buf[buflen - namelen - 1] = '\0';
> +		  buf[buflen - namelen] = '\0';
>  
>  		  if (__stat64_time64 (buf, &st) != 0
>  		      || ! S_ISDIR (st.st_mode))

Which is difference between this and another fix for this very issue [1]?
And what about the testcase [2], this should really have a regression
tests.

[1] https://sourceware.org/pipermail/libc-alpha/2023-May/147956.html
[2] https://sourceware.org/pipermail/libc-alpha/2023-May/147957.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rtld: properly handle root directory in load path (bug 30435)
  2023-05-25 12:33 ` Adhemerval Zanella Netto
@ 2023-05-25 12:37   ` Siddhesh Poyarekar
  0 siblings, 0 replies; 4+ messages in thread
From: Siddhesh Poyarekar @ 2023-05-25 12:37 UTC (permalink / raw)
  To: Adhemerval Zanella Netto, libc-alpha, Andreas Schwab

On 2023-05-25 08:33, Adhemerval Zanella Netto wrote:
> 
> 
> On 16/05/23 11:37, Andreas Schwab via Libc-alpha wrote:
>> Don't strip the trailing slash when checking for existence of a load path
>> element to handle the special case of the root directory.
>> ---
>>   elf/dl-load.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/elf/dl-load.c b/elf/dl-load.c
>> index 39c63ff1b3..2aa487b49a 100644
>> --- a/elf/dl-load.c
>> +++ b/elf/dl-load.c
>> @@ -1859,7 +1859,7 @@ open_path (const char *name, size_t namelen, int mode,
>>   		     test whether there is any directory at all.  */
>>   		  struct __stat64_t64 st;
>>   
>> -		  buf[buflen - namelen - 1] = '\0';
>> +		  buf[buflen - namelen] = '\0';
>>   
>>   		  if (__stat64_time64 (buf, &st) != 0
>>   		      || ! S_ISDIR (st.st_mode))
> 
> Which is difference between this and another fix for this very issue [1]?
> And what about the testcase [2], this should really have a regression
> tests.
> 
> [1] https://sourceware.org/pipermail/libc-alpha/2023-May/147956.html
> [2] https://sourceware.org/pipermail/libc-alpha/2023-May/147957.html
> 

Ugh, sorry I missed them.  I'll review the test case for inclusion.

Thanks for keeping track!

Sid

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-25 12:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-16 14:37 [PATCH] rtld: properly handle root directory in load path (bug 30435) Andreas Schwab
2023-05-25  2:03 ` Siddhesh Poyarekar
2023-05-25 12:33 ` Adhemerval Zanella Netto
2023-05-25 12:37   ` Siddhesh Poyarekar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).