From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932892AbcHVXNT (ORCPT ); Mon, 22 Aug 2016 19:13:19 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36614 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756623AbcHVXNF (ORCPT ); Mon, 22 Aug 2016 19:13:05 -0400 User-Agent: K-9 Mail for Android In-Reply-To: References: <1471633802-2936-1-git-send-email-vgupta@synopsys.com> <20160819212428.GR2356@ZenIV.linux.org.uk> <20160821001141.GV2356@ZenIV.linux.org.uk> <20160821045402.GC14857@tucnak.redhat.com> <20160821064229.GX2356@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: [PATCH] ARC: uaccess: get_user to zero out dest in cause of fault From: "H. Peter Anvin" Date: Mon, 22 Aug 2016 16:12:50 -0700 To: Linus Torvalds , Al Viro CC: Jakub Jelinek , Vineet Gupta , "linux-arch@vger.kernel.org" , Linux Kernel Mailing List , Ingo Molnar Message-ID: <20F4A326-4107-452C-AF84-385136D9501F@zytor.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On August 22, 2016 3:23:06 PM PDT, Linus Torvalds wrote: >On Sun, Aug 21, 2016 at 10:52 AM, Linus Torvalds > wrote: >> On Sat, Aug 20, 2016 at 11:42 PM, Al Viro >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.