* uaccess.h: implement unsafe_copy_{to,from}_user()?
@ 2017-12-30 21:40 Alexander Kappner
0 siblings, 0 replies; only message in thread
From: Alexander Kappner @ 2017-12-30 21:40 UTC (permalink / raw)
To: linux-kernel; +Cc: viro, torvalds
Commit 5b24a7a2aa2040c8c50c3b71122901d01661ff78 introduced the
unsafe_get_user and unsafe_put_user replacement functions for batched calls
to put_user and get_user. I'm trying to make the kernel smaller and reduce
stac/clac overhead on x86 by substituting the new functions for such
batched calls. But there's no corresponding unsafe_copy_to_user()
or unsafe_copy_from_user() functions to copy an arbitrary-sized buffer to
and from userspace without calling access_ok and __uaccess_begin/end.
I know that the matter of replacing these uaccess functions has been
discussed at length (see https://lkml.org/lkml/2017/5/13/134), so before I
started hacking away implementing new unsafe_copy_{to,from}_user functions,
I wanted to ask if a solution to this is already being worked on or if
there's some way of accomplishing this goal without new functions.
To illustrate, here's a batched function call (from fs/fat/dir.c):
if (put_user(0, d2->d_name) ||
put_user(0, &d2->d_reclen) ||
copy_to_user(d1->d_name, name, name_len) ||
// etc...
goto efault;
This should read:
if (!access_ok(VERIFY_WRITE, d1, 2*sizeof(*infop))
goto efault;
user_access_begin();
unsafe_put_user(0, d2->d_name, efault)
unsafe_put_user(0, &d2->d_reclen, efault)
unsafe_copy_to_user(d1->d_name, name, name_len, efault); // we don't have
// this function
// etc...
user_access_end();
Thanks.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-12-30 21:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-30 21:40 uaccess.h: implement unsafe_copy_{to,from}_user()? Alexander Kappner
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®