[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAObL_7HUhxsOVHYFovgxYu7r5YNju+n4Q45GZ9viCCW-GrxWhg@mail.gmail.com>
Date: Thu, 6 Oct 2011 17:48:36 -0700
From: Andrew Lutomirski <luto@....edu>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: richard -rw- weinberger <richard.weinberger@...il.com>,
Adrian Bunk <bunk@...sta.de>,
"H. Peter Anvin" <hpa@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: Re: [3.1 patch] x86: default to vsyscall=native
On Thu, Oct 6, 2011 at 11:34 AM, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
> On Thu, Oct 6, 2011 at 11:16 AM, Andrew Lutomirski <luto@....edu> wrote:
>>
>> Fixing it will be annoying because the attached fancier version needs
>> to work, too. I could implement the whole mess in software, but it
>> might be nicer to arrange for uaccess errors to stash some information
>> somewhere (like in the thread_struct cr2 variable).
>
> That should be easy enough to do. Just add it to the
> "fixup_exception()" case in no_context().
This code is rather messy. We stash the cr2, err, and trap fields of
sigcontext in thread_struct and we *never* reset them until the next
segfault. So userspace sees stale garbage on every signal that isn't
a (genuine) segfault. I can imagine this breaking UML is remarkably
bizarre ways even without vsyscall emulation because UML actually
seems to rely on that stuff to determine the source of a signal.
The nice fix would be to move this information into siginfo. cr2
appears to be duplicated by sa_addr. trap_no is apparently redundant
except for SIGTRAP. error_code is interesting. Any objection to
using some padding bytes to move this into siginfo and remove the
fields (except for uaccess) from thread_struct? Better ideas?
Without some kind of cleanup, I'm a bit worried about breakage if a
uaccess fault happens between something else setting the flags and a
signal getting delivered, resulting in corruption of the sigcontext,
unless I add more crud to thread_struct and waste memory for every
process.
--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists