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: <98defebbdd3f0be69f76f5e6c3d7b72935f072a9.camel@linux.ibm.com>
Date:   Fri, 18 Aug 2023 10:32:46 +1000
From:   Andrew Donnellan <ajd@...ux.ibm.com>
To:     Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@...il.com>,
        masahiroy@...nel.org, bgray@...ux.ibm.com, n.schier@....de
Cc:     linux-kernel@...r.kernel.org, keescook@...omium.org
Subject: Re: [PATCH] [next] initramfs: Parse KBUILD_BUILD_TIMESTAMP as UTC
 date

On Sat, 2023-07-29 at 17:02 +1200, Paulo Miguel Almeida wrote:
> When KBUILD_BUILD_TIMESTAMP is specified, the date command will parse
> it to Unix Epoch time in UTC. However, the date command is
> timezone-aware so it will convert from the local timezone to UTC
> first
> which hits some of the sanity checks added on commit 5efb685bb3af1
> ("initramfs: Check negative timestamp to prevent broken cpio
> archive")
> 
> This creates an edge case for the UTC+<N> part of the world. For
> instance
> 
>  - In New Zealand (UTC+12:00):
>         $ date -d"1970-01-01" +%s
>         -43200
> 
>         $ make KBUILD_BUILD_TIMESTAMP=1970-01-01
>         make[1]: Entering directory '<snip>/linux/'
>           GEN     Makefile
>           DESCEND objtool
>           INSTALL libsubcmd_headers
>           CALL    ../scripts/checksyscalls.sh
>           GEN     usr/initramfs_data.cpio
>         ERROR: Timestamp out of range for cpio format
>         make[4]: *** [../usr/Makefile:76: usr/initramfs_data.cpio]
> Error 1
> 
>  - In Seattle, WA (UTC-07:00):
>         $ date -d"1970-01-01" +%s
>         32400
> 
>         $ make KBUILD_BUILD_TIMESTAMP=1970-01-01
>         <builds fine>
> 
> Parse KBUILD_BUILD_TIMESTAMP date string as UTC so no localtime
> conversion is done which fixes the edge case aforementioned.
> 
> Signed-off-by: Paulo Miguel Almeida
> <paulo.miguel.almeida.rodenas@...il.com>

This should also be documented in Documentation/kbuild/kbuild.rst,
including a note that you can still use local time if you include the
timezone specifier.

Thanks,
-- 
Andrew Donnellan    OzLabs, ADL Canberra
ajd@...ux.ibm.com   IBM Australia Limited

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ