stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <sashal@kernel.org>
Cc: stable@vger.kernel.org, llvm@lists.linux.dev,
	Nick Desaulniers <ndesaulniers@google.com>,
	YingChi Long <me@inclyc.cn>, Borislav Petkov <bp@alien8.de>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: offsetof() backports for clang-16+
Date: Sun, 15 Jan 2023 21:46:36 -0700	[thread overview]
Message-ID: <Y8TWrJpb6Vn6E4+v@dev-arch.thelio-3990X> (raw)

[-- Attachment #1: Type: text/plain, Size: 1273 bytes --]

Hi Greg and Sasha,

Clang 16 (current main, next major release) errors when offsetof() has a
type defintion in it, in response to language in newer C standards
stating it is undefined behavior.

https://github.com/llvm/llvm-project/commit/e327b52766ed497e4779f4e652b9ad237dfda8e6
https://reviews.llvm.org/D133574

While this might be eventually demoted to just a warning, the kernel has
already cleaned up places that had this construct, so we can apply them
to the stable trees and avoid the issue altogether.

Please find attached mbox files for all supported stable trees, which
fix up the relevant instances for each tree using the upstream commits:

55228db2697c ("x86/fpu: Use _Alignof to avoid undefined behavior in TYPE_ALIGN")
09794a5a6c34 ("tracing: Use alignof__(struct {type b;}) instead of offsetof()")

The fpu commit uses _Alignof, which as far as I can tell was only
supported in GCC 4.7.0+. This is not a problem for mainline due to
requiring GCC 5.1.0+ but it could be relevant for old trees like 4.14,
which have an older minimum supported version. I hope people are not
using ancient compilers like that but I suppose if they are using 4.14,
they might just be stuck with old software...

If there are any issues or comments, please let me know.
Nathan

[-- Attachment #2: 4.14.mbox --]
[-- Type: application/mbox, Size: 2364 bytes --]

[-- Attachment #3: 4.19.mbox --]
[-- Type: application/mbox, Size: 2364 bytes --]

[-- Attachment #4: 5.4.mbox --]
[-- Type: application/mbox, Size: 2363 bytes --]

[-- Attachment #5: 5.10.mbox --]
[-- Type: application/mbox, Size: 3900 bytes --]

[-- Attachment #6: 5.15.mbox --]
[-- Type: application/mbox, Size: 3916 bytes --]

[-- Attachment #7: 6.1.mbox --]
[-- Type: application/mbox, Size: 2319 bytes --]

             reply	other threads:[~2023-01-16  4:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16  4:46 Nathan Chancellor [this message]
2023-01-22 14:20 ` offsetof() backports for clang-16+ Greg Kroah-Hartman

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=Y8TWrJpb6Vn6E4+v@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=bp@alien8.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=llvm@lists.linux.dev \
    --cc=me@inclyc.cn \
    --cc=ndesaulniers@google.com \
    --cc=rostedt@goodmis.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.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).