From: Thomas Gleixner <tglx@linutronix.de>
To: john stultz <johnstul@us.ibm.com>
Cc: Andi Kleen <ak@muc.de>,
Arne Georg Gleditsch <arne.gleditsch@dolphinics.no>,
LKML <linux-kernel@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>,
Roman Zippel <zippel@linux-m68k.org>,
"H. Peter Anvin" <hpa@zytor.com>,
Arjan van de Ven <arjan@infradead.org>
Subject: Re: arch/x86/kernel/vsyscall_64.c: overeager NOP of syscalls
Date: Thu, 21 Feb 2008 21:47:48 +0100 (CET) [thread overview]
Message-ID: <alpine.LFD.1.00.0802212129510.7583@apollo.tec.linutronix.de> (raw)
In-Reply-To: <1203624160.6150.5.camel@localhost.localdomain>
On Thu, 21 Feb 2008, john stultz wrote:
> > > Yes they are. But a system call sequence at a known fixed address
> > > is potentially useful to exploits. That is why it is nop'ed out when
> > > it is not needed.
> >
> > That's a nice intent, but the reality is that this code is broken as
> > hell:
> >
> > 1) the patching code runs without synchronizing other CPUs
> >
> > 2) it inserts NOPs even if there is no clock source which provides
> > vread
> >
> > 3) when the clock source changes to one without vread we run in
> > exactly the same problem as in #2
>
> I've not looked deeply here, but it seems to resolve #2 and #3, we need
> some way for glibc to know if it should jump to the vsyscall or make the
> syscall itself.
Does glibc have an existing fallback, when we return -ENOSYS (or
whatever) from the vsyscall path ? If not, we can not do this.
> If it always jumps to the vsyscall address, it seems we have to have
> some way of falling back to syscall inside the vsyscall.
>
> That or we need to do the NOP/un-NOP part in the update_vsyscall code
> dependent on if the current clocksource supports vread, instead of on
> the /proc entry access.
That won't fly. We need to sychronize the CPUs when we patch the code,
which is not possible from update_wall_time with interrupts disabled.
I fear we have to kill the broken code for .25 and implement vdso
randomizing to fix that. Another short term solution to prevent
attacks via the syscall instruction would be to sanity check syscalls
when the call originates from the vsyscall address range, but that
might be frowned upon as it adds two assembler instructions into the
syscall hotpath :)
Thanks,
tglx
next prev parent reply other threads:[~2008-02-21 20:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-20 13:57 Arne Georg Gleditsch
2008-02-20 18:08 ` Thomas Gleixner
2008-02-21 15:58 ` Andi Kleen
2008-02-21 19:45 ` Thomas Gleixner
2008-02-21 20:02 ` john stultz
2008-02-21 20:47 ` Thomas Gleixner [this message]
2008-02-21 20:59 ` Thomas Gleixner
2008-02-22 12:55 ` Andi Kleen
2008-02-22 12:49 ` Andi Kleen
2008-02-22 10:38 ` Arne Georg Gleditsch
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=alpine.LFD.1.00.0802212129510.7583@apollo.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=ak@muc.de \
--cc=arjan@infradead.org \
--cc=arne.gleditsch@dolphinics.no \
--cc=hpa@zytor.com \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=zippel@linux-m68k.org \
/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®