* offsetof() backports for clang-16+
@ 2023-01-16 4:46 Nathan Chancellor
2023-01-22 14:20 ` Greg Kroah-Hartman
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2023-01-16 4:46 UTC (permalink / raw)
To: Greg Kroah-Hartman, Sasha Levin
Cc: stable, llvm, Nick Desaulniers, YingChi Long, Borislav Petkov,
Steven Rostedt
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: offsetof() backports for clang-16+
2023-01-16 4:46 offsetof() backports for clang-16+ Nathan Chancellor
@ 2023-01-22 14:20 ` Greg Kroah-Hartman
0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2023-01-22 14:20 UTC (permalink / raw)
To: Nathan Chancellor
Cc: Sasha Levin, stable, llvm, Nick Desaulniers, YingChi Long,
Borislav Petkov, Steven Rostedt
On Sun, Jan 15, 2023 at 09:46:36PM -0700, Nathan Chancellor wrote:
> 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.
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-22 14:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-16 4:46 offsetof() backports for clang-16+ Nathan Chancellor
2023-01-22 14:20 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox