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: <CABeXuvpwLhXCVyBitpFBKAan+5CbnszfvK-=shQYaEeCwyhA7A@mail.gmail.com>
Date:   Mon, 27 Mar 2017 14:02:46 -0700
From:   Deepa Dinamani <deepa.kernel@...il.com>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     Steven Rostedt <rostedt@...dmis.org>,
        kbuild test robot <lkp@...el.com>, kbuild-all@...org,
        Ingo Molnar <mingo@...hat.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        y2038 Mailman List <y2038@...ts.linaro.org>
Subject: Re: [PATCH] trace: Make trace_hwlat timestamp y2038 safe

>>> >
>>> >    kernel/trace/trace_output.c: In function 'trace_hwlat_print':
>>> >>> kernel/trace/trace_output.c:1168:5: warning: format '%lld' expects argument of type 'long long int', but argument 6 has type '__kernel_time_t' [-Wformat=]
>>> >         field->timestamp.tv_nsec);
>>>
>>> This happens on 64-bit architectures because 'struct timespec64' is defined to
>>> be equal to 'struct timespec', which has a 'long' tv_sec rather than
>>> 'long long'.
>>>
>>> A cast to 's64' is probably the best workaround.

We have been using long long cast to print timespec64 tv_sec.

I'm not sure what format specifier we would use if we cast to s64.
printk-formats suggests %lld or %llx.
Meaning a cast to long long.

>>>
>>> >    kernel/trace/trace_output.c: In function 'trace_hwlat_raw':
>>> >    kernel/trace/trace_output.c:1202:5: warning: format '%lld' expects argument of type 'long long int', but argument 5 has type '__kernel_time_t' [-Wformat=]
>>> >         field->seqnum);
>>>
>>> Same here.
>>>
>>
>> Actually, I believe that "%zd" will work. It's made to work with size_t
>> which is long long on 32 and long on 64.
>
> size_t is always 'long', not 'long long'. We have %pad for dma_addr_t
> which may be 'long' or 'long long', but it is configuration dependent
> which one it is on 32-bit.
>
> We could probably introduce a %pts format string for timespec64
> and have that pretty-printed.

dma_addr_t can be u64 or u32 based on architecture be it 32 bit or 64 bit.
But, timespec64 tv_sec is always s64. This is the opposite problem
from dma_addr_t that it is 64 bits regardless of architecture.
So, wouldn't it be easier to use long long cast for tv_sec and then
print tv_nsec as long?

-Deepa

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ