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: <001a139e-d4fa-2fd7-348f-173392210dfd@csgroup.eu>
Date:   Wed, 17 Mar 2021 18:35:18 +0100
From:   Christophe Leroy <christophe.leroy@...roup.eu>
To:     David Laight <David.Laight@...LAB.COM>,
        Segher Boessenkool <segher@...nel.crashing.org>
Cc:     Alexander Potapenko <glider@...gle.com>,
        Marco Elver <elver@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Dmitriy Vyukov <dvyukov@...gle.com>,
        Andrey Konovalov <andreyknvl@...gle.com>,
        Jann Horn <jannh@...gle.com>,
        LKML <linux-kernel@...r.kernel.org>,
        Linux Memory Management List <linux-mm@...ck.org>,
        kasan-dev <kasan-dev@...glegroups.com>
Subject: Re: [PATCH mm] kfence: fix printk format for ptrdiff_t



Le 17/03/2021 à 13:51, David Laight a écrit :
> From: Christophe Leroy
>> Sent: 16 March 2021 15:41
> ...
>>>> include/linux/types.h:typedef __kernel_ptrdiff_t	ptrdiff_t;
>>>>
>>>> And get:
>>>>
>>>>     CC      mm/kfence/report.o
>>>> In file included from ./include/linux/printk.h:7,
>>>>                    from ./include/linux/kernel.h:16,
>>>>                    from mm/kfence/report.c:10:
>>>> mm/kfence/report.c: In function 'kfence_report_error':
>>>> ./include/linux/kern_levels.h:5:18: warning: format '%td' expects argument
>>>> of type 'ptrdiff_t', but argument 6 has type 'long int' [-Wformat=]
>>>
>>> This is declared as
>>>           const ptrdiff_t object_index = meta ? meta - kfence_metadata : -1;
>>> so maybe something with that goes wrong?  What happens if you delete the
>>> (useless) "const" here?
> 
> The obvious thing to try is changing it to 'int'.
> That will break 64bit builds, but if it fixes the 32bit one
> it will tell you what type gcc is expecting.
> 

Yes, if defining 'object_index' as int, gcc is happy.
If removing the powerpc re-definition of ptrdiff_t typedef in 
https://elixir.bootlin.com/linux/v5.12-rc3/source/arch/powerpc/include/uapi/asm/posix_types.h , it 
works great as well.

So seems like gcc doesn't take into account the typedef behind ptrdiff_t, it just expects it to be 
int on 32 bits ?

Christophe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ