[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230622114924.GN4253@hirez.programming.kicks-ass.net>
Date: Thu, 22 Jun 2023 13:49:24 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Christophe Leroy <christophe.leroy@...roup.eu>
Cc: Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Sathvika Vasireddy <sv@...ux.ibm.com>,
Naveen N Rao <naveen@...nel.org>,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH v2 12/14] objtool: Add support for more complex UACCESS
control
On Thu, Jun 22, 2023 at 12:54:34PM +0200, Christophe Leroy wrote:
> On x86, UACCESS is controlled by two instructions: STAC and CLAC.
> STAC instruction enables UACCESS while CLAC disables UACCESS.
> This is simple enough for objtool to locate UACCESS enable and
> disable.
>
> But on powerpc it is a bit more complex, the same instruction is
> used for enabling and disabling UACCESS, and the same instruction
> can be used for many other things. It would be too complex to use
> exclusively instruction decoding.
>
> To help objtool, mark such instruction into .discard.uaccess_begin
> and .discard.uaccess_end sections, on the same principle as for
> reachable/unreachable instructions. And add ASM_UACCESS_BEGIN
> and ASM_UACCESS_END macros to be used in inline assembly code to
> annotate UACCESS enable and UACCESS disable instructions.
>
> Signed-off-by: Christophe Leroy <christophe.leroy@...roup.eu>
> ---
> include/linux/objtool.h | 14 +++++++++++++
> tools/objtool/check.c | 44 +++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 58 insertions(+)
>
> diff --git a/include/linux/objtool.h b/include/linux/objtool.h
> index 03f82c2c2ebf..d8fde4158a40 100644
> --- a/include/linux/objtool.h
> +++ b/include/linux/objtool.h
> @@ -57,6 +57,18 @@
> ".long 998b - .\n\t" \
> ".popsection\n\t"
>
> +#define ASM_UACCESS_BEGIN \
> + "998:\n\t" \
> + ".pushsection .discard.uaccess_begin\n\t" \
> + ".long 998b - .\n\t" \
> + ".popsection\n\t"
> +
> +#define ASM_UACCESS_END \
> + "998:\n\t" \
> + ".pushsection .discard.uaccess_end\n\t" \
> + ".long 998b - .\n\t" \
> + ".popsection\n\t"
> +
> #else /* __ASSEMBLY__ */
Yeah, this can work. Josh wanted a more generic hints infra, but I'm not
sure we should make you do that work now.
Powered by blists - more mailing lists