[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <50851727-4edd-4d26-a93f-d4780bad4b2e@app.fastmail.com>
Date: Wed, 29 Mar 2023 20:29:38 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: "Oleg Nesterov" <oleg@...hat.com>
Cc: "Gregory Price" <gourry.memverge@...il.com>,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
Linux-Arch <linux-arch@...r.kernel.org>, avagin@...il.com,
"Peter Zijlstra" <peterz@...radead.org>,
"Andy Lutomirski" <luto@...nel.org>, krisman@...labora.com,
"Thomas Gleixner" <tglx@...utronix.de>,
"Jonathan Corbet" <corbet@....net>, shuah <shuah@...nel.org>,
"Catalin Marinas" <catalin.marinas@....com>,
"Will Deacon" <will@...nel.org>,
"Mark Rutland" <mark.rutland@....com>, tongtiangen@...wei.com,
"Robin Murphy" <robin.murphy@....com>,
"Gregory Price" <gregory.price@...verge.com>
Subject: Re: [PATCH v14 1/4] asm-generic,arm64: create task variant of access_ok
On Wed, Mar 29, 2023, at 18:03, Oleg Nesterov wrote:
> On 03/29, Arnd Bergmann wrote:
>>
>> I think the idea of TASK_SIZE_MAX is that it is a compile-time constant and in fact independent of current, while TASK_SIZE
>> takes TIF_32BIT into account.
>
> Say, arch/loongarch defines TASK_SIZE which depends on
> test_thread_flag(TIF_32BIT_ADDR)
> but it doesn't define TASK_SIZE_MAX, so __access_ok() will use TASK_SIZE.
I'd consider that a bug in loongarch, though it's
as harmless as it gets: The only downside is that
it's missing an optimization from constant-folding
the value, and since there is no CONFIG_COMPAT on
loongarch yet, it doesn't even have a different
value.
TASK_SIZE_MAX become mandatory here when I worked
on the optimized access_ok() across architectures,
and the reason it's safe to use is that access_ok()
has to only guarantee that a task cannot access
data that it can't already access, i.e. kernel
data. Passing a pointer between TASK_SIZE and
TASK_SIZE_MAX will still cause a -EFAULT error
because of the trap.
Arnd
Powered by blists - more mailing lists