Re: [RFC PATCH 1/2] elf: Port ldconfig away from stack-allocated paths

2023-05-25 Thread Florian Weimer
* Sergey Bugaev: > diff --git a/elf/ldconfig.c b/elf/ldconfig.c > index 2fc45ad8..e643dd57 100644 > --- a/elf/ldconfig.c > +++ b/elf/ldconfig.c > - len = strlen (dir_name) + strlen (direntry->d_name) + 2; > - if (len > real_file_name_len) > - { > - real_file_name_len

Re: [RFC PATCH 1/2] elf: Port ldconfig away from stack-allocated paths

2023-05-23 Thread Adhemerval Zanella Netto
On 20/05/23 16:03, Sergey Bugaev wrote: > Hello, > > On Fri, May 19, 2023 at 3:25 PM Florian Weimer wrote: >> Missing error checking? > > Indeed, thanks. Fixed. > >> I think we use x* functions such a xstrdup elsewhere in ldconfig, so you >> could add xasprintf as well. > > Apparently the e

Re: [RFC PATCH 1/2] elf: Port ldconfig away from stack-allocated paths

2023-05-20 Thread Sergey Bugaev
Hello, On Fri, May 19, 2023 at 3:25 PM Florian Weimer wrote: > Missing error checking? Indeed, thanks. Fixed. > I think we use x* functions such a xstrdup elsewhere in ldconfig, so you > could add xasprintf as well. Apparently the existing code didn't #include and link to libsupport (xstrdup

Re: [RFC PATCH 1/2] elf: Port ldconfig away from stack-allocated paths

2023-05-19 Thread Florian Weimer
* Sergey Bugaev via Libc-alpha: > @@ -733,25 +723,11 @@ search_dir (const struct dir_entry *entry) >+ 1, ".#prelink#.", sizeof (".#prelink#.") - 1) == 0) > continue; > } > - len += strlen (entry->path) + 2; > - if (len > file_name_len) > - { >

Re: [RFC PATCH 1/2] elf: Port ldconfig away from stack-allocated paths

2023-05-18 Thread Adhemerval Zanella Netto
On 17/05/23 15:54, Sergey Bugaev via Libc-alpha wrote: > ldconfig was allocating PATH_MAX bytes on the stack for the library file > name. The issues with PATH_MAX usage are well documented [0][1]; even if > a program does not rely on paths being limited to PATH_MAX bytes, > allocating 4096 bytes

[RFC PATCH 1/2] elf: Port ldconfig away from stack-allocated paths

2023-05-17 Thread Sergey Bugaev
ldconfig was allocating PATH_MAX bytes on the stack for the library file name. The issues with PATH_MAX usage are well documented [0][1]; even if a program does not rely on paths being limited to PATH_MAX bytes, allocating 4096 bytes on the stack for paths that are typically rather short (strlen ("