All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	live-patching@vger.kernel.org, Michal Marek <mmarek@suse.cz>,
	Peter Zijlstra <peterz@infradead.org>,
	Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andi Kleen <andi@firstfloor.org>, Pedro Alves <palves@redhat.com>,
	Namhyung Kim <namhyung@gmail.com>,
	Bernd Petrovitsch <bernd@petrovitsch.priv.at>,
	Chris J Arges <chris.j.arges@canonical.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jiri Slaby <jslaby@suse.cz>,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Subject: Re: [PATCH v17 4/9] x86/objtool: Add STACK_FRAME_NON_STANDARD macro
Date: Thu, 25 Feb 2016 08:51:49 +0100	[thread overview]
Message-ID: <20160225075149.GA2354@gmail.com> (raw)
In-Reply-To: <6b5098f327af4dfc11ad9bcdc274b0c8f0e2b2e5.1456331595.git.jpoimboe@redhat.com>


* Josh Poimboeuf <jpoimboe@redhat.com> wrote:

> Add a new objtool ignore macro, STACK_FRAME_NON_STANDARD, which can be
> used to tell objtool to skip validation of a function.
> 
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> ---
>  MAINTAINERS                   |  1 +
>  arch/x86/kernel/vmlinux.lds.S |  5 ++++-
>  include/linux/objtool.h       | 22 ++++++++++++++++++++++
>  3 files changed, 27 insertions(+), 1 deletion(-)
>  create mode 100644 include/linux/objtool.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7c7cebd..43a940e 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -7782,6 +7782,7 @@ OBJTOOL
>  M:	Josh Poimboeuf <jpoimboe@redhat.com>
>  S:	Supported
>  F:	tools/objtool/
> +F:	include/linux/objtool.h
>  
>  OMAP SUPPORT
>  M:	Tony Lindgren <tony@atomide.com>
> diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
> index 92dc211..6038fe0 100644
> --- a/arch/x86/kernel/vmlinux.lds.S
> +++ b/arch/x86/kernel/vmlinux.lds.S
> @@ -343,7 +343,10 @@ SECTIONS
>  
>  	/* Sections to be discarded */
>  	DISCARDS
> -	/DISCARD/ : { *(.eh_frame) }
> +	/DISCARD/ : {
> +		*(.eh_frame)
> +		*(__objtool_ignore_*)
> +	}
>  }
>  
>  
> diff --git a/include/linux/objtool.h b/include/linux/objtool.h
> new file mode 100644
> index 0000000..cce9d67
> --- /dev/null
> +++ b/include/linux/objtool.h

So I think this should really be in asm/frame.h, not in an objtool specific 
header.

> @@ -0,0 +1,22 @@
> +#ifndef _LINUX_OBJTOOL_H
> +#define _LINUX_OBJTOOL_H
> +
> +#ifdef CONFIG_STACK_VALIDATION
> +/*
> + * This C macro tells objtool to ignore the function when doing stack metadata
> + * validation.  It should only be used in special cases where you're 100% sure
> + * it won't affect the reliability of frame pointers and kernel stack traces.
> + *
> + * For more information, see tools/objtool/Documentation/stack-validation.txt.
> + */
> +#define STACK_FRAME_NON_STANDARD(_func) \
> +	static void __used __section(__objtool_ignore_func) \
> +		*__objtool_ignore_func_##_func = _func

Likewise, this section should be named __func_non_standard_stack_frame or so, with 
objtool one (but not the only possible) consumer of it.

> +#else /* !CONFIG_STACK_VALIDATION */
> +
> +#define STACK_FRAME_NON_STANDARD(_func)
> +
> +#endif /* CONFIG_STACK_VALIDATION */
> +
> +#endif /* _LINUX_OBJTOOL_H */

The CONFIG_STACK_VALIDATION dependency can be kept.

Thanks,

	Ingo

  reply	other threads:[~2016-02-25  7:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24 16:36 [PATCH v17 0/9] Compile-time stack metadata validation Josh Poimboeuf
2016-02-24 16:36 ` Josh Poimboeuf
2016-02-24 16:36 ` [PATCH v17 1/9] x86/objtool: " Josh Poimboeuf
2016-02-24 16:36 ` [PATCH v17 2/9] x86/objtool: Add CONFIG_STACK_VALIDATION option Josh Poimboeuf
2016-02-24 16:36 ` [PATCH v17 3/9] x86/objtool: Enable objtool on x86_64 Josh Poimboeuf
2016-02-24 16:36 ` [PATCH v17 4/9] x86/objtool: Add STACK_FRAME_NON_STANDARD macro Josh Poimboeuf
2016-02-25  7:51   ` Ingo Molnar [this message]
2016-02-25 20:26     ` Josh Poimboeuf
2016-02-24 16:36 ` [PATCH v17 5/9] x86/objtool: Add directory and file whitelists Josh Poimboeuf
2016-02-24 16:36 ` [PATCH v17 6/9] x86/xen: Add xen_cpuid() to objtool whitelist Josh Poimboeuf
2016-02-25  7:54   ` Ingo Molnar
2016-02-24 16:36 ` [PATCH v17 7/9] bpf: Add __bpf_prog_run() " Josh Poimboeuf
2016-02-24 16:36 ` [PATCH v17 8/9] sched: Add __schedule() " Josh Poimboeuf
2016-02-24 16:36 ` [PATCH v17 9/9] x86/kprobes: Add kretprobe_trampoline() " Josh Poimboeuf
2016-02-25  8:02 ` [PATCH v17 0/9] Compile-time stack metadata validation Ingo Molnar
2016-02-25  8:02   ` Ingo Molnar
2016-02-25 17:04   ` Josh Poimboeuf
2016-02-25 17:04     ` Josh Poimboeuf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160225075149.GA2354@gmail.com \
    --to=mingo@kernel.org \
    --cc=acme@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=bernd@petrovitsch.priv.at \
    --cc=bp@alien8.de \
    --cc=chris.j.arges@canonical.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mmarek@suse.cz \
    --cc=namhyung@gmail.com \
    --cc=palves@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.