1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00

Linux: Support __IPC_64 in sysvctl *ctl command arguments (bug 29771)

Old applications pass __IPC_64 as part of the command argument because
old glibc did not check for unknown commands, and passed through the
arguments directly to the kernel, without adding __IPC_64.
Applications need to continue doing that for old glibc compatibility,
so this commit enables this approach in current glibc.

For msgctl and shmctl, if no translation is required, make
direct system calls, as we did before the time64 changes.  If
translation is required, mask __IPC_64 from the command argument.

For semctl, the union-in-vararg argument handling means that
translation is needed on all architectures.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
This commit is contained in:
Florian Weimer
2022-11-08 14:15:02 +01:00
parent 38caf7a1cc
commit 22a46dee24
4 changed files with 63 additions and 26 deletions

View File

@@ -140,6 +140,13 @@ __semctl64 (int semid, int semnum, int cmd, ...)
union semun64 arg64 = { 0 };
va_list ap;
/* Some applications pass the __IPC_64 flag in cmd, to invoke
previously unsupported commands back when there was no EINVAL
error checking in glibc. Mask the flag for the switch statements
below. semctl_syscall adds back the __IPC_64 flag for the actual
system call. */
cmd &= ~__IPC_64;
/* Get the argument only if required. */
switch (cmd)
{