linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"the arch/x86 maintainers" <x86@kernel.org>
Subject: Re: [GIT pull] x86/urgent for v5.15-rc3
Date: Sun, 26 Sep 2021 10:21:18 -0700	[thread overview]
Message-ID: <CAHk-=wj=C2W1VmW1RHU8ErvSjVF2Y=r9uWrnMCiz-U_aa8Dorw@mail.gmail.com> (raw)
In-Reply-To: <163265189517.178609.6605494600326137493.tglx@xen13>

On Sun, Sep 26, 2021 at 3:30 AM Thomas Gleixner <tglx@linutronix.de> wrote:
>
>  - Prevent undefined behaviour to the potential unaligned accesss in the
>    instroction decoder library.

What a horrible fix that is.

This is why we have "get_unaligned()". It might use memcpy()
internally on some architectures (it doesn't really any more - Arnd
cleaned it all up and now it uses a pointer that is marked unaligned),
but more importantly it explains _why_ something is done the way it's
done, rather than be an odd memcpy().

Oh well. The memcpy works, and compilers will do the right thing for
it, but it's ugly.

In this case, it's actually *doubly* ugly, though, because we
literally have functions to "load unaligned data in little-endian
format".

So instead of doing a "memcpy()", followed by a magic special macro
that does a "switch (sizeof(t))" and does a "le*_to_cpu()" on the
result, the code could  literally have used the functions that do this
all for them.

Ugh. Pulled. But it's ugly.

           Linus

  reply	other threads:[~2021-09-26 17:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26 10:30 [GIT pull] irq/urgent for v5.15-rc3 Thomas Gleixner
2021-09-26 10:30 ` [GIT pull] timers/urgent " Thomas Gleixner
2021-09-26 17:27   ` pr-tracker-bot
2021-09-26 10:30 ` [GIT pull] x86/urgent " Thomas Gleixner
2021-09-26 17:21   ` Linus Torvalds [this message]
2021-09-26 18:15     ` Borislav Petkov
2021-09-26 19:10       ` Linus Torvalds
2021-09-28 17:56         ` Borislav Petkov
2021-09-28 20:13           ` Linus Torvalds
2021-09-28 20:41             ` Borislav Petkov
2021-09-28 22:44               ` Linus Torvalds
2021-09-29 18:10                 ` [PATCH] x86/insn: Use get_unaligned() instead of memcpy() Borislav Petkov
2021-09-30  0:00                   ` Masami Hiramatsu
2021-10-04  9:48                   ` [tip: x86/misc] " tip-bot2 for Borislav Petkov
2021-10-06 10:02                   ` tip-bot2 for Borislav Petkov
2021-09-26 17:27   ` [GIT pull] x86/urgent for v5.15-rc3 pr-tracker-bot
2021-09-26 17:27 ` [GIT pull] irq/urgent " pr-tracker-bot

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='CAHk-=wj=C2W1VmW1RHU8ErvSjVF2Y=r9uWrnMCiz-U_aa8Dorw@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=linux-kernel@vger.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;
as well as URLs for NNTP newsgroup(s).