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
Subject: [PATCH 0/3] Fix a misaligned load inside ptrace_attach()
Date: Thu, 30 Apr 2015 21:19:54 -0700 [thread overview]
Message-ID: <1430453997-32459-1-git-send-email-palmer@dabbelt.com> (raw)
I ran across what I believe is a bug in some asm-generic code while
working on the RISC-V Linux port. Essentially the problem is that
wait_on_bit() takes a void *, but then perfroms long-aligned
operation. As far as I can tell, this bug could manifest on any other
architecture that doesn't support misaligned operations and uses this
particular asm-generic implementation.
The patch set is split into three parts:
* #1 fixes the bug by making task_struct.jobctl an unsigned long,
which ensures wait_on_bit() always ends up with a long-aligned
argument.
* #2 changes the prototype of wait_on_bit() and friends to take a
"unsigned long *" instead of a "void *", with the intent of
ensuring these problems don't happen again.
* #3 is a bit more intrusive: it goes and changes all uses of
task_struct.jobctl from int to long.
I'm not sure if #3 has gone too far, but I think #1 and #2 are sane.
The cost is making task_struct larger on machines where
sizeof(long)>sizeof(int), but since it's so big already this isn't too
much cost. I thought about making test_bit() perform byte-aligned
accesses to avoid this cost, but since there are very similar looking
atomic functions I thought that would be too odd.
next 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 Palmer Dabbelt [this message]
2015-05-01 4:19 ` [PATCH 1/3] " Palmer Dabbelt
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-1-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®