Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'ipc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic

Pull ipc regression fixes from Arnd Bergmann:
"Fix ipc regressions from y2038 patches

These are two regression fixes for bugs that got introduced during the
system call rework that went into linux-5.1 but only bisected and
fixed now:

- One patch affects semtimedop() on many of the less common 32-bit
architectures, this just needs a single-line bugfix.

- The other affects only sparc64 and has a slightly more invasive
workaround to apply the same change to sparc64 that was done to the
generic code used everywhere else"

* tag 'ipc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
ipc: fix sparc64 ipc() wrapper
ipc: fix semtimedop for generic 32-bit architectures

+40 -39
+18 -15
arch/sparc/kernel/sys_sparc_64.c
··· 336 336 { 337 337 long err; 338 338 339 + if (!IS_ENABLED(CONFIG_SYSVIPC)) 340 + return -ENOSYS; 341 + 339 342 /* No need for backward compatibility. We can start fresh... */ 340 343 if (call <= SEMTIMEDOP) { 341 344 switch (call) { 342 345 case SEMOP: 343 - err = sys_semtimedop(first, ptr, 344 - (unsigned int)second, NULL); 346 + err = ksys_semtimedop(first, ptr, 347 + (unsigned int)second, NULL); 345 348 goto out; 346 349 case SEMTIMEDOP: 347 - err = sys_semtimedop(first, ptr, (unsigned int)second, 350 + err = ksys_semtimedop(first, ptr, (unsigned int)second, 348 351 (const struct __kernel_timespec __user *) 349 - (unsigned long) fifth); 352 + (unsigned long) fifth); 350 353 goto out; 351 354 case SEMGET: 352 - err = sys_semget(first, (int)second, (int)third); 355 + err = ksys_semget(first, (int)second, (int)third); 353 356 goto out; 354 357 case SEMCTL: { 355 - err = sys_semctl(first, second, 356 - (int)third | IPC_64, 357 - (unsigned long) ptr); 358 + err = ksys_old_semctl(first, second, 359 + (int)third | IPC_64, 360 + (unsigned long) ptr); 358 361 goto out; 359 362 } 360 363 default: ··· 368 365 if (call <= MSGCTL) { 369 366 switch (call) { 370 367 case MSGSND: 371 - err = sys_msgsnd(first, ptr, (size_t)second, 368 + err = ksys_msgsnd(first, ptr, (size_t)second, 372 369 (int)third); 373 370 goto out; 374 371 case MSGRCV: 375 - err = sys_msgrcv(first, ptr, (size_t)second, fifth, 372 + err = ksys_msgrcv(first, ptr, (size_t)second, fifth, 376 373 (int)third); 377 374 goto out; 378 375 case MSGGET: 379 - err = sys_msgget((key_t)first, (int)second); 376 + err = ksys_msgget((key_t)first, (int)second); 380 377 goto out; 381 378 case MSGCTL: 382 - err = sys_msgctl(first, (int)second | IPC_64, ptr); 379 + err = ksys_old_msgctl(first, (int)second | IPC_64, ptr); 383 380 goto out; 384 381 default: 385 382 err = -ENOSYS; ··· 399 396 goto out; 400 397 } 401 398 case SHMDT: 402 - err = sys_shmdt(ptr); 399 + err = ksys_shmdt(ptr); 403 400 goto out; 404 401 case SHMGET: 405 - err = sys_shmget(first, (size_t)second, (int)third); 402 + err = ksys_shmget(first, (size_t)second, (int)third); 406 403 goto out; 407 404 case SHMCTL: 408 - err = sys_shmctl(first, (int)second | IPC_64, ptr); 405 + err = ksys_old_shmctl(first, (int)second | IPC_64, ptr); 409 406 goto out; 410 407 default: 411 408 err = -ENOSYS;
+19
include/linux/syscalls.h
··· 1402 1402 return old; 1403 1403 } 1404 1404 1405 + /* for __ARCH_WANT_SYS_IPC */ 1406 + long ksys_semtimedop(int semid, struct sembuf __user *tsops, 1407 + unsigned int nsops, 1408 + const struct __kernel_timespec __user *timeout); 1409 + long ksys_semget(key_t key, int nsems, int semflg); 1410 + long ksys_old_semctl(int semid, int semnum, int cmd, unsigned long arg); 1411 + long ksys_msgget(key_t key, int msgflg); 1412 + long ksys_old_msgctl(int msqid, int cmd, struct msqid_ds __user *buf); 1413 + long ksys_msgrcv(int msqid, struct msgbuf __user *msgp, size_t msgsz, 1414 + long msgtyp, int msgflg); 1415 + long ksys_msgsnd(int msqid, struct msgbuf __user *msgp, size_t msgsz, 1416 + int msgflg); 1417 + long ksys_shmget(key_t key, size_t size, int shmflg); 1418 + long ksys_shmdt(char __user *shmaddr); 1419 + long ksys_old_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); 1420 + long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems, 1421 + unsigned int nsops, 1422 + const struct old_timespec32 __user *timeout); 1423 + 1405 1424 #endif
+1 -1
include/uapi/asm-generic/unistd.h
··· 569 569 __SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl) 570 570 #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32 571 571 #define __NR_semtimedop 192 572 - __SC_COMP(__NR_semtimedop, sys_semtimedop, sys_semtimedop_time32) 572 + __SC_3264(__NR_semtimedop, sys_semtimedop_time32, sys_semtimedop) 573 573 #endif 574 574 #define __NR_semop 193 575 575 __SYSCALL(__NR_semop, sys_semop)
+2 -23
ipc/util.h
··· 276 276 *cmd &= ~IPC_64; 277 277 return version; 278 278 } 279 - #endif 280 279 281 - /* for __ARCH_WANT_SYS_IPC */ 282 - long ksys_semtimedop(int semid, struct sembuf __user *tsops, 283 - unsigned int nsops, 284 - const struct __kernel_timespec __user *timeout); 285 - long ksys_semget(key_t key, int nsems, int semflg); 286 - long ksys_old_semctl(int semid, int semnum, int cmd, unsigned long arg); 287 - long ksys_msgget(key_t key, int msgflg); 288 - long ksys_old_msgctl(int msqid, int cmd, struct msqid_ds __user *buf); 289 - long ksys_msgrcv(int msqid, struct msgbuf __user *msgp, size_t msgsz, 290 - long msgtyp, int msgflg); 291 - long ksys_msgsnd(int msqid, struct msgbuf __user *msgp, size_t msgsz, 292 - int msgflg); 293 - long ksys_shmget(key_t key, size_t size, int shmflg); 294 - long ksys_shmdt(char __user *shmaddr); 295 - long ksys_old_shmctl(int shmid, int cmd, struct shmid_ds __user *buf); 296 - 297 - /* for CONFIG_ARCH_WANT_OLD_COMPAT_IPC */ 298 - long compat_ksys_semtimedop(int semid, struct sembuf __user *tsems, 299 - unsigned int nsops, 300 - const struct old_timespec32 __user *timeout); 301 - #ifdef CONFIG_COMPAT 302 280 long compat_ksys_old_semctl(int semid, int semnum, int cmd, int arg); 303 281 long compat_ksys_old_msgctl(int msqid, int cmd, void __user *uptr); 304 282 long compat_ksys_msgrcv(int msqid, compat_uptr_t msgp, compat_ssize_t msgsz, ··· 284 306 long compat_ksys_msgsnd(int msqid, compat_uptr_t msgp, 285 307 compat_ssize_t msgsz, int msgflg); 286 308 long compat_ksys_old_shmctl(int shmid, int cmd, void __user *uptr); 287 - #endif /* CONFIG_COMPAT */ 309 + 310 + #endif 288 311 289 312 #endif