Message ID | 20210221012401.22328-2-cmr@codefail.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Improve signal performance on PPC64 with KUAP | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | warning | Failed to apply on branch powerpc/merge (626a6c3d2e20da80aaa710104f34ea6037b28b33) |
snowpatch_ozlabs/apply_patch | warning | Failed to apply on branch powerpc/next (6895c5ba7bdcc55eacad03cf309ab23be63b9cac) |
snowpatch_ozlabs/apply_patch | warning | Failed to apply on branch linus/master (92bf22614b21a2706f4993b278017e437f7785b3) |
snowpatch_ozlabs/apply_patch | warning | Failed to apply on branch powerpc/fixes (24321ac668e452a4942598533d267805f291fdc9) |
snowpatch_ozlabs/apply_patch | warning | Failed to apply on branch linux-next (1e0d27fce010b0a4a9e595506b6ede75934c31be) |
snowpatch_ozlabs/apply_patch | fail | Failed to apply to any branch |
Le 21/02/2021 à 02:23, Christopher M. Riedl a écrit : > Just wrap __copy_tofrom_user() for the usual 'unsafe' pattern which > accepts a label to goto on error. > > Signed-off-by: Christopher M. Riedl <cmr@codefail.de> > Reviewed-by: Daniel Axtens <dja@axtens.net> > --- > arch/powerpc/include/asm/uaccess.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h > index 78e2a3990eab..33b2de642120 100644 > --- a/arch/powerpc/include/asm/uaccess.h > +++ b/arch/powerpc/include/asm/uaccess.h > @@ -487,6 +487,9 @@ user_write_access_begin(const void __user *ptr, size_t len) > #define unsafe_put_user(x, p, e) \ > __unsafe_put_user_goto((__typeof__(*(p)))(x), (p), sizeof(*(p)), e) > > +#define unsafe_copy_from_user(d, s, l, e) \ > + unsafe_op_wrap(__copy_tofrom_user((__force void __user *)d, s, l), e) > + Could we perform same as unsafe_copy_to_user() instead of calling an external function which is banned in principle inside uaccess blocks ? > #define unsafe_copy_to_user(d, s, l, e) \ > do { \ > u8 __user *_dst = (u8 __user *)(d); \ >
On Tue Feb 23, 2021 at 11:15 AM CST, Christophe Leroy wrote: > > > Le 21/02/2021 à 02:23, Christopher M. Riedl a écrit : > > Just wrap __copy_tofrom_user() for the usual 'unsafe' pattern which > > accepts a label to goto on error. > > > > Signed-off-by: Christopher M. Riedl <cmr@codefail.de> > > Reviewed-by: Daniel Axtens <dja@axtens.net> > > --- > > arch/powerpc/include/asm/uaccess.h | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h > > index 78e2a3990eab..33b2de642120 100644 > > --- a/arch/powerpc/include/asm/uaccess.h > > +++ b/arch/powerpc/include/asm/uaccess.h > > @@ -487,6 +487,9 @@ user_write_access_begin(const void __user *ptr, size_t len) > > #define unsafe_put_user(x, p, e) \ > > __unsafe_put_user_goto((__typeof__(*(p)))(x), (p), sizeof(*(p)), e) > > > > +#define unsafe_copy_from_user(d, s, l, e) \ > > + unsafe_op_wrap(__copy_tofrom_user((__force void __user *)d, s, l), e) > > + > > Could we perform same as unsafe_copy_to_user() instead of calling an > external function which is > banned in principle inside uaccess blocks ? Yup, with your patch to move the barrier_nospec() into the allowance helpers this makes sense now. I just tried it and performance does not change significantly w/ either radix or hash translation. I will include this change in the next spin - thanks! > > > > #define unsafe_copy_to_user(d, s, l, e) \ > > do { \ > > u8 __user *_dst = (u8 __user *)(d); \ > >
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h index 78e2a3990eab..33b2de642120 100644 --- a/arch/powerpc/include/asm/uaccess.h +++ b/arch/powerpc/include/asm/uaccess.h @@ -487,6 +487,9 @@ user_write_access_begin(const void __user *ptr, size_t len) #define unsafe_put_user(x, p, e) \ __unsafe_put_user_goto((__typeof__(*(p)))(x), (p), sizeof(*(p)), e) +#define unsafe_copy_from_user(d, s, l, e) \ + unsafe_op_wrap(__copy_tofrom_user((__force void __user *)d, s, l), e) + #define unsafe_copy_to_user(d, s, l, e) \ do { \ u8 __user *_dst = (u8 __user *)(d); \