All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Palmer Dabbelt <palmer@dabbelt.com>
Cc: mingo@redhat.com, oleg@redhat.com, akpm@linux-foundation.org,
	richard@nod.at, paulmck@linux.vnet.ibm.com,
	bobby.prani@gmail.com, vdavydov@parallels.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] Fix a misaligned load inside ptrace_attach()
Date: Fri, 1 May 2015 11:19:21 +0200	[thread overview]
Message-ID: <20150501091921.GA5029@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1430453997-32459-1-git-send-email-palmer@dabbelt.com>

On Thu, Apr 30, 2015 at 09:19:54PM -0700, Palmer Dabbelt wrote:
> 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.

Fair enough. Thanks!

      parent reply	other threads:[~2015-05-01  9:19 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: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 ` Peter Zijlstra [this message]

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=20150501091921.GA5029@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=bobby.prani@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=richard@nod.at \
    --cc=vdavydov@parallels.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.