Linux kernel patches
-
ANDROID: sched: Gate sched_stat tracepoint exports on CONFIG_SCHEDSTATS
: One of those instances where a tangential change in the Android trees broke our continuous integration. Our CI tests some 32-bit ARM configurations because certain Android OEMs care about them but these configs are not tested by the actual Android team, meaning we find breakage that they do not. -
[PATCH net-next] net: ks8851: Make ks8851_read_selftest() return void
:clang
implemented GCC’s-Wunused-but-set-variable
and this instance was found by Intel’s kernel test robot. Rather simple fix but it is important to fix warnings as they crop up so that the build stays as clean as possible so that the real issues are easily visible. -
[PATCH net-next] net: ethernet: rmnet: Restructure if checks to avoid uninitialized warning
: Uninitialized variable warnings are always worrisome because using an uninitialized variable results in undefined behavior and could be a security problem if the attacker were able to control or read the contents. In this particular instance, it was just that clang could not understand that the variable was always initialized because of how the code was structure so I rearranged it to make it cleaner to both humans and the compiler. -
[PATCH] btrfs: Remove total_data_size variable in btrfs_batch_insert_items()
: btrfs turns on some extra warnings for their code, known in the kernel asW=1
because of the variable that is passed tomake
. This cleans up one of those instances, which will be visible in a normal build. -
[PATCH] scsi: elx: efct: Do not use id uninitialized in efct_lio_setup_session()
: Unlike the uninitialized warning above, this one is legitimate and it shows up in a debug print so it is important to get a proper value. -
[PATCH] scsi: elx: efct: Eliminate unnecessary boolean check in efct_hw_command_cancel()
: A fairly uninteresting warning fromclang
but it can be a bug occasionally so it is important to clean them up. -
[PATCH] scripts/min-tool-version.sh: Raise minimum clang version to 13.0.0 for s390
: The s390 folks had their compiler team implement support for even/odd register pair in LLVM, which means that older versions of LLVM are broken in non-obvious ways, so we codify this requirement before the build can even start. This is unfortunate because LLVM 13.0.0 is still in development at this point but using the tip of tree versions of LLVM is not all that scary because of LLVM’s aggressive “revert to green” policy, meaning the tree is intended to be “release worthy” at any point. -
[PATCH] scsi: lpfc: Reduce scope of uuid in lpfc_queuecommand()
: A small build error that I noticed in a few of the configurations that I test. Unfortunately, this was not accepted because it was fixed by just declaring the variable outside of theCONFIG_SCSI_LPFC_DEBUG_FS
at the top of the function. -
[PATCH net-next] net/mlx5: Use cpumask_available() in mlx5_eq_create_generic()
: Yet another instance of-Wpointer-bool-conversion
, which happens in certain configurations. This was solved through a helper function in the early days of ClangBuiltLinux so we use that again here. -
[PATCH] KVM: PPC: Book3S HV: Workaround high stack usage with clang
: This warning has been around since the beginning of the year or so, which was starting to become annoying for a few parties, including the kernel test robot. This is now fixed in LLVM 13.0.0 but this workaround still buys us a decent amount of stack space so it is probably worth keeping around for a while. -
[PATCH] mailbox: imx: Avoid using val uninitialized in imx_mu_isr()
: Switch statements withdefault
cases that do not do anything sort of defeats the purpose of thedefault
case in my opinion, asclang
points out here, so we avoid the warning and make it obvious to the developer that this switch statement will need to be updated. -
[PATCH 1/2] ACPI: bgrt: Fix CFI violation
: My girlfriend had a laptop lying around that she was not using anymore so I threw an SSD in it and installed Linux on it for testing. Virtualized testing is nice because it scales really well but it is no replacement for running on real hardware to test various device specific drivers. In this case, I found an issue in an ACPI table driver with Control Flow Integrity, which was rather easy to fix, and now allows the computer to boot with CFI enabled in enforcing mode. -
[PATCH 4.4 to 4.19] Makefile: Move -Wno-unused-but-set-variable out of GCC only block
: A stable specific backport of an upstream patch that I sent so that there are not new warnings for downstream users such as Android, which is where I discovered this. -
ANDROID: Add CONFIG_LLD_VERSION
andUPSTREAM: x86, lto: Pass -stack-alignment only on LLD < 13.0.0
: An Android specific backport so that our continuous integration would stay building with tip of tree LLVM. The Android LLVM team picks a particular revision of LLVM then stays on that for a few months, just cherry-picking reverts and features as needed so they will not run into this for a bit but it is better to get ahead of the curve. After all, that is the entire point of this project :) -
[PATCH] ALSA: usb-audio: scarlett2: Fix for loop increment in scarlett2_usb_get_config
: This bug was rather fun for me as I learned a bit about C that I did not know. Casting an increment does not do anything because a cast is an rvalue and the increment operator only works on lvalues. I did not do very well in my “Principles of Programming Languages” class before switching degrees but I do remember that distinction. This patch went through quite a few revisions but it did get picked up eventually. -
[PATCH net-next] net: sparx5: Do not use mac_addr uninitialized in mchp_sparx5_probe()
: More and more uninitialized warnings :( unfortunately, GCC does not warn about uninitialized variables in the kernel after commit78a5255ffb6a
(“Stop the ad-hoc games with -Wno-maybe-initialized”) because GCC does its variable initiailization analysis after inlining, which can be somewhat confusing at different optimization levels.clang
’s analysis happens much easier, which makes it a little dumber at times, but it also makes it a little more reliable when it comes to stack variables withif
andswitch
statements in my experience.
LLVM patches
[BitCode] Add noprofile to getAttrFromCode()
: A latent bug in LLVM was exposed by a prior change that we needed for the kernel, resulting in broken LTO and CFI builds so I fixed it up with a simple patch and test.
Patch review and input
For the next sections, I link directly to my response when possible but there are times where the link is to the main post and my response can be seen inline.
-
Re: [PATCH v3 16/16] objtool,x86: Rewrite retpoline thunk calls
-
Re: [PATCH RFC] x86: remove toolchain check for X32 ABI capability
-
Update to Linux 5.12.9 and add missing packages on Archlinux/Manjaro
-
Re: [PATCH] platform/x86: dell-wmi-sysman/think-lmi: Make fw_attr_class global static
-
Re: [PATCH v3] scsi: ufs: Fix a possible use before initialization case
-
Re: [PATCH] x86/Makefile: make -stack-alignment conditional on LLD < 13.0.0
-
Re: [PATCH v2 1/1] x86/Makefile: make -stack-alignment conditional on LLD < 13.0.0
-
Re: [PATCH 1/1] Makefile: Pass -warn-stack-size only on LLD < 13.0.0
-
Re: [PATCH rdma-next v2 00/15] Reorganize sysfs file creation for struct ib_devices
-
Re: [PATCH v2] kallsyms: strip LTO suffixes from static functions
Issue triage and reporting
-
Re: drivers/net/ethernet/micrel/ks8851_common.c:995:6: warning: variable 'ret' set but not used
-
x86_64 allmodconfig + CONFIG_LTO_CLANG_THIN=y compile time regression
-
ld.lld segmentation fault for CONFIG_X86_X32 check with binutils master branch
-
llvm-objcopy produces corrupted .debug_str for elf32-x86-64 (X32 ABI) emulation (Z_DATA_ERROR)
-
Re: [PATCH v1 2/3] scsi: ufs: Optimize host lock on transfer requests send/compl paths
-
Re: [PATCH v3 16/16] objtool,x86: Rewrite retpoline thunk calls
-
Re: [PATCH v9 21/31] elx: efct: Hardware IO and SGL initialization
-
[InstrProfiling] Make __profd_ unconditionally private for ELF
-
Re: [PATCH 2/2] arm64: insn: move AARCH64_INSN_SIZE into <asm/insn.h>
-
Re: [PATCH v4 1/2] media: rc: new driver for USB-UIRT device
-
Re: [PATCH v8 4/6] KVM: PPC: Book3S HV: Nested support in H_RPT_INVALIDATE
-
LLVM bb1dc876ebb8a2eef38d5183d00c2db1437f1c91 breaks arm64 builds
-
Re: linux-next: build failure after merge of the net-next tree
-
Hexagon backend crash in drivers/md/persistent-data/dm-bitset.c
-
Re: [PATCH v15 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing
Tooling improvements
-
kernel/build.sh: Fix patch application with two PGO kernel runs
-
README.md: Clarify that latest version of distribution should be used whenever possible
-
check_logs.py: Do not use number of errors to fail the build
Special thanks to:
- Google and the Linux Foundation for sponsoring my work.