mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Palmer Dabbelt <palmer@dabbelt.com>
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 <palmer@dabbelt.com>
Subject: [PATCH 1/3] Fix a misaligned load inside ptrace_attach()
Date: Thu, 30 Apr 2015 21:19:55 -0700	[thread overview]
Message-ID: <1430453997-32459-2-git-send-email-palmer@dabbelt.com> (raw)
In-Reply-To: <1430453997-32459-1-git-send-email-palmer@dabbelt.com>

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 <cmetcalf@ezchip.com>
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
---
 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


  reply	other threads:[~2015-05-01  4:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01  4:19 [PATCH 0/3] " Palmer Dabbelt
2015-05-01  4:19 ` Palmer Dabbelt [this message]
2015-05-08 13:21   ` [tip:sched/core] signals, ptrace, sched: " tip-bot for Palmer Dabbelt
2015-05-01  4:19 ` [PATCH 2/3] Change wait_on_bit*() to take an unsigned long*, not a void* Palmer Dabbelt
2015-05-08 13:21   ` [tip:sched/core] sched/wait: Change wait_on_bit*() to take an unsigned long *, not a void * tip-bot for Palmer Dabbelt
2015-05-01  4:19 ` [PATCH 3/3] Change all uses of JOBCTL_* from int to long Palmer Dabbelt
2015-05-08 13:20   ` [tip:sched/core] signals, sched: Change all uses of JOBCTL_* from 'int' to 'long' tip-bot for Palmer Dabbelt
2015-05-01  9:19 ` [PATCH 0/3] Fix a misaligned load inside ptrace_attach() Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430453997-32459-2-git-send-email-palmer@dabbelt.com \
    --to=palmer@dabbelt.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®