WSL2-Linux-Kernel/tools/include
Willy Tarreau 9899cea591 tools/nolibc: fix incorrect truncation of exit code
commit de0244ae40 upstream.

Ammar Faizi reported that our exit code handling is wrong. We truncate
it to the lowest 8 bits but the syscall itself is expected to take a
regular 32-bit signed integer, not an unsigned char. It's the kernel
that later truncates it to the lowest 8 bits. The difference is visible
in strace, where the program below used to show exit(255) instead of
exit(-1):

  int main(void)
  {
        return -1;
  }

This patch applies the fix to all archs. x86_64, i386, arm64, armv7 and
mips were all tested and confirmed to work fine now. Risc-v was not
tested but the change is trivial and exactly the same as for other archs.

Reported-by: Ammar Faizi <ammar.faizi@students.amikom.ac.id>
Cc: stable@vger.kernel.org
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-27 11:02:51 +01:00
..
asm tools arch: Update arch/x86/lib/mem{cpy,set}_64.S copies used in 'perf bench mem memcpy' 2021-05-10 09:01:00 -03:00
asm-generic x86/insn: Use get_unaligned() instead of memcpy() 2021-11-18 19:16:30 +01:00
linux tools: compiler-gcc.h: Guard error attribute use with __has_attribute 2021-09-13 15:51:41 -07:00
nolibc tools/nolibc: fix incorrect truncation of exit code 2022-01-27 11:02:51 +01:00
tools tools: bpf: fix license for a compat header file 2018-09-19 23:49:58 +02:00
trace/events
uapi tools include UAPI: Sync sound/asound.h copy with the kernel sources 2021-10-05 14:51:33 -03:00
vdso tools headers: Synchronize linux/bits.h with the kernel sources 2020-04-14 11:40:05 -03:00