[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1701200000080.5358@nanos>
Date: Fri, 20 Jan 2017 00:04:17 +0100 (CET)
From: Thomas Gleixner <tglx@...utronix.de>
To: "Frank Ch. Eigler" <fche@...hat.com>
cc: David Smith <dsmith@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andy Lutomirski <luto@...capital.net>,
Ingo Molnar <mingo@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC][PATCH] x86: Verify access_ok() context
Frank.
On Thu, 19 Jan 2017, Frank Ch. Eigler wrote:
> > Well, if you are not in thread context then the check is pointless:
> > __range_not_ok(addr, size, user_addr_max())
> > and:
> > #define user_addr_max() (current->thread.addr_limit.seg)
> >
> > So what guarantees when you are not in context of current, i.e. in thread
> > context, that the addr/size which is checked against the limits of current
> > actually belongs to current?
>
> We're probably in task context in that there is a valid current(), but
current is always accessible no matter in which context you are - task,
softirq, hardirq, nmi ...
> running with preemption and/or interrupts and/or pagefaults disabled
> at that point, so in_task() objects.
As Peter explained, neither preempt disable nor interrupt disable not
pagefault disabled have any influence on in_task(). It merily checks the
context: !in_softirq() && !in_hardirq() && !in_nmi().
So that warning happens definitely not from task context.
Care to share the code?
Thanks,
tglx
Powered by blists - more mailing lists