From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752571AbbEAE01 (ORCPT ); Fri, 1 May 2015 00:26:27 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:34075 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751895AbbEAE0X (ORCPT ); Fri, 1 May 2015 00:26:23 -0400 From: Palmer Dabbelt To: mingo@redhat.com To: peterz@infradead.org To: oleg@redhat.com To: akpm@linux-foundation.org To: richard@nod.at To: paulmck@linux.vnet.ibm.com To: bobby.prani@gmail.com To: vdavydov@parallels.com Cc: linux-kernel@vger.kernel.org Cc: Palmer Dabbelt Subject: [PATCH 1/3] Fix a misaligned load inside ptrace_attach() Date: Thu, 30 Apr 2015 21:19:55 -0700 Message-Id: <1430453997-32459-2-git-send-email-palmer@dabbelt.com> X-Mailer: git-send-email 2.0.5 In-Reply-To: <1430453997-32459-1-git-send-email-palmer@dabbelt.com> References: <1430453997-32459-1-git-send-email-palmer@dabbelt.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Reviewed-by: Chris Metcalf Signed-off-by: Palmer Dabbelt --- include/linux/sched.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 26a2e6122734..391827db0a2d 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1369,7 +1369,7 @@ struct task_struct { int exit_state; int exit_code, exit_signal; int pdeath_signal; /* The signal sent when the parent dies */ - unsigned int jobctl; /* JOBCTL_*, siglock protected */ + unsigned long jobctl; /* JOBCTL_*, siglock protected */ /* Used for emulating ABI behavior of previous Linux versions */ unsigned int personality; -- 2.0.5