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: <CAG4es9UxQEMx9gH4-khe39x05ioNbhZpym3G6TcR6aYQYtrj-A@mail.gmail.com>
Date: Wed, 1 May 2024 13:21:35 -0700
From: Edward Liaw <edliaw@...gle.com>
To: Justin Stitt <justinstitt@...gle.com>
Cc: linux-kernel@...r.kernel.org, Shuah Khan <shuah@...nel.org>, 
	Nathan Chancellor <nathan@...nel.org>, Nick Desaulniers <ndesaulniers@...gle.com>, 
	Bill Wendling <morbo@...gle.com>, "H. Peter Anvin" <hpa@...ux.intel.com>, Andy Lutomirski <luto@....edu>, 
	linux-kselftest@...r.kernel.org, kernel-team@...roid.com, 
	llvm@...ts.linux.dev
Subject: Re: [PATCH v3] selftests/vDSO: Explicit unsigned char conversion for elf_hash

On Wed, May 1, 2024 at 12:54 PM Justin Stitt <justinstitt@...gle.com> wrote:
>
> Hi,
>
> On Wed, May 01, 2024 at 06:06:18PM +0000, Edward Liaw wrote:
> > Fixes clang compilation warnings by adding explicit unsigned conversion:
> >
> > parse_vdso.c:206:22: warning: passing 'const char *' to parameter of
> >  type 'const unsigned char *' converts between pointers to integer types
> >  where one is of the unique plain 'char' type and the other is not
> >  [-Wpointer-sign]
> >         ver_hash = elf_hash(version);
> >                             ^~~~~~~
> > parse_vdso.c:59:52: note: passing argument to parameter 'name' here
> > static unsigned long elf_hash(const unsigned char *name)
> >                                                    ^
> > parse_vdso.c:207:46: warning: passing 'const char *' to parameter of
> >  type 'const unsigned char *' converts between pointers to integer types
> >  where one is of the unique plain 'char' type and the other is not
> >  [-Wpointer-sign]
> >         ELF(Word) chain = vdso_info.bucket[elf_hash(name) % vdso_infonbucket];
> >                                                     ^~~~
> > parse_vdso.c:59:52: note: passing argument to parameter 'name' here
> > static unsigned long elf_hash(const unsigned char *name)
> >
> > Fixes: 98eedc3a9dbf ("Document the vDSO and add a reference parser")
> > Signed-off-by: Edward Liaw <edliaw@...gle.com>
>
> > ---
> > v2: update commit message with correct compiler warning
> > v3: fix checkpatch errors and indentation
> > ---
> >  tools/testing/selftests/vDSO/parse_vdso.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
> > index 413f75620a35..9e29ff0657ea 100644
> > --- a/tools/testing/selftests/vDSO/parse_vdso.c
> > +++ b/tools/testing/selftests/vDSO/parse_vdso.c
> > @@ -203,8 +203,9 @@ void *vdso_sym(const char *version, const char *name)
>
> Is it possible to just change the types of the parameters of vdso_sym()
> or does that trigger even more warnings on the callsites of vdso_sym()?

It does trigger more warnings on the callsites unfortunately.

>
> Either way, this looks ok to me.
>
> Acked-by: Justin Stitt <justinstitt@...gle.com>
>
> >       if (!vdso_info.valid)
> >               return 0;
> >
> > -     ver_hash = elf_hash(version);
> > -     ELF(Word) chain = vdso_info.bucket[elf_hash(name) % vdso_info.nbucket];
> > +     ver_hash = elf_hash((const unsigned char *)version);
> > +     ELF(Word) chain = vdso_info.bucket[
> > +             elf_hash((const unsigned char *)name) % vdso_info.nbucket];
> >
> >       for (; chain != STN_UNDEF; chain = vdso_info.chain[chain]) {
> >               ELF(Sym) *sym = &vdso_info.symtab[chain];
> > --
> > 2.45.0.rc0.197.gbae5840b3b-goog
> >
>
> Thanks
> Justin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ