[1/2] ipc: fix semtimedop for generic 32-bit architectures

Message ID 20190905152155.1392871-1-arnd@arndb.de
State Accepted
Commit 78e05972c5e6c8e9ca4c00ccc6985409da69f904
Headers show
  • [1/2] ipc: fix semtimedop for generic 32-bit architectures
Related show

Commit Message

Arnd Bergmann Sept. 5, 2019, 3:21 p.m.
As Vincent noticed, the y2038 conversion of semtimedop in linux-5.1
broke when commit 00bf25d693e7 ("y2038: use time32 syscall names on
32-bit") changed all system calls on all architectures that take
a 32-bit time_t to point to the _time32 implementation, but left out
semtimedop in the asm-generic header.

This affects all 32-bit architectures using asm-generic/unistd.h:
h8300, unicore32, openrisc, nios2, hexagon, c6x, arc, nds32 and csky.

The notable exception is riscv32, which has dropped support for the
time32 system calls entirely.

Reported-by: Vincent Chen <deanbo422@gmail.com>
Cc: stable@vger.kernel.org
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Guan Xuetao <gxt@pku.edu.cn>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Ley Foon Tan <lftan@altera.com>
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: Mark Salter <msalter@redhat.com>
Cc: Aurelien Jacquiot <jacquiot.aurelien@gmail.com>
Cc: Guo Ren <guoren@kernel.org>
Fixes: 00bf25d693e7 ("y2038: use time32 syscall names on 32-bit")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Hi Vincent,

Sorry for the delay since your report. Does this address your

Anyone else, please note that this patch is required since
5.1 to make sysvipc work on the listed architectures.
 include/uapi/asm-generic/unistd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



Matt Turner Sept. 5, 2019, 5:22 p.m. | #1
On Thu, Sep 5, 2019 at 8:23 AM Arnd Bergmann <arnd@arndb.de> wrote:

> Matt bisected a sparc64 specific issue with semctl, shmctl and msgctl

> to a commit from my y2038 series in linux-5.1, as I missed the custom

> sys_ipc() wrapper that sparc64 uses in place of the generic version that

> I patched.


> The problem is that the sys_{sem,shm,msg}ctl() functions in the kernel

> now do not allow being called with the IPC_64 flag any more, resulting

> in a -EINVAL error when they don't recognize the command.


> Instead, the correct way to do this now is to call the internal

> ksys_old_{sem,shm,msg}ctl() functions to select the API version.


> As we generally move towards these functions anyway, change all of

> sparc_ipc() to consistently use those in place of the sys_*() versions,

> and move the required ksys_*() declarations into linux/syscalls.h


> Reported-by: Matt Turner <mattst88@gmail.com>

> Fixes: 275f22148e87 ("ipc: rename old-style shmctl/semctl/msgctl syscalls")

> Cc: stable@vger.kernel.org

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

> ---

> Hi Matt,


> Can you check that this solves your problem?

Works great. Thank you Arnd!

Tested-by: Matt Turner <mattst88@gmail.com>


diff --git a/include/uapi/asm-generic/unistd.h b/include/uapi/asm-generic/unistd.h
index 1be0e798e362..1fc8faa6e973 100644
--- a/include/uapi/asm-generic/unistd.h
+++ b/include/uapi/asm-generic/unistd.h
@@ -569,7 +569,7 @@  __SYSCALL(__NR_semget, sys_semget)
 __SC_COMP(__NR_semctl, sys_semctl, compat_sys_semctl)
 #if defined(__ARCH_WANT_TIME32_SYSCALLS) || __BITS_PER_LONG != 32
 #define __NR_semtimedop 192
-__SC_COMP(__NR_semtimedop, sys_semtimedop, sys_semtimedop_time32)
+__SC_3264(__NR_semtimedop, sys_semtimedop_time32, sys_semtimedop)
 #define __NR_semop 193
 __SYSCALL(__NR_semop, sys_semop)