All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: torvalds@linux-foundation.org
Cc: davidel@xmailserver.org, sfr@canb.auug.org.au,
	akpm@linux-foundation.org, dwmw2@infradead.org,
	linux-arch@vger.kernel.org, rmk@arm.linux.org.uk,
	tony.luck@intel.com, ralf@linux-mips.org
Subject: Re: [PATCH]add epoll compat code to fsl/compat.c
Date: Wed, 21 Feb 2007 19:07:02 -0800 (PST)	[thread overview]
Message-ID: <20070221.190702.88477592.davem@davemloft.net> (raw)
In-Reply-To: <Pine.LNX.4.64.0702211313560.4043@woody.linux-foundation.org>

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Wed, 21 Feb 2007 13:15:58 -0800 (PST)

> On Wed, 21 Feb 2007, Davide Libenzi wrote:
> > > 
> > > We can't trust user pointers, and that includes not trusting them being 
> > > aligned. 
> > 
> > Don't we get EFAULT in case of exception (access or alignment) in there?
> > For "dealing with", here we'd need them to do the correct thing 
> > (split-load?) in case of mis-aligned access.
> 
> I sure hope no architecture does that. EFAULT should be for *unmapped* 
> accesses, not from users just using unaligned pointers. 
> 
> I would argue that it is a bug if some architecture thinks that 
> "get_user()" and "put_user()" don't do unaligned accesses. 
> 
> (Not to say that it might not be something some odd architecture *does*, 
> but I'd be disappointed if somebody did)

If unaligned accesses in userspace give SIGBUS, which is the case
on both Sparc ports, it is a question of whether the same should be
done in cases like this.

I can definitely see arguments in both directions.

On the one hand, if userland has the have aligned stuff while he
executes, he should provide the same for things he gives to the
kernel.

On the other hand, userland has no way to embed structures passed into
system calls, using things like the "packed" GCC attribute, and
communicate that to the kernel.  So in that regard, the kernel should
try to handle the unaligned access as best as possible.

But currently we -EFAULT on sparc in this situation and I've never
seen a problem because of that.

Nevertheless, I am to understand that in this case we're talking about
a "u64" object, and that (and the structure it is in) will be aligned
on an 8-byte boundary on both sparc32 and sparc64, so maybe there is
no problem here?

  reply	other threads:[~2007-02-22  3:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-20 21:57 [patch 18/50] add epoll compat code to kernel/compat.c akpm
2007-02-20 23:20 ` Stephen Rothwell
2007-02-20 23:33   ` Davide Libenzi
2007-02-21  1:01     ` Stephen Rothwell
2007-02-21  1:05       ` Stephen Rothwell
2007-02-21  1:12       ` Davide Libenzi
2007-02-21  3:10         ` [PATCH]add epoll compat code to fsl/compat.c Stephen Rothwell
2007-02-21 20:24           ` Davide Libenzi
2007-02-21 20:36             ` Linus Torvalds
2007-02-21 21:04               ` Davide Libenzi
2007-02-21 21:15                 ` Linus Torvalds
2007-02-22  3:07                   ` David Miller [this message]
2007-02-22  4:03                     ` Davide Libenzi
2007-02-22  4:39                     ` Stephen Rothwell
2007-02-21 22:14                 ` Ralf Baechle
2007-02-21 22:25                   ` Davide Libenzi
2007-02-21 23:23                     ` Ralf Baechle
2007-02-22  3:02               ` David Miller
2007-02-22  3:08                 ` Davide Libenzi
2007-02-21  1:38       ` [patch 18/50] add epoll compat code to kernel/compat.c Ralf Baechle
2007-02-20 23:57   ` Andrew Morton

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=20070221.190702.88477592.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=akpm@linux-foundation.org \
    --cc=davidel@xmailserver.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=rmk@arm.linux.org.uk \
    --cc=sfr@canb.auug.org.au \
    --cc=tony.luck@intel.com \
    --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 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.