]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - include/linux/sched.h
signals, ptrace, sched: Fix a misaligned load inside ptrace_attach()
authorPalmer Dabbelt <palmer@dabbelt.com>
Fri, 1 May 2015 04:19:55 +0000 (21:19 -0700)
committerIngo Molnar <mingo@kernel.org>
Fri, 8 May 2015 10:06:57 +0000 (12:06 +0200)
commite7cc4173115347bcdaa5de2824dd46ef2c58425f
tree21c2f2048bcb68fc4d3af550a21fa30ee34c6d1a
parent7e60598785f30cf3dc9e476cc0fc3feeb37a0c63
signals, ptrace, sched: Fix a misaligned load inside ptrace_attach()

The misaligned load exception arises when running ptrace_attach() on
the RISC-V (which hasn't been upstreamed yet).  The problem is that
wait_on_bit() takes a void* but then proceeds to call test_bit(),
which takes a long*.  This allows an int-aligned pointer to be passed
to test_bit(), which promptly fails.  This will manifest on any other
asm-generic port where unaligned loads trap, where sizeof(long) >
sizeof(int), and where task_struct.jobctl ends up not being
long-aligned.

This patch changes task_struct.jobctl to be a long, which ensures it
has the correct alignment.

Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Chris Metcalf <cmetcalf@ezchip.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: bobby.prani@gmail.com
Cc: oleg@redhat.com
Cc: paulmck@linux.vnet.ibm.com
Cc: richard@nod.at
Cc: vdavydov@parallels.com
Link: http://lkml.kernel.org/r/1430453997-32459-2-git-send-email-palmer@dabbelt.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
include/linux/sched.h