1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

sysvipc: Fix SEM_STAT_ANY kernel argument pass [BZ #26637]

Handle SEM_STAT_ANY the same way as SEM_STAT so that the buffer argument
of SEM_STAT_ANY is properly passed to the kernel and back.

The regression testcase checks for Linux specifix SysV ipc message
control extension.  For IPC_INFO/SEM_INFO it tries to match the values
against the tunable /proc values and for SEM_STAT/SEM_STAT_ANY it
check if the create message queue is within the global list returned
by the kernel.

Checked on x86_64-linux-gnu and on i686-linux-gnu (Linux v5.4 and on
Linux v4.15).

Co-authored-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
This commit is contained in:
Dmitry V. Levin
2020-09-29 14:10:20 -03:00
committed by Adhemerval Zanella
parent 238032ead6
commit 574500a108
4 changed files with 192 additions and 1 deletions

View File

@ -102,6 +102,7 @@ semun64_to_ksemun64 (int cmd, union semun64 semun64,
r.array = semun64.array;
break;
case SEM_STAT:
case SEM_STAT_ANY:
case IPC_STAT:
case IPC_SET:
r.buf = buf;
@ -150,6 +151,7 @@ __semctl64 (int semid, int semnum, int cmd, ...)
case IPC_STAT: /* arg.buf */
case IPC_SET:
case SEM_STAT:
case SEM_STAT_ANY:
case IPC_INFO: /* arg.__buf */
case SEM_INFO:
va_start (ap, cmd);
@ -238,6 +240,7 @@ semun_to_semun64 (int cmd, union semun semun, struct __semid64_ds *semid64)
r.array = semun.array;
break;
case SEM_STAT:
case SEM_STAT_ANY:
case IPC_STAT:
case IPC_SET:
r.buf = semid64;
@ -267,6 +270,7 @@ __semctl (int semid, int semnum, int cmd, ...)
case IPC_STAT: /* arg.buf */
case IPC_SET:
case SEM_STAT:
case SEM_STAT_ANY:
case IPC_INFO: /* arg.__buf */
case SEM_INFO:
va_start (ap, cmd);
@ -321,6 +325,7 @@ __semctl_mode16 (int semid, int semnum, int cmd, ...)
case IPC_STAT: /* arg.buf */
case IPC_SET:
case SEM_STAT:
case SEM_STAT_ANY:
case IPC_INFO: /* arg.__buf */
case SEM_INFO:
va_start (ap, cmd);
@ -354,6 +359,7 @@ __old_semctl (int semid, int semnum, int cmd, ...)
case IPC_STAT: /* arg.buf */
case IPC_SET:
case SEM_STAT:
case SEM_STAT_ANY:
case IPC_INFO: /* arg.__buf */
case SEM_INFO:
va_start (ap, cmd);