lkml.org 
[lkml]   [2023]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH -next V17 1/7] compiler_types.h: Add __noinstr_section() for noinstr
On Wed, Feb 22, 2023 at 11:56 AM <guoren@kernel.org> wrote:
>
> From: Lai Jiangshan <laijs@linux.alibaba.com>
>
> Using __noinstr_section() doesn't automatically disable all
> instrumentations on the section. Inhibition for some
> instrumentations requires extra code. I.E. KPROBES explicitly
> avoids instrumenting on .noinstr.text.
>
> Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
> Suggested-by: Peter Zijlstra <peterz@infradead.org>
> Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
> Reviewed-by: Kees Cook <keescook@chromium.org>
> Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
> Tested-by: Jisheng Zhang <jszhang@kernel.org>
> Tested-by: Guo Ren <guoren@kernel.org>
> Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
> Signed-off-by: Guo Ren <guoren@kernel.org>

Hello

The change has been made upstream as a part of the commit
2b5a0e425e6e(objtool/idle: Validate __cpuidle code as noinstr).

https://lore.kernel.org/r/20230112195540.373461409@infradead.org

Thanks
Lai

> ---
> include/linux/compiler_types.h | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
> index 7c1afe0f4129..0a2ca5755be7 100644
> --- a/include/linux/compiler_types.h
> +++ b/include/linux/compiler_types.h
> @@ -231,12 +231,19 @@ struct ftrace_likely_data {
> #define __no_sanitize_or_inline __always_inline
> #endif
>
> -/* Section for code which can't be instrumented at all */
> -#define noinstr \
> - noinline notrace __attribute((__section__(".noinstr.text"))) \
> - __no_kcsan __no_sanitize_address __no_profile __no_sanitize_coverage \
> +/*
> + * Using __noinstr_section() doesn't automatically disable all instrumentations
> + * on the section. Inhibition for some instrumentations requires extra code.
> + * I.E. KPROBES explicitly avoids instrumenting on .noinstr.text.
> + */
> +#define __noinstr_section(section) \
> + noinline notrace __section(section) __no_profile \
> + __no_kcsan __no_sanitize_address __no_sanitize_coverage \
> __no_sanitize_memory
>
> +/* Section for code which can't be instrumented at all */
> +#define noinstr __noinstr_section(".noinstr.text")
> +
> #endif /* __KERNEL__ */
>
> #endif /* __ASSEMBLY__ */
> --
> 2.36.1
>

\
 
 \ /
  Last update: 2023-03-27 01:13    [W:0.191 / U:1.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site