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: <202309291057.6D4993BA@keescook>
Date:   Fri, 29 Sep 2023 10:58:09 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Greg Ungerer <gerg@...nel.org>
Cc:     linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, palmer@...osinc.com,
        ebiederm@...ssion.com, brauner@...nel.org, viro@...iv.linux.org.uk
Subject: Re: [PATCH] binfmt_elf_fdpic: clean up debug warnings

On Thu, Sep 28, 2023 at 02:53:09PM +1000, Greg Ungerer wrote:
> Hi Kees,
> 
> On 28/9/23 01:59, Kees Cook wrote:
> > On Wed, Sep 27, 2023 at 11:29:33PM +1000, Greg Ungerer wrote:
> > > The binfmt_elf_fdpic loader has some debug trace that can be enabled at
> > > build time. The recent 64-bit additions cause some warnings if that
> > > debug is enabled, such as:
> > > 
> > >      fs/binfmt_elf_fdpic.c: In function ‘elf_fdpic_map_file’:
> > >      fs/binfmt_elf_fdpic.c:46:33: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘Elf64_Addr’ {aka ‘long long unsigned int’} [-Wformat=]
> > >         46 | #define kdebug(fmt, ...) printk("FDPIC "fmt"\n" ,##__VA_ARGS__ )
> > >            |                                 ^~~~~~~~
> > >      ./include/linux/printk.h:427:25: note: in definition of macro ‘printk_index_wrap’
> > >        427 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
> > >            |                         ^~~~
> > > 
> > > Cast values to the largest possible type (which is equivilent to unsigned
> > > long long in this case) and use appropriate format specifiers to match.
> > 
> > It seems like these should all just be "unsigned long", yes?
> 
> Some of them yes, but not all.
> For example trying to use unsigned long in the last chunk of this patch:
> 
> fs/binfmt_elf_fdpic.c: In function ‘elf_fdpic_map_file_by_direct_mmap’:
> fs/binfmt_elf_fdpic.c:46:33: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘long long unsigned int’ [-Wformat=]

Oh, something is actually using "long long" already. :P Gotcha. Thanks!

-Kees

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ