public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Marco Elver <elver@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Alexander Potapenko <glider@google.com>,
	kasan-dev <kasan-dev@googlegroups.com>,
	LKML <linux-kernel@vger.kernel.org>,
	the arch/x86 maintainers <x86@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	ndesaulniers@google.com
Subject: Re: [PATCH -tip v3 1/2] kcov: Make runtime functions noinstr-compatible
Date: Wed, 17 Jun 2020 17:19:28 +0200	[thread overview]
Message-ID: <20200617151928.GA577403@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20200617144949.GA576905@hirez.programming.kicks-ass.net>

On Wed, Jun 17, 2020 at 04:49:49PM +0200, Peter Zijlstra wrote:

> I had the below, except of course that yields another objtool
> complaint, and I was still looking at that.

This cures it.

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 5fbb90a80d239..fe0d6f1b28d7c 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2746,7 +2746,7 @@ int check(const char *_objname, bool orc)
 
 	INIT_LIST_HEAD(&file.insn_list);
 	hash_init(file.insn_hash);
-	file.c_file = find_section_by_name(file.elf, ".comment");
+	file.c_file = !vmlinux && find_section_by_name(file.elf, ".comment");
 	file.ignore_unreachables = no_unreachable;
 	file.hints = false;


> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> index af75109485c26..a7d1570905727 100644
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c
> @@ -690,13 +690,13 @@ struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s)
>  		(struct bad_iret_stack *)__this_cpu_read(cpu_tss_rw.x86_tss.sp0) - 1;
>  
>  	/* Copy the IRET target to the temporary storage. */
> -	memcpy(&tmp.regs.ip, (void *)s->regs.sp, 5*8);
> +	__memcpy(&tmp.regs.ip, (void *)s->regs.sp, 5*8);
>  
>  	/* Copy the remainder of the stack from the current stack. */
> -	memcpy(&tmp, s, offsetof(struct bad_iret_stack, regs.ip));
> +	__memcpy(&tmp, s, offsetof(struct bad_iret_stack, regs.ip));
>  
>  	/* Update the entry stack */
> -	memcpy(new_stack, &tmp, sizeof(tmp));
> +	__memcpy(new_stack, &tmp, sizeof(tmp));
>  
>  	BUG_ON(!user_mode(&new_stack->regs));
>  	return new_stack;
> diff --git a/arch/x86/lib/memcpy_64.S b/arch/x86/lib/memcpy_64.S
> index 56b243b14c3a2..bbcc05bcefadb 100644
> --- a/arch/x86/lib/memcpy_64.S
> +++ b/arch/x86/lib/memcpy_64.S
> @@ -8,6 +8,8 @@
>  #include <asm/alternative-asm.h>
>  #include <asm/export.h>
>  
> +.pushsection .noinstr.text, "ax"
> +
>  /*
>   * We build a jump to memcpy_orig by default which gets NOPped out on
>   * the majority of x86 CPUs which set REP_GOOD. In addition, CPUs which
> @@ -184,6 +186,8 @@ SYM_FUNC_START_LOCAL(memcpy_orig)
>  	retq
>  SYM_FUNC_END(memcpy_orig)
>  
> +.popsection
> +
>  #ifndef CONFIG_UML
>  
>  MCSAFE_TEST_CTL

  reply	other threads:[~2020-06-17 15:20 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-05  8:28 [PATCH -tip v3 1/2] kcov: Make runtime functions noinstr-compatible Marco Elver
2020-06-05  8:28 ` [PATCH -tip v3 2/2] kcov: Unconditionally add -fno-stack-protector to compiler options Marco Elver
2020-06-05 16:50   ` Nick Desaulniers
2020-06-05 10:57 ` [PATCH -tip v3 1/2] kcov: Make runtime functions noinstr-compatible Dmitry Vyukov
2020-06-05 12:03   ` Peter Zijlstra
2020-06-05 13:25     ` Andrey Konovalov
2020-06-07  9:37       ` Dmitry Vyukov
2020-06-08  7:48         ` Marco Elver
2020-06-08  7:57           ` Dmitry Vyukov
2020-06-08 11:01             ` Peter Zijlstra
2020-06-11 21:55               ` Peter Zijlstra
2020-06-11 21:58                 ` Peter Zijlstra
2020-06-12 11:34                   ` Peter Zijlstra
2020-06-12  4:04                 ` Dmitry Vyukov
2020-06-12 11:49                   ` Marco Elver
2020-06-13 17:24                     ` Dmitry Vyukov
2020-06-15  7:53                       ` Marco Elver
2020-06-15 14:29                         ` Peter Zijlstra
2020-06-15 14:35                           ` Peter Zijlstra
2020-06-15 14:53                           ` Marco Elver
2020-06-15 15:03                             ` Peter Zijlstra
2020-06-15 15:20                               ` Peter Zijlstra
2020-06-17 14:32                                 ` Marco Elver
2020-06-17 14:49                                   ` Peter Zijlstra
2020-06-17 15:19                                     ` Peter Zijlstra [this message]
2020-06-17 15:19                                     ` Marco Elver
2020-06-17 15:55                                       ` Peter Zijlstra
2020-06-17 16:36                                         ` Peter Zijlstra
2020-06-17 18:06                                           ` Marco Elver
2020-06-15 14:54                         ` Peter Zijlstra

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=20200617151928.GA577403@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@google.com \
    --cc=bp@alien8.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=jpoimboe@redhat.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=paulmck@kernel.org \
    --cc=tglx@linutronix.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox