mbox series

[SRU,N:azure,v2,0/1] Ubuntu 24.04 for Azure unable to run 32bit binaries (LP: #2071445)

Message ID 20240715150120.1301542-1-juerg.haefliger@canonical.com
Headers show
Series Ubuntu 24.04 for Azure unable to run 32bit binaries (LP: #2071445) | expand

Message

Juerg Haefliger July 15, 2024, 3:01 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/2071445

[Impact]

## Issue details

The configuration of the kernel in linux-image-6.8.0-1008-azure is incompatible with the way libc6:i386 is built.
This leads to the error "The futex facility returned an unexpected error code." and application crash when trying to execute many 32bit applications in x86-64 machines.

In very short the issue is the following:
This kernel image is compiled with CONFIG_COMPAT_32BIT_TIME=n, unlike the vanilla Ubuntu 24.04 kernel images.
But, the glibc / libc6:i386 distributed with Ubuntu24.04 is compiled needing the syscalls enabled with that option.
i.e. **This kernel configuration is just incompatible with the provided glibc**

In detail:
glibc when built for 32bit, if not told which kernel is built for, will decide if the time_t value fits or not in a 32bit time_t, and do either the 32 or 64bit syscall:
https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/futex-internal.c;h=0bb1dd51f66802521afd71b9246222ed0ea0d862;hb=refs/heads/release/2.39/master#l90
calls with no deadline fit in the 32bit version, but as the kernel does not provide this syscall, glibc will just get  a ENOSYS, and glibc will error out aborting the program
```
abort (abort.c:79)
__libc_message_impl.cold (libc_fatal.c:132)
__libc_fatal (libc_fatal.c:141)
futex_fatal_error (futex-internal.h:87)
__futex_abstimed_wait_common (futex-internal.c:119)
```
after printing "The futex facility returned an unexpected error code.\n":
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/nptl/futex-internal.h;h=0e87e92d15ab92f5069463719a494e97d9800431;hb=refs/heads/release/2.39/master#l87

## Expected behavior:

* No crashes for 32bit applications with this kernel
* This kernel image built with CONFIG_COMPAT_32BIT_TIME=y

## Aditional info:

For reference, this is the current vanilla Ubuntu 24.04 kernel for x86_64 and this config:
```
$ uname -a
Linux <redacted> 6.8.0-35-generic #35-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:51:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
$ grep CONFIG_COMPAT_32BIT_TIME /boot/config-$(uname -r)
CONFIG_COMPAT_32BIT_TIME=y
```

On the other hand this is the kernel config for this kernel image:
```
Linux <> 6.8.0-1008-azure #8-Ubuntu SMP Fri May 17 10:44:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
# CONFIG_COMPAT_32BIT_TIME is not set
```

Related github issue (the issue was found in github ubuntu 24.04 runners)
https://github.com/actions/runner-images/issues/9977

[Fix]

Reenable COMPAT_32BIT_TIME

[Test Case]

See above.

[Where Problems Could Occur]

Disabling COMPAT_32BIT_TIME in Noble azure introduced a regression when running x86 binaries, so the fix is not expected to break anything (new).

Juerg Haefliger (1):
  UBUNTU: [Config] azure: Revert "UBUNTU: [Config] azure: Disable
    CONFIG_COMPAT_32BIT_TIME"

 debian.azure/config/annotations | 3 ---
 1 file changed, 3 deletions(-)

Comments

Manuel Diewald July 15, 2024, 3:53 p.m. UTC | #1
On Mon, Jul 15, 2024 at 05:01:19PM +0200, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/2071445
> 
> [Impact]
> 
> ## Issue details
> 
> The configuration of the kernel in linux-image-6.8.0-1008-azure is incompatible with the way libc6:i386 is built.
> This leads to the error "The futex facility returned an unexpected error code." and application crash when trying to execute many 32bit applications in x86-64 machines.
> 
> In very short the issue is the following:
> This kernel image is compiled with CONFIG_COMPAT_32BIT_TIME=n, unlike the vanilla Ubuntu 24.04 kernel images.
> But, the glibc / libc6:i386 distributed with Ubuntu24.04 is compiled needing the syscalls enabled with that option.
> i.e. **This kernel configuration is just incompatible with the provided glibc**
> 
> In detail:
> glibc when built for 32bit, if not told which kernel is built for, will decide if the time_t value fits or not in a 32bit time_t, and do either the 32 or 64bit syscall:
> https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/futex-internal.c;h=0bb1dd51f66802521afd71b9246222ed0ea0d862;hb=refs/heads/release/2.39/master#l90
> calls with no deadline fit in the 32bit version, but as the kernel does not provide this syscall, glibc will just get  a ENOSYS, and glibc will error out aborting the program
> ```
> abort (abort.c:79)
> __libc_message_impl.cold (libc_fatal.c:132)
> __libc_fatal (libc_fatal.c:141)
> futex_fatal_error (futex-internal.h:87)
> __futex_abstimed_wait_common (futex-internal.c:119)
> ```
> after printing "The futex facility returned an unexpected error code.\n":
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/nptl/futex-internal.h;h=0e87e92d15ab92f5069463719a494e97d9800431;hb=refs/heads/release/2.39/master#l87
> 
> ## Expected behavior:
> 
> * No crashes for 32bit applications with this kernel
> * This kernel image built with CONFIG_COMPAT_32BIT_TIME=y
> 
> ## Aditional info:
> 
> For reference, this is the current vanilla Ubuntu 24.04 kernel for x86_64 and this config:
> ```
> $ uname -a
> Linux <redacted> 6.8.0-35-generic #35-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:51:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
> $ grep CONFIG_COMPAT_32BIT_TIME /boot/config-$(uname -r)
> CONFIG_COMPAT_32BIT_TIME=y
> ```
> 
> On the other hand this is the kernel config for this kernel image:
> ```
> Linux <> 6.8.0-1008-azure #8-Ubuntu SMP Fri May 17 10:44:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
> # CONFIG_COMPAT_32BIT_TIME is not set
> ```
> 
> Related github issue (the issue was found in github ubuntu 24.04 runners)
> https://github.com/actions/runner-images/issues/9977
> 
> [Fix]
> 
> Reenable COMPAT_32BIT_TIME
> 
> [Test Case]
> 
> See above.
> 
> [Where Problems Could Occur]
> 
> Disabling COMPAT_32BIT_TIME in Noble azure introduced a regression when running x86 binaries, so the fix is not expected to break anything (new).
> 
> Juerg Haefliger (1):
>   UBUNTU: [Config] azure: Revert "UBUNTU: [Config] azure: Disable
>     CONFIG_COMPAT_32BIT_TIME"
> 
>  debian.azure/config/annotations | 3 ---
>  1 file changed, 3 deletions(-)
> 
> -- 
> 2.40.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Acked-by: Manuel Diewald <manuel.diewald@canonical.com>
Agathe Porte July 15, 2024, 4:04 p.m. UTC | #2
2024-07-15 17:02 CEST, Juerg Haefliger:
> BugLink: https://bugs.launchpad.net/bugs/2071445
> 
> [Impact]
> 
> ## Issue details
> 
> The configuration of the kernel in linux-image-6.8.0-1008-azure is incompatible with the way libc6:i386 is built.
> This leads to the error "The futex facility returned an unexpected error code." and application crash when trying to execute many 32bit applications in x86-64 machines.
> 
> In very short the issue is the following:
> This kernel image is compiled with CONFIG_COMPAT_32BIT_TIME=n, unlike the vanilla Ubuntu 24.04 kernel images.
> But, the glibc / libc6:i386 distributed with Ubuntu24.04 is compiled needing the syscalls enabled with that option.
> i.e. **This kernel configuration is just incompatible with the provided glibc**
> 
> In detail:
> glibc when built for 32bit, if not told which kernel is built for, will decide if the time_t value fits or not in a 32bit time_t, and do either the 32 or 64bit syscall:
> https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/futex-internal.c;h=0bb1dd51f66802521afd71b9246222ed0ea0d862;hb=refs/heads/release/2.39/master#l90
> calls with no deadline fit in the 32bit version, but as the kernel does not provide this syscall, glibc will just get  a ENOSYS, and glibc will error out aborting the program
> ```
> abort (abort.c:79)
> __libc_message_impl.cold (libc_fatal.c:132)
> __libc_fatal (libc_fatal.c:141)
> futex_fatal_error (futex-internal.h:87)
> __futex_abstimed_wait_common (futex-internal.c:119)
> ```
> after printing "The futex facility returned an unexpected error code.\n":
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/nptl/futex-internal.h;h=0e87e92d15ab92f5069463719a494e97d9800431;hb=refs/heads/release/2.39/master#l87
> 
> ## Expected behavior:
> 
> * No crashes for 32bit applications with this kernel
> * This kernel image built with CONFIG_COMPAT_32BIT_TIME=y
> 
> ## Aditional info:
> 
> For reference, this is the current vanilla Ubuntu 24.04 kernel for x86_64 and this config:
> ```
> $ uname -a
> Linux <redacted> 6.8.0-35-generic #35-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:51:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
> $ grep CONFIG_COMPAT_32BIT_TIME /boot/config-$(uname -r)
> CONFIG_COMPAT_32BIT_TIME=y
> ```
> 
> On the other hand this is the kernel config for this kernel image:
> ```
> Linux <> 6.8.0-1008-azure #8-Ubuntu SMP Fri May 17 10:44:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
> # CONFIG_COMPAT_32BIT_TIME is not set
> ```
> 
> Related github issue (the issue was found in github ubuntu 24.04 runners)
> https://github.com/actions/runner-images/issues/9977
> 
> [Fix]
> 
> Reenable COMPAT_32BIT_TIME
> 
> [Test Case]
> 
> See above.
> 
> [Where Problems Could Occur]
> 
> Disabling COMPAT_32BIT_TIME in Noble azure introduced a regression when running x86 binaries, so the fix is not expected to break anything (new).
> 
> Juerg Haefliger (1):
>   UBUNTU: [Config] azure: Revert "UBUNTU: [Config] azure: Disable
>     CONFIG_COMPAT_32BIT_TIME"
> 
>  debian.azure/config/annotations | 3 ---
>  1 file changed, 3 deletions(-)

Acked-by: Agathe Porte <agathe.porte@canonical.com>
Paolo Pisati July 16, 2024, 6:15 a.m. UTC | #3
On Mon, Jul 15, 2024 at 05:01:19PM +0200, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/2071445

Acked-by: Paolo Pisati <paolo.pisati@canonical.com>
Andrei Gherzan July 22, 2024, 12:58 p.m. UTC | #4
On 24/07/15 05:01pm, Juerg Haefliger wrote:
> BugLink: https://bugs.launchpad.net/bugs/2071445
> 
> [Impact]
> 
> ## Issue details
> 
> The configuration of the kernel in linux-image-6.8.0-1008-azure is incompatible with the way libc6:i386 is built.
> This leads to the error "The futex facility returned an unexpected error code." and application crash when trying to execute many 32bit applications in x86-64 machines.
> 
> In very short the issue is the following:
> This kernel image is compiled with CONFIG_COMPAT_32BIT_TIME=n, unlike the vanilla Ubuntu 24.04 kernel images.
> But, the glibc / libc6:i386 distributed with Ubuntu24.04 is compiled needing the syscalls enabled with that option.
> i.e. **This kernel configuration is just incompatible with the provided glibc**
> 
> In detail:
> glibc when built for 32bit, if not told which kernel is built for, will decide if the time_t value fits or not in a 32bit time_t, and do either the 32 or 64bit syscall:
> https://sourceware.org/git/?p=glibc.git;a=blob;f=nptl/futex-internal.c;h=0bb1dd51f66802521afd71b9246222ed0ea0d862;hb=refs/heads/release/2.39/master#l90
> calls with no deadline fit in the 32bit version, but as the kernel does not provide this syscall, glibc will just get  a ENOSYS, and glibc will error out aborting the program
> ```
> abort (abort.c:79)
> __libc_message_impl.cold (libc_fatal.c:132)
> __libc_fatal (libc_fatal.c:141)
> futex_fatal_error (futex-internal.h:87)
> __futex_abstimed_wait_common (futex-internal.c:119)
> ```
> after printing "The futex facility returned an unexpected error code.\n":
> https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/nptl/futex-internal.h;h=0e87e92d15ab92f5069463719a494e97d9800431;hb=refs/heads/release/2.39/master#l87
> 
> ## Expected behavior:
> 
> * No crashes for 32bit applications with this kernel
> * This kernel image built with CONFIG_COMPAT_32BIT_TIME=y
> 
> ## Aditional info:
> 
> For reference, this is the current vanilla Ubuntu 24.04 kernel for x86_64 and this config:
> ```
> $ uname -a
> Linux <redacted> 6.8.0-35-generic #35-Ubuntu SMP PREEMPT_DYNAMIC Mon May 20 15:51:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
> $ grep CONFIG_COMPAT_32BIT_TIME /boot/config-$(uname -r)
> CONFIG_COMPAT_32BIT_TIME=y
> ```
> 
> On the other hand this is the kernel config for this kernel image:
> ```
> Linux <> 6.8.0-1008-azure #8-Ubuntu SMP Fri May 17 10:44:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
> # CONFIG_COMPAT_32BIT_TIME is not set
> ```
> 
> Related github issue (the issue was found in github ubuntu 24.04 runners)
> https://github.com/actions/runner-images/issues/9977
> 
> [Fix]
> 
> Reenable COMPAT_32BIT_TIME
> 
> [Test Case]
> 
> See above.
> 
> [Where Problems Could Occur]
> 
> Disabling COMPAT_32BIT_TIME in Noble azure introduced a regression when running x86 binaries, so the fix is not expected to break anything (new).
> 
> Juerg Haefliger (1):
>   UBUNTU: [Config] azure: Revert "UBUNTU: [Config] azure: Disable
>     CONFIG_COMPAT_32BIT_TIME"
> 
>  debian.azure/config/annotations | 3 ---
>  1 file changed, 3 deletions(-)
> 

Acked-by: Andrei Gherzan <andrei.gherzan@canonical.com>