public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Palmer Dabbelt <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: torvalds@linux-foundation.org, hpa@zytor.com,
	akpm@linux-foundation.org, bp@alien8.de, cmetcalf@ezchip.com,
	mingo@kernel.org, linux-kernel@vger.kernel.org,
	peterz@infradead.org, palmer@dabbelt.com, tglx@linutronix.de
Subject: [tip:sched/core] signals, ptrace, sched: Fix a misaligned load inside ptrace_attach()
Date: Fri, 8 May 2015 06:21:22 -0700	[thread overview]
Message-ID: <tip-e7cc4173115347bcdaa5de2824dd46ef2c58425f@git.kernel.org> (raw)
In-Reply-To: <1430453997-32459-2-git-send-email-palmer@dabbelt.com>

Commit-ID:  e7cc4173115347bcdaa5de2824dd46ef2c58425f
Gitweb:     http://git.kernel.org/tip/e7cc4173115347bcdaa5de2824dd46ef2c58425f
Author:     Palmer Dabbelt <palmer@dabbelt.com>
AuthorDate: Thu, 30 Apr 2015 21:19:55 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 8 May 2015 12:06:57 +0200

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4f066cb..fb650a2 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1374,7 +1374,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;

  reply	other threads:[~2015-05-08 13:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01  4:19 [PATCH 0/3] Fix a misaligned load inside ptrace_attach() Palmer Dabbelt
2015-05-01  4:19 ` [PATCH 1/3] " Palmer Dabbelt
2015-05-08 13:21   ` tip-bot for Palmer Dabbelt [this message]
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=tip-e7cc4173115347bcdaa5de2824dd46ef2c58425f@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=cmetcalf@ezchip.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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