Commit de0244a
tools/nolibc: fix incorrect truncation of exit code
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>1 parent ebbe0d8 commit de0244a
1 file changed
Lines changed: 5 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
414 | 414 | | |
415 | 415 | | |
416 | 416 | | |
417 | | - | |
| 417 | + | |
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| |||
602 | 602 | | |
603 | 603 | | |
604 | 604 | | |
605 | | - | |
606 | | - | |
607 | | - | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
608 | 608 | | |
609 | 609 | | |
610 | 610 | | |
| |||
788 | 788 | | |
789 | 789 | | |
790 | 790 | | |
791 | | - | |
792 | 791 | | |
793 | 792 | | |
794 | 793 | | |
| |||
985 | 984 | | |
986 | 985 | | |
987 | 986 | | |
988 | | - | |
989 | 987 | | |
990 | 988 | | |
991 | 989 | | |
| |||
1190 | 1188 | | |
1191 | 1189 | | |
1192 | 1190 | | |
1193 | | - | |
| 1191 | + | |
1194 | 1192 | | |
1195 | 1193 | | |
1196 | 1194 | | |
| |||
1388 | 1386 | | |
1389 | 1387 | | |
1390 | 1388 | | |
1391 | | - | |
1392 | 1389 | | |
1393 | 1390 | | |
1394 | 1391 | | |
| |||
0 commit comments