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 <[email protected]> > --- > 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.
