All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-tip-commits@vger.kernel.org,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>, x86 <x86@kernel.org>
Subject: Re: [tip: objtool/core] x86/insn: Support big endian cross-compiles
Date: Wed, 14 Oct 2020 23:24:26 -0700	[thread overview]
Message-ID: <CAP-5=fUoSGy3NAzTSbF3YLEPABSs7oPsxLkCx36XkEzzm341yw@mail.gmail.com> (raw)
In-Reply-To: <20201014162859.987d5f71f5e5456ffb812abc@kernel.org>

On Wed, Oct 14, 2020 at 12:29 AM Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> On Mon, 12 Oct 2020 10:39:49 -0500
> Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>
> > On Mon, Oct 12, 2020 at 09:12:36AM +0900, Masami Hiramatsu wrote:
> > > On Sat, 10 Oct 2020 12:44:15 -0500
> > > Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> > >
> > > > On Fri, Oct 09, 2020 at 10:49:21PM +0200, Borislav Petkov wrote:
> > > > > On Fri, Oct 09, 2020 at 10:38:22PM +0200, Peter Zijlstra wrote:
> > > > > > On Wed, Oct 07, 2020 at 04:20:19PM -0000, tip-bot2 for Martin Schwidefsky wrote:
> > > > > > > The following commit has been merged into the objtool/core branch of tip:
> > > > > > >
> > > > > > > Commit-ID:     2a522b53c47051d3bf98748418f4f8e5f20d2c04
> > > > > > > Gitweb:        https://git.kernel.org/tip/2a522b53c47051d3bf98748418f4f8e5f20d2c04
> > > > > > > Author:        Martin Schwidefsky <schwidefsky@de.ibm.com>
> > > > > > > AuthorDate:    Mon, 05 Oct 2020 17:50:31 +02:00
> > > > > > > Committer:     Josh Poimboeuf <jpoimboe@redhat.com>
> > > > > > > CommitterDate: Tue, 06 Oct 2020 09:32:29 -05:00
> > > > > > >
> > > > > > > x86/insn: Support big endian cross-compiles
> > > > > > >
> > > > > > > x86 instruction decoder code is shared across the kernel source and the
> > > > > > > tools. Currently objtool seems to be the only tool from build tools needed
> > > > > > > which breaks x86 cross compilation on big endian systems. Make the x86
> > > > > > > instruction decoder build host endianness agnostic to support x86 cross
> > > > > > > compilation and enable objtool to implement endianness awareness for
> > > > > > > big endian architectures support.
> > > > > > >
> > > > > > > Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
> > > > > > > Co-developed-by: Vasily Gorbik <gor@linux.ibm.com>
> > > > > > > Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
> > > > > > > Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
> > > > > > > Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
> > > > > >
> > > > > > This commit breaks the x86 build with CONFIG_X86_DECODER_SELFTEST=y.
> > > > > >
> > > > > > I've asked Boris to truncate tip/objtool/core.
> > > > >
> > > > > Yeah, top 4 are gone until this is resolved.
> > > >
> > > > Masami, I wonder if we even need these selftests anymore?  Objtool
> > > > already decodes the entire kernel.
> > >
> > > No, they have different roles. The selftest checks if the decoder
> > > works correctly by comparing with the output of objdump.
> > >
> > > As far as I can see, the objtool relies on the sanity of the decoder
> > > (it trusts the output of the decoder).
> >
> > Ok.  I wonder if we should move the decoder selftest to the 'tools'
> > subdirectory.
>
> It is in the arch/x86/tools, so it is already in a kind of tools :)
> But yeah, it was considered to be used only on x86. But if someone
> start trying to run it on non-x86, cross compiling, we need to
> reconsider that.
>
> Thank you,
>
> --
> Masami Hiramatsu <mhiramat@kernel.org>

There is undefined behavior that is present in the x86 insn.c code as
described in:
https://lore.kernel.org/lkml/20190724184512.162887-4-nums@google.com/

I resent this patch fixing other potential undefined behavior:
https://lore.kernel.org/lkml/20201015062148.1437894-1-irogers@google.com/T/#t

The misaligned loads will likely break on anything non-x86.

Thanks,
Ian

  reply	other threads:[~2020-10-15  6:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07 16:20 [tip: objtool/core] x86/insn: Support big endian cross-compiles tip-bot2 for Martin Schwidefsky
2020-10-09 20:38 ` Peter Zijlstra
2020-10-09 20:49   ` Borislav Petkov
2020-10-10 14:02     ` Vasily Gorbik
2020-10-11 14:40       ` Borislav Petkov
2020-10-12  0:02       ` Masami Hiramatsu
2020-10-10 17:44     ` Josh Poimboeuf
2020-10-12  0:12       ` Masami Hiramatsu
2020-10-12 15:39         ` Josh Poimboeuf
2020-10-14  7:28           ` Masami Hiramatsu
2020-10-15  6:24             ` Ian Rogers [this message]
2020-11-03 19:35             ` Vasily Gorbik
2020-11-03 19:35               ` [PATCH 1/1] x86/tools: Use tools headers for instruction decoder selftests Vasily Gorbik
2020-11-04  9:11                 ` kernel test robot
2020-11-04  9:11                   ` kernel test robot
2020-11-04  9:18                   ` Vasily Gorbik
2020-11-06  2:24                     ` Masami Hiramatsu
2020-11-06  2:24                       ` Masami Hiramatsu
2020-11-06 17:52                       ` Josh Poimboeuf
2020-11-06 17:52                         ` Josh Poimboeuf
2020-11-04 11:54                 ` kernel test robot
2020-11-04 11:54                   ` kernel test robot
2021-01-18 10:13 [tip: objtool/core] x86/insn: Support big endian cross-compiles tip-bot2 for Martin Schwidefsky

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='CAP-5=fUoSGy3NAzTSbF3YLEPABSs7oPsxLkCx36XkEzzm341yw@mail.gmail.com' \
    --to=irogers@google.com \
    --cc=bp@alien8.de \
    --cc=gor@linux.ibm.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=peterz@infradead.org \
    --cc=schwidefsky@de.ibm.com \
    --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.