[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230329151515.GA913@redhat.com>
Date: Wed, 29 Mar 2023 17:15:16 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Gregory Price <gourry.memverge@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-arch@...r.kernel.org,
avagin@...il.com, peterz@...radead.org, luto@...nel.org,
krisman@...labora.com, tglx@...utronix.de, corbet@....net,
shuah@...nel.org, catalin.marinas@....com, arnd@...db.de,
will@...nel.org, mark.rutland@....com, tongtiangen@...wei.com,
robin.murphy@....com, Gregory Price <gregory.price@...verge.com>
Subject: Re: [PATCH v14 1/4] asm-generic,arm64: create task variant of
access_ok
Hmm. I am not comfortable with this change...
I won't really argue because I don't have a better solution and because
I think we don't really care as long as task_set_syscall_user_dispatch()
is the only user of task_access_ok(), but still...
OK, so this version changes set_syscall_user_dispatch() to use
task_access_ok() instead of access_ok() because task != current.
On 03/28, Gregory Price wrote:
>
> If the architecture does not implement task_access_ok, the operation
> reduces to access_ok and the task argument is discarded.
No, with this patch it reduces to __access_ok(). And this already doesn't
look very good to me, but this is minor.
> --- a/include/asm-generic/access_ok.h
> +++ b/include/asm-generic/access_ok.h
> @@ -45,4 +45,14 @@ static inline int __access_ok(const void __user *ptr, unsigned long size)
> #define access_ok(addr, size) likely(__access_ok(addr, size))
> #endif
>
> +/*
> + * Some architectures may have special features (such as ARM MTE)
> + * that require handling if access_ok is called on a pointer from one
> + * task in the context of another. On most architectures this operation
> + * is equivalent to simply __access_ok.
> + */
> +#ifndef task_access_ok
> +#define task_access_ok(task, addr, size) likely(__access_ok(addr, size))
> +#endif
Lets ignore arm64.
This look as if access_ok() or __access_ok() doesn't depend on task, but
this is not true in general. Say, TASK_SIZE_MAX can check is_32bit_task()
test_thread_flag(TIF_32BIT...) and this uses "current".
Again, we probably do not care, but I don't like the fact task_access_ok()
looks as if task_access_ok(task) returns the same result as "task" calling
access_ok().
Oleg.
Powered by blists - more mailing lists