mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>
Cc: Jakub Jelinek <jakub@redhat.com>,
	Vineet Gupta <Vineet.Gupta1@synopsys.com>,
	"linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault
Date: Mon, 22 Aug 2016 16:12:50 -0700	[thread overview]
Message-ID: <20F4A326-4107-452C-AF84-385136D9501F@zytor.com> (raw)
In-Reply-To: <CA+55aFzKkVDuizFBH66s8n0u=1FRSXGPNKun9G8rFHaXw5Lx4w@mail.gmail.com>

On August 22, 2016 3:23:06 PM PDT, Linus Torvalds <torvalds@linux-foundation.org> wrote:
>On Sun, Aug 21, 2016 at 10:52 AM, Linus Torvalds
><torvalds@linux-foundation.org> wrote:
>> On Sat, Aug 20, 2016 at 11:42 PM, Al Viro <viro@zeniv.linux.org.uk>
>wrote:
>>>
>>> It's not exactly setjmp/longjmp; what I had in mind was along the
>lines of
>>
>> That ends up having all the exact same issues as setjmp, and
>generally
>> you *do* want the compiler to know about it.
>
>So just in case you wanted to play around with it, here's a kernel
>implementation of 'setjmp/longjmp' for x86.
>
>It's very lightly tested (and I'll admit to editing it for some
>cleanups after that light testing), but it does look largely sane.
>
>The whole interface choice may be debatable: maybe it would be better
>to allocate the register buffer on the stack, and just hide a pointer
>to it in the task struct. Things like that could be changed fairly
>easily. But if you want to play around with this, this patch should
>get you started.
>
>Of course, you'd want to wrap things up somehow, and I would *not*
>want to see naked setjmp() calls in the kernel.
>
>And we'd need this for all other architectures too, but it's usually
>not hard to do. It needs to save all the callee-saved registers and
>the stack pointer and return address. That should generally be it.
>
>The 32-bit version has not been tested at all, but it compiled at some
>point, and the code looks mostly sane. The 64-bit code I actually had
>a stupid non-user-access test-case for.
>
>                Linus

How about the gcc native __builtin_setjmp stuff which is supposedly better?
-- 
Sent from my Android device with K-9 Mail. Please excuse brevity and formatting.

  reply	other threads:[~2016-08-22 23:13 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-19 19:10 Vineet Gupta
2016-08-19 21:24 ` Al Viro
2016-08-19 22:00   ` Linus Torvalds
2016-08-19 22:11     ` Linus Torvalds
2016-08-20 23:32       ` Linus Torvalds
2016-08-21  0:11         ` Al Viro
2016-08-21  0:45           ` Linus Torvalds
2016-08-21  1:00             ` Linus Torvalds
2016-08-21  1:09               ` H. Peter Anvin
2016-08-21  1:40                 ` Al Viro
2016-08-21  4:54             ` Jakub Jelinek
2016-08-21  6:42               ` Al Viro
2016-08-21 17:52                 ` Linus Torvalds
2016-08-22 22:23                   ` Linus Torvalds
2016-08-22 23:12                     ` H. Peter Anvin [this message]
2016-08-22 23:48                       ` Linus Torvalds
2016-08-22 23:51                         ` H. Peter Anvin
2016-08-22 23:57                         ` David Miller
2016-08-23  0:09                           ` H. Peter Anvin
2016-08-23  0:17                         ` Al Viro
2016-08-22 23:19                     ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20F4A326-4107-452C-AF84-385136D9501F@zytor.com \
    --to=hpa@zytor.com \
    --cc=Vineet.Gupta1@synopsys.com \
    --cc=jakub@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®