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

sysvipc: Return EINVAL for invalid semctl commands

It avoids regressions on possible future commands that might require
additional libc support.  The downside is new commands added by newer
kernels will need further glibc support.

Checked on x86_64-linux-gnu and i686-linux-gnu (Linux v4.15 and v5.4).
This commit is contained in:
Adhemerval Zanella
2020-09-29 14:29:48 -03:00
parent 574500a108
commit a16d2abd49
3 changed files with 100 additions and 0 deletions

View File

@ -158,6 +158,15 @@ __semctl64 (int semid, int semnum, int cmd, ...)
arg64 = va_arg (ap, union semun64);
va_end (ap);
break;
case IPC_RMID: /* arg ignored. */
case GETNCNT:
case GETPID:
case GETVAL:
case GETZCNT:
break;
default:
__set_errno (EINVAL);
return -1;
}
#if __IPC_TIME64
@ -277,6 +286,7 @@ __semctl (int semid, int semnum, int cmd, ...)
arg = va_arg (ap, union semun);
va_end (ap);
break;
/* __semctl64 handles non-supported commands. */
}
struct __semid64_ds semid64;