Fix compat_sys_sigpending breakage
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 5 Aug 2017 20:00:50 +0000 (23:00 +0300)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 6 Aug 2017 18:48:27 +0000 (11:48 -0700)
commitfbb77611e95d3d5b2af86a59754a3130877cb667
tree026bc121b112736776c5de03463ce52fa4424280
parent0fdd951c9bef93637d5af036851e7a5632fbd6c3
Fix compat_sys_sigpending breakage

The latest change of compat_sys_sigpending in commit 8f13621abced
("sigpending(): move compat to native") has broken it in two ways.

First, it tries to write 4 bytes more than userspace expects:
sizeof(old_sigset_t) == sizeof(long) == 8 instead of
sizeof(compat_old_sigset_t) == sizeof(u32) == 4.

Second, on big endian architectures these bytes are being written in the
wrong order.

This bug was found by strace test suite.

Reported-by: Anatoly Pugachev <matorola@gmail.com>
Inspired-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Fixes: 8f13621abced ("sigpending(): move compat to native")
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/signal.c