public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix a misaligned load inside ptrace_attach()
@ 2015-05-01  4:19 Palmer Dabbelt
  2015-05-01  4:19 ` [PATCH 1/3] " Palmer Dabbelt
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Palmer Dabbelt @ 2015-05-01  4:19 UTC (permalink / raw)
  To: mingo, peterz, oleg, akpm, richard, paulmck, bobby.prani,
	vdavydov
  Cc: linux-kernel

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-05-08 13:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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: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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox