Another month down! Feels like I just wrote the March 2021 post… but I suppose that is what happens when your project moves super quickly :)
Linux kernel patches
-
[PATCH] ACPI / CPPC: Replace cppc_attr with kobj_attribute
: I discovered this issue as part of my testing of Sami Tolvanen’s Control Flow Integrity series (more on that below). There are probably many more of these lurking because this pattern is hard to spot without runtime testing. As I have time amongst all of the other issues and such, I will be testing the x86 variant of CFI on several different servers, trying to flush out all of the different issues there. -
[PATCH] block: Disable -Walign-mismatch for blk-mq.c
: A new warning in clang pointed this out. Unfortunately, the alignment mismatch is expected so I initially sent this patch silencing the warning but it seems like there might be a better solution. -
[PATCH] MIPS: generic: Update node names to avoid unit addresses
: The latest version of U-Boot caused all generic MIPS configurations to stop building, which disrupted my local testing. To get back to a working state, I send this patch. -
[PATCH] crypto: arm/curve25519 - Move '.fpu' after '.arch'
: Debian’s clang, which we use for testing in our continuous-integration, includes an out of tree patch that turns off NEON in armv7 by default, causing a build error when trying to build ARCH=arm allmodconfig. Moving the.fpu
after.arch
fixes the issue because.arch
overrides the previous.fpu
directive. -
[PATCH] arm64: alternatives: Move length validation in alternative_{insn,endif}
: More integrated assembler fixes. This is similar to another fix that went into the tree last year, this should make it so we never see this issue again, hopefully… -
[PATCH 1/2] x86/events/amd/iommu: Fix sysfs type mismatch
and[PATCH 2/2] perf/amd/uncore: Fix sysfs type mismatch
: More type mismatches from CFI testing. These should have been found and fixed during commitebd19fc372e3
but it does not look like anyone has tested CFI on a more recent AMD CPU. -
[PATCH] drm/tegra: Fix shift overflow in tegra_shared_plane_atomic_update
: Just a small clang warning patch. -
[PATCH] kbuild: Add $(KBUILD_HOSTLDFLAGS) to 'has_libelf' test
: During a regular kernel build, compiling and linking happen in two separate phases, using the variables$(CC)
and$(LD)
, so it is easy to ensure that you are using only the tools that you want. An ultimate goal of ClangBuiltLinux is to be able to build the kernel in an environment free of GCC and binutils and these two variables make it easy to ensure that happens. However, during the host tools building, compiling and linking happens through only the compiler, like a more standard userspace project, and that means that the compiler’s default linker is used, unless-fuse-ld=
is provided via the command line. If a project is not able to change their default linker but still wants to test in a hermetic environment,-fuse-ld=lld
needs to work properly but without this patch, it does not. This came up during testing from Google, where they have a Docker image that only includes the tools needed for a kernel build so if there is a call to a tool that does not exist, the build errors. -
[PATCH] powerpc: Avoid clang uninitialized warning in __get_user_size_allowed
: Clang’s static analysis pointed out a false positive, which was fixed in one place but not another, causing a build failure in our CI due to-Werror
inarch/powerpc
. -
[PATCH] Makefile: Move -Wno-unused-but-set-variable out of GCC only block
: Clang’s implementation of this warning is coming down the pipeline so this disables it like GCC in a default build. Ideally, we want to enable rather than disable warnings but this is a special case because it is also disabled for GCC by default. -
[PATCH] x86: Enable clang LTO for 32-bit as well
: LTO was merged in 5.12 for arm64 and x86_64. In my testing, I noticed that 32-bit x86 works fine and there is some interest in this.
Patch review and input
When possible, I link directly to my response but sometimes, the link is to the main post and my response can be seen inline.
-
Re: [PATCH 3/3] kbuild: fix false-positive modpost warning when all symbols are trimmed
-
Re: [PATCH v4 12/12] exec: Fix overlap of PAGE_ANON and PAGE_TARGET_1
-
Re: [PATCH v9] pgo: add clang's Profile Guided Optimization infrastructure
-
Re: [PATCH] KVM: x86: Fix implicit enum conversion goof in scattered reverse CPUID code
-
Re: [PATCH] stack: replace "o" output with "r" input constraint
Issue triage and reporting
A lot more issues in upstream LLVM this month and I ran into two regressions with external tools. Thankfully, those were quick to be resolved so testing could get back on track. As with previous months, the link is usually to the main post/issue and my input can be seen throughout.
-
mkimage regression when building ARCH=mips defconfig Linux kernel
-
inconsistent ORC unwind table entries in file: vmlinux in /scripts/sorttable vmlinux
-
undefined symbol: __compiletime_assert_177 in firmware/stratix10-rsu.o
-
"error: expected assembly-time absolute expression" in arch/arm64/kernel/entry.S
-
arch/arm64/kvm/perf.c:58:36: error: implicit declaration of function 'perf_num_counters'
-
Re: [PATCH 2/3] habanalabs: support legacy and new pll indexes
-
-Wsometimes-uninitialized in arch/powerpc/include/asm/uaccess.h
-
Re: [PATCH v7] powerpc/irq: Inline call_do_irq() and call_do_softirq()
-
[DebugInfo] Use variadic debug values to salvage BinOps and GEP instrs with non-const operands
-
Generalize getInvertibleOperand recurrence handling slightly
-
-Wconstant-conversion in drivers/platform/surface/surface_aggregator_registry.c
Tooling improvements
A little all over the place this month, no major work now that the continuous integration setup is stable and the other tools are working well.
-
buildroot: Check init.d action to avoid double version print out
-
Enable LLVM_IAS=1 for arm32 allmodconfig on android-mainline
Behind the scenes
Three things that were more behind the scenes this month:
-
ClangBuiltLinux did a bug scrub on two days, where we sat down in Google Meet and worked on a shared Google Doc to try and see if we could reproduce old issues. I think we ended up touching somewhere around 100 issues, closing several issues that are no longer relevant. This will allow us to stay focused and work through a clean backlog as we have time in the future. It is the balance of dealing with new issues while finding time to work on the old or getting more people involved with the project ;)
-
I did a lot of testing of the Control Flow Integrity series on both arm64 (which I mention above) and x86_64. Unfortunately, the x86_64 testing became moot when the x86 maintainers basically NAK’d the series in its current form. I will continue testing in May, hoping to tease out any failures so that those are all resolved by the time the series is ready for a new revision.
-
I received a BeagleV board as part of their beta program for the sake of testing clang built kernels on it. I messed around with it a little bit already, I will continue this in May.
Special thanks to:
- Google and the Linux Foundation for sponsoring my work!