Open JonathonReinhart opened 2 years ago
FWIW: Glibc currently only passes 3 args as well:
/* Call kernel with additional two arguments the syscall requires. */
int
reboot (int howto)
{
return INLINE_SYSCALL (reboot, 3, (int) 0xfee1dead, 672274793, howto);
}
reboot(2)
says that thereboot
syscall takes four arguments:This is confirmed by looking at the kernel syscall implementation:
However, Musl is not currently passing the fourth argument:
The fourth argument,
void *arg
, is currently only used whencmd
is equal toLINUX_REBOOT_CMD_RESTART2
(0xa1b2c3d4
). This is not exposed in<sys/reboot.h>
as anRB_*
constant, but there is nothing stopping a caller from passing it intype
.The
syscall
implementation does not set extra registers to any fixed value.So if a user called
reboot(0xa1b2c3d4)
, the kernel would attempt astrncpy_from_user()
with a pointer value of whatever is in the 4th syscall register at that time. :warning:Musl should always pass 0 /
NULL
.