• [Y2038] debian/armhf time64 build?

    From Dominique MARTINET@21:1/5 to All on Wed Sep 28 04:40:01 2022
    Hi,

    Arnd did a superb recap in 2020, let me just link to it first in case anyone needs a reminder:
    https://lists.debian.org/debian-arm/2020/02/msg00024.html

    tl;dr: glibc 2.34 added a -D_TIME_BITS=64 toggle, but afaiu we need to
    rebuild (virtually) everything to use it as that breaks the ABI for
    anything using time_t


    As far as I'm aware, there haven't been any new public discussion since
    that 2020 thread -- has there been any new attempt I missed?


    (As a side note, it look like some tools like coreutils will be dealing
    with it on their own, as they enabled the flag in gnulib themselves: https://www.mail-archive.com/bug-gnulib@gnu.org/msg41057.html
    (should be used from coreutils 9.0)

    That can however only work for end programs that do not have any
    dependency and cannot scale at distribution level...)



    I won't bring anything very useful to the table here: I'd be happy to
    give some limited time, but I won't have enough to do everything Arnd
    tried and more than the lack of time don't have any resources to
    actually do the work (e.g. disk space and cpu time)... And even if I
    could it's not clear to me what way forward we'd actually prefer at this
    point.

    My naive opinion is that having a flag day and dealing with fallouts
    might ultimately be the fastest way forward, but as there won't be any
    safety check to detect incompatibility I don't think anyone will be
    looking forward to the weird errors that will ensure for e.g. locally
    compiled programs and whatsnot.

    So that might be the first thing to think about again?
    (... and I wish I had any idea there, but nothing practical to
    suggest...)


    Thanks!
    --
    Dominique

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arnd Bergmann@21:1/5 to Dominique MARTINET on Wed Sep 28 08:40:01 2022
    On Wed, Sep 28, 2022, at 4:09 AM, Dominique MARTINET wrote:

    Arnd did a superb recap in 2020, let me just link to it first in case anyone needs a reminder:
    https://lists.debian.org/debian-arm/2020/02/msg00024.html

    (It was Steve who did the recap of the work that I had done)

    tl;dr: glibc 2.34 added a -D_TIME_BITS=64 toggle, but afaiu we need to rebuild (virtually) everything to use it as that breaks the ABI for
    anything using time_t


    As far as I'm aware, there haven't been any new public discussion since
    that 2020 thread -- has there been any new attempt I missed?

    I am not aware of anyone trying to do another bootstrap after me.

    From what I can tell, the main thing that has changed is that there
    is even less developer time that we can spend on armhf. With every
    year that passes, more workloads are moving from 32-bit userspace
    native 64 bit, so the number of people that is willing to help
    out is going down, though that does not necessarily make it less
    important to those that do care about 32 bit.

    Another thing that has changed is that /other/ 32-bit distros are
    getting dropped, notably Fedora 37 dropped 32-bit Armv7 support,
    and Arch Linux dropped support for any platform without NEON
    support. OpenWRT on the other hand just had their first release
    that is using 64-bit time_t on all musl-based targets, though
    not yet on i386+glibc.

    My naive opinion is that having a flag day and dealing with fallouts
    might ultimately be the fastest way forward, but as there won't be any
    safety check to detect incompatibility I don't think anyone will be
    looking forward to the weird errors that will ensure for e.g. locally compiled programs and whatsnot.

    So that might be the first thing to think about again?
    (... and I wish I had any idea there, but nothing practical to
    suggest...)

    I would agree that the idea of doing a soft migration that
    correctly tracks library dependencies and allows a safe dist-upgrade
    across the rebuild is pretty much dead because of the burden this
    would put on package maintainers, so it will have to be fresh
    time64 bootstrap.

    Last time, the discussion got stuck because that means introducing
    a new target name for dpkg, which then requires a new target triplet
    to allow a multiarch installation. This in turn requires additional
    work for porting packages that need to know about the new target
    triplet. I don't think we can solve this problem now, but should
    postpone the inevitable debate about this until someone has done
    the work of rebootstrapping a working armhf environment with the
    current names.

    I don't expect that I'll have time to do this myself, but I'm
    happy to help someone else figure out how to get to that point.

    Arnd

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dominique MARTINET@21:1/5 to Arnd Bergmann on Wed Sep 28 09:30:01 2022
    Arnd Bergmann wrote on Wed, Sep 28, 2022 at 08:21:00AM +0200:
    (It was Steve who did the recap of the work that I had done)

    (woops, sorry. Thank you both!)

    tl;dr: glibc 2.34 added a -D_TIME_BITS=64 toggle, but afaiu we need to rebuild (virtually) everything to use it as that breaks the ABI for anything using time_t


    As far as I'm aware, there haven't been any new public discussion since that 2020 thread -- has there been any new attempt I missed?

    I am not aware of anyone trying to do another bootstrap after me.

    From what I can tell, the main thing that has changed is that there
    is even less developer time that we can spend on armhf. With every
    year that passes, more workloads are moving from 32-bit userspace
    native 64 bit, so the number of people that is willing to help
    out is going down, though that does not necessarily make it less
    important to those that do care about 32 bit.

    Another thing that has changed is that /other/ 32-bit distros are
    getting dropped, notably Fedora 37 dropped 32-bit Armv7 support,
    and Arch Linux dropped support for any platform without NEON
    support. OpenWRT on the other hand just had their first release
    that is using 64-bit time_t on all musl-based targets, though
    not yet on i386+glibc.

    Yes, we also released our first aarch64 board earlier this year (end of
    2021 actually), but we still plan on using armv7 for a while longer so
    we cannot just ignore that... Unfortunately as a very small company I'm
    afraid the amount of help I can give is rather limited at this point.


    My naive opinion is that having a flag day and dealing with fallouts
    might ultimately be the fastest way forward, but as there won't be any safety check to detect incompatibility I don't think anyone will be
    looking forward to the weird errors that will ensure for e.g. locally compiled programs and whatsnot.

    So that might be the first thing to think about again?
    (... and I wish I had any idea there, but nothing practical to
    suggest...)

    I would agree that the idea of doing a soft migration that
    correctly tracks library dependencies and allows a safe dist-upgrade
    across the rebuild is pretty much dead because of the burden this
    would put on package maintainers, so it will have to be fresh
    time64 bootstrap.

    Last time, the discussion got stuck because that means introducing
    a new target name for dpkg, which then requires a new target triplet
    to allow a multiarch installation. This in turn requires additional
    work for porting packages that need to know about the new target
    triplet.

    Ugh, this is going to be a massive headache...
    Other distributions I've worked with (e.g. nixos) have a wrapper for gcc
    and clang that just enforce the flags they want the distro to be built
    with -- I don't think debian has anything like that, would that be
    easier to work with? My line of thinking is that there will only be a
    single place to fix instead of configure/cmake/meson and all hand-made
    build scripts that exist around here.

    Alternatively this would be delaying things even further to get a new
    glibc version, but have a glibc build option that just makes this the
    default and rebuild that debian repo with it?
    afaik that's what musl has done in commit 38143339646a ("switch all
    existing 32-bit archs to 64-bit time_t"): https://git.musl-libc.org/cgit/musl/commit/?id=38143339646a4ccce8afe298c34467767c899f51

    Ultimately (after year 2038), building without the option would be
    meaningless and there really should be a way to enable it by
    default. There will ALWAYS be build systems that ignore your new target
    and we would basically be breaking all of these....


    I really think this should/could probably be discussed first; there
    shouldn't be THAT many packages breaking once gcc/glibc/etc compile,
    but if we cannot reach an agreement on how to enforce this option there
    really is no point.
    (I didn't add libc-alpha to this mail, but happy to start over with them
    in the loop)

    I don't think we can solve this problem now, but should
    postpone the inevitable debate about this until someone has done
    the work of rebootstrapping a working armhf environment with the
    current names.

    I don't expect that I'll have time to do this myself, but I'm
    happy to help someone else figure out how to get to that point.

    I totally understand, thanks for all the work and the quick reply.

    (I'll report back if I can allocate some time to help consistently, but
    don't hold your breath on that)

    --
    Dominique

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arnd Bergmann@21:1/5 to Dominique MARTINET on Wed Sep 28 12:10:01 2022
    On Wed, Sep 28, 2022, at 9:07 AM, Dominique MARTINET wrote:
    Arnd Bergmann wrote on Wed, Sep 28, 2022 at 08:21:00AM +0200:

    Ugh, this is going to be a massive headache...
    Other distributions I've worked with (e.g. nixos) have a wrapper for gcc
    and clang that just enforce the flags they want the distro to be built
    with -- I don't think debian has anything like that, would that be
    easier to work with? My line of thinking is that there will only be a
    single place to fix instead of configure/cmake/meson and all hand-made
    build scripts that exist around here.

    Passing the flags to the C compiler is not the issue here, this can
    be done in the gcc and clang packages directly by defining the right
    set of macros (with the minor annoyance that glibc itself expects to
    be built without those flags, but that again can obviously be solved).

    Alternatively this would be delaying things even further to get a new
    glibc version, but have a glibc build option that just makes this the
    default and rebuild that debian repo with it?
    afaik that's what musl has done in commit 38143339646a ("switch all
    existing 32-bit archs to 64-bit time_t"): https://git.musl-libc.org/cgit/musl/commit/?id=38143339646a4ccce8afe298c34467767c899f51

    That is what I had proposed years ago when the glibc developers
    started their work, but this was rejected as they do not wan to
    change the default behavior for a given architecture, or make
    the ABI conditional based on a compile-time flag during
    compilation of the libc.

    Again, this is just an implementation detail for getting things
    running, the hard question that I want to postpone is what to do
    about having both types of armhf debian packages (time32 and
    time64) coexist on a single file system and instead focus on
    the actual bootstrapping to find all the packages that break
    just because of the time_t change.

    Arnd

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jeffrey Walton@21:1/5 to dominique.martinet@atmark-techno.co on Wed Sep 28 15:40:01 2022
    On Wed, Sep 28, 2022 at 3:24 AM Dominique MARTINET <dominique.martinet@atmark-techno.com> wrote:
    ...
    Ugh, this is going to be a massive headache...
    Other distributions I've worked with (e.g. nixos) have a wrapper for gcc
    and clang that just enforce the flags they want the distro to be built
    with -- I don't think debian has anything like that, would that be
    easier to work with? My line of thinking is that there will only be a
    single place to fix instead of configure/cmake/meson and all hand-made
    build scripts that exist around here.

    Debian has dpkg-buildflags . Discussions about it show up when
    discussing hardening, like [0].

    [0] https://wiki.debian.org/Hardening#dpkg-buildflags

    Jeff

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wookey@21:1/5 to Dominique MARTINET on Thu Sep 29 02:10:01 2022
    On 2022-09-28 11:09 +0900, Dominique MARTINET wrote:

    As far as I'm aware, there haven't been any new public discussion since
    that 2020 thread

    I mentioned it in the 'arm status' talk at debconf this year.

    -- has there been any new attempt I missed?

    I have been planning for a while to have a go at a bootstrap but have
    not actually done anything yet. It is rising up my list as 'most
    important task' (currently after 'fixing porterbox abel').

    I won't bring anything very useful to the table here: I'd be happy to
    give some limited time,

    I'm glad to hear that there is some interest from others.

    My naive opinion is that having a flag day and dealing with fallouts
    might ultimately be the fastest way forward, but as there won't be any
    safety check to detect incompatibility I don't think anyone will be
    looking forward to the weird errors that will ensure for e.g. locally compiled programs and whatsnot.

    We don't have a mechanism for a flag day SFAIK. We can't suddenly
    re-upload every package in the armhf archive. And people would still
    download new 64bit time_t packages into their existing armhf
    installations and (presumably) have everything break. It's a new ABI -
    we have to assume the breakage would be pretty bad.

    It would be nice to do it within the armhf archive but although we
    have mechanisms for core library transitions (like we did for libc5 to
    6) a) this affects all arches so is a lot of churn for an issue only
    affecting one arch (or maybe all 32-bit arches, but I'm not sure how
    many of those other than arm (v7) will be around much longer?

    Given the nature of this change I'm not even sure this would work if
    we were up for the work, and I don't think we collectively are.

    So that might be the first thing to think about again?

    A new debian arm ABI arch is definitely the easiest way to do this, as
    Arndt says. Having thought about it a bit, I suggest we just call
    it 'arm32' as in the future it will be useful to distinguish legacy
    32-bit arm from arm64 (and maybe armv9 or whatever variants come in the future). And having just 'arm32' and 'arm64' arches will be quite
    pleasing for however long it lasts.

    Obviously bikeshedding about the name and triplet is the least important part of this.

    Andt Bergman wrote:

    Last time, the discussion got stuck because that means introducing a
    new target name for dpkg, which then requires a new target triplet
    to allow a multiarch installation. This in turn requires additional
    work for porting packages that need to know about the new target
    triplet. I don't think we can solve this problem now, but should
    postpone the inevitable debate about this until someone has done the
    work of rebootstrapping a working armhf environment with the current
    names.

    Agreed. And this was my plan. Just so we can check that stuff
    basically works before patching toolchain builds. Given that arch have
    it working it should be (?) as simple as setting some flags and
    doing a rebuild (and fixing whatever breaks).

    Wookey
    --
    Principal hats: Debian, Wookware, ARM
    http://wookware.org/

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEER4nvI8Pe/wVWh5yq+4YyUahvnkcFAmM04UYACgkQ+4YyUahv nkfEyBAAlCsAf9Cn7g4BrD+T4RBzUp3BJc4h35rZp2YqGf5l7B4FtqBUgIrOxcyW +zb++aHzFcplYHSDFIkkTC0Rx5h4Cn5bulwvm0eKkDL6fSQu44P0qESWiHPzN5lr D6iYYn9tose6ixA4omExMnGOrvfCzLe7WPovhz86E7BfiEl3xn41UOjvPrbuIxpq 9HrbnjPIcwwUnscydmYNuhfra9DEG0AlU7+NpG1AxITsWkikTgCvtazkc2a9+OY0 LEcTZJdOowsFpNOEFkweUkJEk/enVeGqGk8YrmdxlXyrLr7ufvOVvoDepGRSFwzj FwAElPWV5OsHdW9tAGR7YDtA7DEFbuWaJt1YcRfX3Kw/22JzfUy+ptQZkP9UQRh1 kCX1J8KSC7GeR1zxMfc1pkNoRqchro4jvBBGMtBQin0kJli45wjuaaay4n/SWTm4 DqGal0tlQaZ4eOittmJEPKUQx3b5ovY99wmiJqonMCVrEpzqN5oi8fKq3347Sg7n JWaPHiKZs4pINNnmXsmfJ8CRWcHDd22mbcynk56EjMbjXo/gexaN8J6CAZqj4wwe iZ0+fVp0E/NKfn4wNYzcTyE+G1GkjT3QSY9Epby+vUWxX1qppr9+TQF0gd6qm78S dLHXjSjXghqLBUVO4ehUwlYSPwQf0ldMXv0o33NpRpKM1LuIlOA=
    =JANX
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wookey@21:1/5 to Jeffrey Walton on Thu Sep 29 02:20:01 2022
    On 2022-09-28 09:32 -0400, Jeffrey Walton wrote:
    On Wed, Sep 28, 2022 at 3:24 AM Dominique MARTINET <dominique.martinet@atmark-techno.com> wrote:
    ...
    Ugh, this is going to be a massive headache...
    Other distributions I've worked with (e.g. nixos) have a wrapper for gcc and clang that just enforce the flags they want the distro to be built
    with -- I don't think debian has anything like that, would that be
    easier to work with? My line of thinking is that there will only be a single place to fix instead of configure/cmake/meson and all hand-made build scripts that exist around here.

    Debian has dpkg-buildflags . Discussions about it show up when
    discussing hardening, like [0].

    [0] https://wiki.debian.org/Hardening#dpkg-buildflags

    Right, and just changing it and rebuilding works very well. I did this
    for PAC (pointer authentication) support last year. Very few packages
    do not correctly honour dpkg-buildflags.

    In fact the only issue was that I unconditionally changed it so it got
    issued by some packages (like migw) for the wrong-arch compiler
    (because they were cross-building). One should be a bit smarter to unconditionally set an _arch-specific_ flag.

    dpkg-buildflags has functionality for this. See patch at bottom of: https://lists.debian.org/debian-dpkg/2022/05/msg00022.html

    Presumably the 'use 64-bit time_t' flag is the same for all arches,
    but may only exist on 32-bit arches?

    Wookey
    --
    Principal hats: Debian, Wookware, ARM
    http://wookware.org/

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEER4nvI8Pe/wVWh5yq+4YyUahvnkcFAmM041IACgkQ+4YyUahv nkcL9RAAnIptIz498Chk9NnylLoYLACcISFN2/eKJJLkm3Ebxn2S2oCeTOtw2Bre d4NnCZPd2Q+M/Bh3bvo3ow2a5jhgnJruoCZw3KbDzIm7BQF0t4iBdD/eZ2rUXa4U UOTxeOYlH4Lj/mLtP+92vPBfMihwWK4rJ2ejdBs9Nv4JFM7jLK0vFmiwvveWm9ta bW3jQ/nSAqzu6S6EujZx3dO5AHgOfUo/QGP5k9ji/7wsCw7wVu0VQ9EmUpE3R8eE v7DRtFMAtaLuf7QbW9ZfGX5D51PKBAB0oVJwCDuGnYfXw2I/B30OAe1CIIlNP/fG t5keweUGev1YqBqHuS24FjjZHzdAvHPAKSKRAnfHWwfnFqpmbMwdonuXOcGWDUL8 kpDaZEhZunE6Bj5rLdWbtO/jDlXQ5ud3VtBGvNsPew7uS2LbemBJHWGuVTjJFQan won6tbdJvwBYNv+5enXGwAIRLHJA4LlnL8sHy6rcLuu3HppaMZzflZ1gMl2etSqr WcY9bqWvfXBnX/R86LXnuQ8Uezbbeja8J4BtWd0tfFmsnou3P52wwtKh2kbfIgti Z8qvgg7m3rS5wiiQrqhaLoUe0c064jOvcPhzbp/1JVwWJ1XIYV0gJdm/obkxB1AB jtA6IOvH+HsvuoqhhCZJOXQLPLh0zXyMhmMEcI4jjW+apzqXDGw=
    =hbxi
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arnd Bergmann@21:1/5 to Wookey on Thu Sep 29 09:50:01 2022
    On Thu, Sep 29, 2022, at 2:14 AM, Wookey wrote:
    On 2022-09-28 09:32 -0400, Jeffrey Walton wrote:
    On Wed, Sep 28, 2022 at 3:24 AM Dominique MARTINET
    <dominique.martinet@atmark-techno.com> wrote:
    ...
    Ugh, this is going to be a massive headache...
    Other distributions I've worked with (e.g. nixos) have a wrapper for gcc >> > and clang that just enforce the flags they want the distro to be built
    with -- I don't think debian has anything like that, would that be
    easier to work with? My line of thinking is that there will only be a
    single place to fix instead of configure/cmake/meson and all hand-made
    build scripts that exist around here.

    Debian has dpkg-buildflags . Discussions about it show up when
    discussing hardening, like [0].

    [0] https://wiki.debian.org/Hardening#dpkg-buildflags

    Right, and just changing it and rebuilding works very well. I did this
    for PAC (pointer authentication) support last year. Very few packages
    do not correctly honour dpkg-buildflags.

    In fact the only issue was that I unconditionally changed it so it got
    issued by some packages (like migw) for the wrong-arch compiler
    (because they were cross-building). One should be a bit smarter to unconditionally set an _arch-specific_ flag.

    I think the problem with using dpkg-buildflags is that it breaks
    any user building their own applications against Debian provided
    libraries, unless they remember to set the flag manually.

    dpkg-buildflags has functionality for this. See patch at bottom of: https://lists.debian.org/debian-dpkg/2022/05/msg00022.html

    Presumably the 'use 64-bit time_t' flag is the same for all arches,
    but may only exist on 32-bit arches?

    Yes. The flag is -D_TIME_BITS=64, and this can be set unconditionally everywhere if that helps. Note that this implies -D_FILE_OFFSET_BITS=64,
    i.e. you can't have 64-bit time_t without 64-bit off_t/ino_t/...

    As far as I understand, there are still a few libraries in Debian
    that are built with 32-bit off_t in order to not break the traditional
    ABI, and that is fine because off_t is rarely used in non-libc
    header files, and a lot of applications don't actually need to
    understand large file sizes (e.g. when they call 'fstat()' to
    get the file timestamp but not the size, or when they operate
    on files that are otherwise limited to less than 4GB).

    So with time64, there will be an ABI change both for the few
    libraries that are currently using 32-bit off_t in addition to
    those that use time_t/timeval/timespec, and the original problem
    with off_t is amplified because there are many more libraries
    that have ABIs based around time_t.

    This is also going to be hard for non-C languages with C bindings
    (python, rust, ...) that have structure types hardcoded.

    Arnd

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arnd Bergmann@21:1/5 to Wookey on Thu Sep 29 10:20:01 2022
    On Thu, Sep 29, 2022, at 2:05 AM, Wookey wrote:
    On 2022-09-28 11:09 +0900, Dominique MARTINET wrote:

    As far as I'm aware, there haven't been any new public discussion since
    that 2020 thread

    I mentioned it in the 'arm status' talk at debconf this year.

    -- has there been any new attempt I missed?

    I have been planning for a while to have a go at a bootstrap but have
    not actually done anything yet. It is rising up my list as 'most
    important task' (currently after 'fixing porterbox abel').

    Ah nice! Once you actually get to it, feel free to contact me
    in private if you would like me to walk you through what I did
    last time, and what problems I had.

    It would be nice to do it within the armhf archive but although we
    have mechanisms for core library transitions (like we did for libc5 to
    6) a) this affects all arches so is a lot of churn for an issue only affecting one arch (or maybe all 32-bit arches, but I'm not sure how
    many of those other than arm (v7) will be around much longer?

    Right, I think it's fairly safe to assume that the other three (i386,
    mipsel and armel) will be discontinued well before armhf, and early
    enough that they are not affected too badly by the y2038 overflow.

    There is a chance that there is a use case for having a minimal
    i386-y2038 target for the purpose of running proprietary 32-bit
    software (i.e. windows games using wine), but that can come later.

    So that might be the first thing to think about again?

    A new debian arm ABI arch is definitely the easiest way to do this, as
    Arndt says. Having thought about it a bit, I suggest we just call
    it 'arm32' as in the future it will be useful to distinguish legacy
    32-bit arm from arm64 (and maybe armv9 or whatever variants come in the future). And having just 'arm32' and 'arm64' arches will be quite
    pleasing for however long it lasts.

    Obviously bikeshedding about the name and triplet is the least
    important part of this.

    +1

    Andt Bergman wrote:

    Last time, the discussion got stuck because that means introducing a
    new target name for dpkg, which then requires a new target triplet
    to allow a multiarch installation. This in turn requires additional
    work for porting packages that need to know about the new target
    triplet. I don't think we can solve this problem now, but should
    postpone the inevitable debate about this until someone has done the
    work of rebootstrapping a working armhf environment with the current
    names.

    Agreed. And this was my plan. Just so we can check that stuff
    basically works before patching toolchain builds. Given that arch have
    it working it should be (?) as simple as setting some flags and
    doing a rebuild (and fixing whatever breaks).

    I was not aware of Arch linux using a time64 build. The main ones
    I know are Alpine Linux, Adelie Linux and OpenWRT, but those all
    use musl-1.2, not glibc, and they have a much smaller set of packages. https://wiki.musl-libc.org/projects-using-musl.html lists a few
    other distros that I'm not familiar with.

    Arnd

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wookey@21:1/5 to Arnd Bergmann on Thu Sep 29 12:00:02 2022
    On 2022-09-29 09:47 +0200, Arnd Bergmann wrote:
    On Thu, Sep 29, 2022, at 2:14 AM, Wookey wrote:

    I think the problem with using dpkg-buildflags is that it breaks
    any user building their own applications against Debian provided
    libraries, unless they remember to set the flag manually.

    Yes, but I'm talking about how to do a test rebuild. We set the
    dpkg-buildflags config to always use -D_TIME_BITS=64 in the build
    chroot, and build stuff.

    For the actual new arch we woud set this as a gcc default for the
    architecture as it's a significant part of the ABI. (and someone would
    have to run gcc with -D_TIME_BITS=32 to explicitly build something for
    the old abi (or use the <armhf-triplet> gcc).

    The flag is -D_TIME_BITS=64, and this can be set unconditionally
    everywhere if that helps. Note that this implies -D_FILE_OFFSET_BITS=64,
    i.e. you can't have 64-bit time_t without 64-bit off_t/ino_t/...

    As far as I understand, there are still a few libraries in Debian
    that are built with 32-bit off_t in order to not break the traditional
    ABI,

    So with time64, there will be an ABI change both for the few
    libraries that are currently using 32-bit off_t in addition to
    those that use time_t/timeval/timespec

    This is also going to be hard for non-C languages with C bindings
    (python, rust, ...) that have structure types hardcoded.

    Hmm. Yes that could be interesting.

    Are you aware of anyone else having written up efforts around this
    (e.g. if the arch people have changed it already they presumably found
    a load of the things one might trip over).

    Wookey
    --
    Principal hats: Debian, Wookware, ARM
    http://wookware.org/

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEER4nvI8Pe/wVWh5yq+4YyUahvnkcFAmM1aiIACgkQ+4YyUahv nkdZqw//amIlmcsQfaI2wEquuISxwUYDZFW9qKHFfh2/LxSUJONz/KkIZqrBuK8O 4qbC2aEM467toXqtB62108yeWTkaJDTM+GYNN5o+qszLS57hUa05Q2Wq/uuUVZZj veeJ8MELCCglGvsVv9YaKuo2c4qaLP09D+vTy61I2gjkejkzUBFNoXPqldj3JD1K uwkzfOm0BphPSdzhAwN1CAeOjxjgbsdhbQgbESfV7Et757yqlFuQjL6g+Qkf+OLn hvU9/TG9Hata9ctqukJscyIP8Iy49DX8if4iW1/rNKCAvY4Z2sm/lntpUQvZdj1C KRmT8KoxmaawgCLnWVM8Iecxu8Am72qwjE9Ks+dWDoK4yPFpLbMLnYWit5SufLtr PViIInGG/rYbBWok6JynVx1Wg6IqCuk3tz++6m1R4XOYPq5bMzoXE8ATNARbYPF+ 3f8f7+dIL7zCXS/HjH1r/dODF0ggV8B0d32EgraJ07qz+Gvp2qrRjj0PLaqdwJM5 IUiJB73HexY54Rr7ryjPXaciDkPohaBwYZPf60NM9wnMb4A9qmvJd+zVV1oZFQ9Q YzXDs6umCCsn+nlOQgulrYygIP9axdwkEcSgSsJWwPqfXplIPawL+YUmdC8pw4un /cLn+LjXumy6y4D6GYjn3NfIHqE1vVOZl3+C37CiSrDCTLdAvOw=
    =cFGC
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wookey@21:1/5 to Arnd Bergmann on Thu Sep 29 12:40:01 2022
    On 2022-09-29 12:24 +0200, Arnd Bergmann wrote:
    On Thu, Sep 29, 2022, at 11:49 AM, Wookey wrote:
    On 2022-09-29 09:47 +0200, Arnd Bergmann wrote:

    I think the problem with using dpkg-buildflags is that it breaks
    any user building their own applications against Debian provided
    libraries, unless they remember to set the flag manually.

    Yes, but I'm talking about how to do a test rebuild. We set the dpkg-buildflags config to always use -D_TIME_BITS=64 in the build
    chroot, and build stuff.

    Right, that should work. In my 2020 experiment I did the opposite
    and actually patched glibc to remove the time32 interfaces so
    I could be really sure that everything would use the time64
    path, but clearly at least the core packages all use the
    buildflags correctly.

    That is more reliable. We will keep the build logs so can check those
    with just grep, or more smartly with a modified blhc, for anything
    that did not in fact get the flag set. If it proves to be a problem
    then a patched glibc is obviously a sensible approach.

    Are you aware of anyone else having written up efforts around this
    (e.g. if the arch people have changed it already they presumably found
    a load of the things one might trip over).

    Adelie Linux has (had?) a great summary. I can't reach the wiki page
    at the moment, but I found an archive copy at

    https://web.archive.org/web/20220301175235/https://wiki.adelielinux.org/wiki/Project:Time64

    Cheers.

    Wookey
    --
    Principal hats: Debian, Wookware, ARM
    http://wookware.org/

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEER4nvI8Pe/wVWh5yq+4YyUahvnkcFAmM1dYsACgkQ+4YyUahv nkfkGg/6AnjwlGa49wldFdFPp9oypq6baGAc6jU+GKZO946bfsn7D3Y5PUqxf26t eNR7I9FOpjbpqN0JrJzKwgfd1O8uTnfG3oRPZsoOcKEqGk5NC+wJl1R74kqDmBtD 216+bZz78fdOG64D4oq8mhCrYjcYmCqm3ylQCvExCjIbf1zlou2CHZyMPtKsmwCa aKHv3XrLWL6bBuYbdJW/s5yn3IDLZTp10jJ1z/3J3E2otO3oGr5cUtSCCogF3u98 7CLWECd211E8pNu4Cfo2JRQ5PCiiTqVlxlaBZn8C3VTBmH3TC1gNwVmHaPvGsz7z DRxXaKf/El2lSHooyIkxsYQKceyIZ1scNPq/Q/IEyS0JHdKOVLCVafZUle/l/axk PfYiMlty+l+0BxY2al7ZtUrcdaiXsYC6g4lEmSwB2TZgJ1YmI4FXU+6m51oTIjIo NK8/QyruujqCredLv7tMiSBcShm5wD6VnJai/AVya/z6PadpTu6S6vtTK+podLBX 7uIJb7vbng5CHjP8RK6VsXAeIz8xAcdzkMxm+u4PcabqkKj6jfsiWZV9utvEjff4 0anSn7Bfi0JSASrIPe90YwrhJQ+WDPW5ggRKGJfsJmTX9Vhd4HS9CD3RCc9M0gX6 GDNTLlv2GIl+CaY6eUF/C+dqkFe8Bf4bj4Y7KtTz3dAQd+EUaGY=
    =tbDy
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arnd Bergmann@21:1/5 to Wookey on Thu Sep 29 12:30:01 2022
    On Thu, Sep 29, 2022, at 11:49 AM, Wookey wrote:
    On 2022-09-29 09:47 +0200, Arnd Bergmann wrote:
    On Thu, Sep 29, 2022, at 2:14 AM, Wookey wrote:

    I think the problem with using dpkg-buildflags is that it breaks
    any user building their own applications against Debian provided
    libraries, unless they remember to set the flag manually.

    Yes, but I'm talking about how to do a test rebuild. We set the dpkg-buildflags config to always use -D_TIME_BITS=64 in the build
    chroot, and build stuff.

    Right, that should work. In my 2020 experiment I did the opposite
    and actually patched glibc to remove the time32 interfaces so
    I could be really sure that everything would use the time64
    path, but clearly at least the core packages all use the
    buildflags correctly.

    Hmm. Yes that could be interesting.

    Are you aware of anyone else having written up efforts around this
    (e.g. if the arch people have changed it already they presumably found
    a load of the things one might trip over).

    Adelie Linux has (had?) a great summary. I can't reach the wiki page
    at the moment, but I found an archive copy at

    https://web.archive.org/web/20220301175235/https://wiki.adelielinux.org/wiki/Project:Time64

    Arnd

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adrian Bunk@21:1/5 to Wookey on Sun Oct 2 14:20:01 2022
    On Thu, Sep 29, 2022 at 10:53:21AM +0100, Wookey wrote:
    On 2022-09-29 10:10 +0200, Arnd Bergmann wrote:
    ...
    I know are Alpine Linux, Adelie Linux and OpenWRT, but those all
    use musl-1.2, not glibc, and they have a much smaller set of packages.

    OK. We still have plenty of bugs to find then :-)

    Such bugs have already been found, reported and fixed in Debian for
    10 years thanks to the x32 port (e.g. #700012).

    More than 13k packages are currently Installed on x32 after having been natively built and (if they have) passing their build time tests.

    Wookey

    cu
    Adrian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Arnd Bergmann@21:1/5 to Adrian Bunk on Sun Oct 2 16:40:01 2022
    On Sun, Oct 2, 2022, at 1:59 PM, Adrian Bunk wrote:
    On Thu, Sep 29, 2022 at 10:53:21AM +0100, Wookey wrote:
    On 2022-09-29 10:10 +0200, Arnd Bergmann wrote:
    ...
    I know are Alpine Linux, Adelie Linux and OpenWRT, but those all
    use musl-1.2, not glibc, and they have a much smaller set of packages.

    OK. We still have plenty of bugs to find then :-)

    Such bugs have already been found, reported and fixed in Debian for
    10 years thanks to the x32 port (e.g. #700012).

    More than 13k packages are currently Installed on x32 after having been natively built and (if they have) passing their build time tests.

    There is a minimal user base on x32, so I'm sure a lot of bugs
    have gone unnoticed. Having 64-bit time_t on BSD and Windows
    probably did more to find bugs, but there are still lots of
    issues where neither of this would help. For instance:

    - Any applications that use direct system calls with a 32-bit
    time_t have to change to the correct replacement syscall.
    This never had to be done on x32, because there is only one
    such set of syscalls. A number of upstream packages already
    got fixed for riscv32, but unfortunately some of those were
    done in a way that is still broken for architectures that
    have both the time32 and time64 versions.
    Most commonly, this affects __NR_futex/SYS_futex, but there
    are other syscalls needed elsewhere

    - Libraries using input_event structures on /dev/input/*
    need to have an updated copy of the kernel headers. Most
    upstream packages do now, but I'm sure there are some left.

    - Packages that rely on seccomp have to be updated to
    allow both the old and new versions of system calls in their
    whitelists

    - Anything that is written in a language other than C but
    links to C libraries needs to be updated to use the new
    data structure definitions. Some of these may have a special
    case for x32, or they are just wrong. There are a lot of
    python or rust libraries affected by this, and no obvious
    answer.

    - Things that are written in a language other than C/C++
    but don't link to C libraries should keep working, but
    will not be y2038 safe unless they also migrate to the
    time64 interfaces by copying what glibc did.

    - Any package that currently relies on having a 32-bit
    off_t/ino_t will break after being forced to update to
    the 64-bit version, even if they don't care about
    time_t.

    - Packages may hardcode the time_t/timeval/timespec
    definition. If they use __kernel_long_t, they would
    even work on x32, but break on any other 32-bit ABI.

    Arnd

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Adrian Bunk@21:1/5 to Arnd Bergmann on Sun Oct 2 18:40:01 2022
    On Sun, Oct 02, 2022 at 04:23:35PM +0200, Arnd Bergmann wrote:
    On Sun, Oct 2, 2022, at 1:59 PM, Adrian Bunk wrote:
    On Thu, Sep 29, 2022 at 10:53:21AM +0100, Wookey wrote:
    On 2022-09-29 10:10 +0200, Arnd Bergmann wrote:
    ...
    I know are Alpine Linux, Adelie Linux and OpenWRT, but those all
    use musl-1.2, not glibc, and they have a much smaller set of packages. >>
    OK. We still have plenty of bugs to find then :-)

    Such bugs have already been found, reported and fixed in Debian for
    10 years thanks to the x32 port (e.g. #700012).

    More than 13k packages are currently Installed on x32 after having been natively built and (if they have) passing their build time tests.

    There is a minimal user base on x32, so I'm sure a lot of bugs
    have gone unnoticed. Having 64-bit time_t on BSD and Windows
    probably did more to find bugs, but there are still lots of
    issues where neither of this would help. For instance:
    ...

    I am not denying that there will be bugs to be sorted out,
    but with x32 (and likely soon arc) in ports many of the issues
    have already been sorted out and there are also build logs that
    could be searched for time_t gcc warnings in successful builds.

    - Things that are written in a language other than C/C++
    but don't link to C libraries should keep working,

    Being written in C and linking to C libraries is not sufficient, we have several other C libraries.

    E.g. dietlibc: https://sources.debian.org/src/dietlibc/0.34~cvs20160606-14/include/sys/types.h/#L106-L110

    but
    will not be y2038 safe unless they also migrate to the
    time64 interfaces by copying what glibc did.
    ...

    Yes, code breaking on 19 January 2038 on the fixed architectures should
    be a big worry.

    The other breakages you describe are things that would break immediately.
    Most would be found during the years before the new port would be part
    of a Debian release, and users would encounter remaining ones when
    switching to the new architecture at a time that is convenient for them (ideally first in a test environment).

    Running test builds (as reproducible builds is already doing) and
    autopkgtests with time set in the future might catch bugs that are
    covered by tests, but would still miss many.

    On Wed, Sep 28, 2022 at 08:21:00AM +0200, Arnd Bergmann wrote:
    ...
    Last time, the discussion got stuck because that means introducing
    a new target name for dpkg, which then requires a new target triplet
    to allow a multiarch installation. This in turn requires additional
    work for porting packages that need to know about the new target
    triplet. I don't think we can solve this problem now, but should
    postpone the inevitable debate about this until someone has done
    the work of rebootstrapping a working armhf environment with the
    current names.
    ...

    IMHO there is little point in spending work anywhere on this unless
    there is a commitment and schedule for the whole big amount of work
    of setting up the new port.

    The port would need all of:
    - finding bugs
    - fixing bugs
    - adding the new architecture to debian/ in ~ 1k packages

    And all this with a schedule to have it in a releasable state by the end
    of 2024 or 2026 if it would start today.

    Without such a schedule, other distributions will be faster then Debian
    at switching to 64bit time_t, already resolving many of the issues you
    are planning to find with the rebootstrap.

    Having the new port in a releasable state in 2032, with a Debian release
    with both old and new port in mid-2033, might be the last possible
    schedule for Debian.

    cu
    Adrian

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Wookey@21:1/5 to Arnd Bergmann on Wed Feb 1 06:20:01 2023
    On 2022-10-02 16:23 +0200, Arnd Bergmann wrote:
    On Sun, Oct 2, 2022, at 1:59 PM, Adrian Bunk wrote:

    More than 13k packages are currently Installed on x32 after having been natively built and (if they have) passing their build time tests.

    There is a minimal user base on x32, so I'm sure a lot of bugs
    have gone unnoticed. Having 64-bit time_t on BSD and Windows
    probably did more to find bugs, but there are still lots of
    issues where neither of this would help. For instance:

    OK, rather later than planned, I have done a bootstrap of the bottom
    154 debian packages (as of Jan 17th) i.e the set you get from here: http://snapshot.debian.org/archive/debian/20230117T215416Z/
    (thanks to Helmut for the marvellous rebootstap making this mostly painless)

    for
    'armhf': standard armhf,
    'lfs' : armhf+ DEB_BUILD_OPTIONS=future+lfs
    'tt' : armhf+ -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 DEB_BUILD_OPTIONS=future+lfs

    I'm trying to dump some ABI differences to see what _actually_ changes,
    but I've also just been randomly installing random tt packages in an
    armhf chroot to see what broke.

    'nothing obvious' is my initial impression so far, so I'd welcome any suggestions for things which are easy to test that we might expect to
    break. (e.g translating the things below into commands I could type to check?)

    Suggestions for things further up the package stack will also be useful for the future.

    The packages for lfs and tt are in these repos: http://wookware.org/software/timet/

    It's entirely possible that build flags have been ignored in places
    and some of these packages are not actually as advertised/intended -
    I'm still checking that.


    - Any applications that use direct system calls with a 32-bit
    time_t have to change to the correct replacement syscall.
    This never had to be done on x32, because there is only one
    such set of syscalls. A number of upstream packages already
    got fixed for riscv32, but unfortunately some of those were
    done in a way that is still broken for architectures that
    have both the time32 and time64 versions.
    Most commonly, this affects __NR_futex/SYS_futex, but there
    are other syscalls needed elsewhere

    - Libraries using input_event structures on /dev/input/*
    need to have an updated copy of the kernel headers. Most
    upstream packages do now, but I'm sure there are some left.

    - Packages that rely on seccomp have to be updated to
    allow both the old and new versions of system calls in their
    whitelists

    - Anything that is written in a language other than C but
    links to C libraries needs to be updated to use the new
    data structure definitions. Some of these may have a special
    case for x32, or they are just wrong. There are a lot of
    python or rust libraries affected by this, and no obvious
    answer.

    - Things that are written in a language other than C/C++
    but don't link to C libraries should keep working, but
    will not be y2038 safe unless they also migrate to the
    time64 interfaces by copying what glibc did.

    - Any package that currently relies on having a 32-bit
    off_t/ino_t will break after being forced to update to
    the 64-bit version, even if they don't care about
    time_t.

    - Packages may hardcode the time_t/timeval/timespec
    definition. If they use __kernel_long_t, they would
    even work on x32, but break on any other 32-bit ABI.

    Arnd

    Wookey
    --
    Principal hats: Debian, Wookware, ARM
    http://wookware.org/

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCgAdFiEER4nvI8Pe/wVWh5yq+4YyUahvnkcFAmPZ9B8ACgkQ+4YyUahv nkcwnQ//XET6GGCoWNxXEnY5t+nPQj5hpZ5OwjckOSxgHGBW4k+AyYyQFmqWMVC4 kX8BuwgoCU9oURVIQjIDnSTQZNXyDw9CTfrCrian1Q3adEC6nyONHeW59cynnB1f Syud98M72znCiqLIv2bQSwV/6JwJphfmmCJwvoODTA8ps6gjkhAxNT4/hW8C1xpr zYZdNxDEQR1wqrVzGnj9crLyTyszDXtzpBRXtmka+xfD7GTYXWEX7Cr0BSrb2X9x FCOuCWQsLyZPpDk7gvz0fthlwd4dyXmgW+4oiYUJ0AQ6fqwp3QJOXV0y+hYvFwg0 AbTslVcGbn6Yk9IELApSnwPO0kdFbzIgr4awy998Wq3TphX0YFddUM6IVTgT9uy3 WcULkohjfv7I/WKWW2U5E0XmujihASWgmZU7PRtDcfqg6+A4hZtt+ex5ROKZlUtH UoCsMd8JLHod/h77Kk/ZBKQesVgv0Wye+Bj6MApwWBXOQXNgn/7sQqJ7OdA3MEmS hs6Wj8+LSsrVWqXVFpJACsNmK+J02aoVuSnCDZ2V1ulVgUPqgC5ZKUd5lfM4Ezr2 gpzHXECGdCA4kIOjb+p9B0Nlk8ltN8kkWWL0V/H5Osgeke5BmVnEf7DnwhLXiZnX nWZ2vySZ1IYu4EOY9jMth5yaKZvLe4gEjCZ8MrJ2px69c5Wmzqg=
    =Od3Y
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)