Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1466702

Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault

From Linus Torvalds <torvalds@linux-foundation.org>
Newsgroups linux.kernel
Subject Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault
Date 2016-08-20 00:20 +0200
Message-ID <s80iR-2Yl-1@gated-at.bofh.it> (permalink)
References <s7XuF-1cK-3@gated-at.bofh.it> <s7Zwu-2rP-11@gated-at.bofh.it> <s809c-2Vg-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Fri, Aug 19, 2016 at 3:00 PM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> (I have some experimental patches that actually use "asm goto" in
> "unsafe_put_user()" to get that nice code generation, but they only
> work if your gcc version supports "asm goto", which some older
> versions of gcc does not)

Since you actually are looking at the user access stuff, I'll just put
them here.

This is from an old branch of mine, based on commit f6c658df6385 just
because that happened to be my top-of-tree when I was playing around
with it. It probably doesn't even apply right now, and as mentioned,
it depends on "asm goto" (there is no case for !CC_HAVE_ASM_GOTO).

With this, you actually get almost perfect code generation if you then
replace all the "put_user_ex()" calls with

        if (access_ok(..))
            return -EFAULT;

        user_access_begin();
        unsafe_put_user(x,ptr, error_label);
        unsafe_put_user(y,ptr2, error_label);
        ...
        user_access_end();
        return 0;

    error_label:
        user_access_end();
        return -EFAULT;

or something similar. The exception handler will jump directly to
"error_label", and there will be no testing of anything at all in the
usual no-exception cases, nor will there be any extra registers for
error values etc.

           Linus

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-08-19 21:20 +0200
  Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-19 23:30 +0200
    Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Linus Torvalds <torvalds@linux-foundation.org> - 2016-08-20 00:10 +0200
      Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Linus Torvalds <torvalds@linux-foundation.org> - 2016-08-20 00:20 +0200
        Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Linus Torvalds <torvalds@linux-foundation.org> - 2016-08-21 01:40 +0200
          Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-21 02:20 +0200
            Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Linus Torvalds <torvalds@linux-foundation.org> - 2016-08-21 02:50 +0200
              Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Linus Torvalds <torvalds@linux-foundation.org> - 2016-08-21 03:10 +0200
                Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault "H. Peter Anvin" <hpa@zytor.com> - 2016-08-21 03:10 +0200
                Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-21 03:50 +0200
              Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Jakub Jelinek <jakub@redhat.com> - 2016-08-21 07:00 +0200
                Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-21 08:50 +0200
                Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Linus Torvalds <torvalds@linux-foundation.org> - 2016-08-21 20:00 +0200
                Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Linus Torvalds <torvalds@linux-foundation.org> - 2016-08-23 00:30 +0200
                Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault "H. Peter Anvin" <hpa@zytor.com> - 2016-08-23 01:20 +0200
                Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Linus Torvalds <torvalds@linux-foundation.org> - 2016-08-23 01:50 +0200
                Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of  fault David Miller <davem@davemloft.net> - 2016-08-23 02:00 +0200
                Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault "H. Peter Anvin" <hpa@zytor.com> - 2016-08-23 02:10 +0200
                Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault "H. Peter Anvin" <hpa@zytor.com> - 2016-08-23 02:00 +0200
                Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault Al Viro <viro@ZenIV.linux.org.uk> - 2016-08-23 02:20 +0200
                Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault "H. Peter Anvin" <hpa@zytor.com> - 2016-08-23 01:20 +0200

csiph-web