Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1619231
| Path | csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Al Viro <viro@ZenIV.linux.org.uk> |
| Newsgroups | linux.kernel |
| Subject | [RFC] why do we still keep __{get,put}_user_unaligned()? |
| Date | Sat, 08 Apr 2017 08:30:01 +0200 |
| Message-ID | <ttS2J-1GI-3@gated-at.bofh.it> (permalink) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.7.1 (2016-10-04) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 30 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-kernel@vger.kernel.org |
| X-Original-Date | Sat, 8 Apr 2017 07:21:16 +0100 |
| X-Original-Message-ID | <20170408062115.GZ29622@ZenIV.linux.org.uk> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1619231 |
Show key headers only | View raw
Right now we have no users of __get_user_unaligned() outside of
arch/* and only 4 users of __put_user_unaligned() outside of arch/*.
All 4 are in compat_sys_getdents64(). For storing
->d_ino and ->d_off in
struct linux_dirent64 {
u64 d_ino;
s64 d_off;
unsigned short d_reclen;
unsigned char d_type;
char d_name[0];
};
in case 32bit userland has weaker alignment requirements for that thing
and passes us a pointer that would've been aligned for 32bit, but not
for 64bit ABI. Which architecture would that be, though?
arm, mips, powerpc, sparc and s390 have that thing 64bit-aligned
in 32bit ABI (both of them in case of mips). And since native getdents()
does *not* maintain more than that when padding an entry, we'd better have
put_user() of 64bit values work for any 64bit-aligned pointer. I hadn't
checked actual cross-compile for tile, but judging by their compat.h they
are not suffering from that kind of braindamage either.
x86 does, indeed, have weaker alignment in 32bit ABI. It also
has __put_user_unaligned defined as __put_user.
Is there any reason to keep those around? As it is, the only places
that need those are m68k and arm binfmt-flat, and these boil down to "can this
CPU flavour do unaligned access?", with "use __get_user/__put_user" and
"use __copy_from_user/__copy_to_user" as outcomes. Nothing more fancy...
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[RFC] why do we still keep __{get,put}_user_unaligned()? Al Viro <viro@ZenIV.linux.org.uk> - 2017-04-08 08:30 +0200
[PATCH] remove compat_sys_getdents64() (was Re: [RFC] why do we still keep __{get,put}_user_unaligned()?) Al Viro <viro@ZenIV.linux.org.uk> - 2017-04-08 20:40 +0200
Re: [PATCH] remove compat_sys_getdents64() (was Re: [RFC] why do we still keep __{get,put}_user_unaligned()?) Linus Torvalds <torvalds@linux-foundation.org> - 2017-04-08 21:00 +0200
csiph-web