This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH v1 1/4] lib: introduce copy_struct_from_user() helper
- From: Linus Torvalds <torvalds at linux-foundation dot org>
- To: Al Viro <viro at zeniv dot linux dot org dot uk>
- Cc: Aleksa Sarai <cyphar at cyphar dot com>, Ingo Molnar <mingo at redhat dot com>, Peter Zijlstra <peterz at infradead dot org>, Alexander Shishkin <alexander dot shishkin at linux dot intel dot com>, Jiri Olsa <jolsa at redhat dot com>, Namhyung Kim <namhyung at kernel dot org>, Christian Brauner <christian at brauner dot io>, Rasmus Villemoes <linux at rasmusvillemoes dot dk>, GNU C Library <libc-alpha at sourceware dot org>, Linux API <linux-api at vger dot kernel dot org>, Linux Kernel Mailing List <linux-kernel at vger dot kernel dot org>
- Date: Wed, 25 Sep 2019 13:23:27 -0700
- Subject: Re: [PATCH v1 1/4] lib: introduce copy_struct_from_user() helper
- References: <email@example.com> <firstname.lastname@example.org> <CAHk-=wjFeNjhtUxQ8npmXORz5RLQU7B_3wD=45eug1+MXnuYvA@mail.gmail.com> <20190925172049.skm6ohnnxpofdkzv@yavin> <CAHk-=wjagt257WHiOr2v1Bx_3q7tuzogabw_1EnodKm0vt+-WQ@mail.gmail.com> <20190925180412.GK26530@ZenIV.linux.org.uk> <CAHk-=wgcHw-O1sXw2jfJEHSVa2xmJcP9dzUmy71Cqk7_wVLSFQ@mail.gmail.com> <20190925194331.GL26530@ZenIV.linux.org.uk>
On Wed, Sep 25, 2019 at 12:43 PM Al Viro <email@example.com> wrote:
> FWIW, I would probably add a kernel-space analogue of that thing at the
> same time - check that an area is all-zeroes is not all that rare.
> Another thing is that for s390 we almost certainly want something better
> than word-by-word. IIRC, word-sized userland accesses really hurt there.
> It's nowhere near as critical as with strncpy_from_user(), but with the
> same underlying issue.
Well, s390 does have those magic "area" instructions, but part of why
it's expensive on s390 is that they haven't implemented the
"user_access_begin()/end()' stuff. I think s390 could use that to at
least minimize some of the costs.
With the common case presumably being just a couple of words, it migth
not be worth it doing anything more than that even on s390.
Interestingly (or perhaps not) if I read the internal s390
implementation correctly, they kind of _have_ that concept and they
use it internally. It's just that they call it "enable_sacf_uaccess()"
and "disable_sacf_uaccess()" instead.