Re: [PATCH v4 00/14] kselftest harness and nolibc compatibility

2025-05-09 Thread Thomas Weißschuh
Hi Shuah and Kees, On 2025-05-05 17:15:18+0200, Thomas Weißschuh wrote: > Nolibc is useful for selftests as the test programs can be very small, > and compiled with just a kernel crosscompiler, without userspace support. > Currently nolibc is only usable with kselftest.h, not the more > convenient

Re: [PATCH 6/9] CodingStyle: recommend static_assert/_Static_assert

2025-05-09 Thread Greg KH
On Fri, May 09, 2025 at 11:34:27PM +0300, Alexey Dobriyan wrote: > Linux's BUG_ON is done backwards (condition is inverted). > But it is a long story. > > However C11/C23 allow to partially transition to what all normal > programmers are used to, namely assert(). > > Deprecate BUILD_BUG_ON, recom

Re: [PATCH 4/9] CodingStyle: mention "typedef struct S {} S;" if typedef is used

2025-05-09 Thread Greg KH
On Fri, May 09, 2025 at 11:34:25PM +0300, Alexey Dobriyan wrote: > Signed-off-by: Alexey Dobriyan > --- > Documentation/process/coding-style.rst | 14 ++ > 1 file changed, 14 insertions(+) We can't take patches without any changelog text, sorry.

Re: [PATCH 9/9] CodingStyle: flip the rule about curlies

2025-05-09 Thread Greg KH
On Fri, May 09, 2025 at 11:34:30PM +0300, Alexey Dobriyan wrote: > Require set of curlies {} in all if/else branches and all loops > not matter how simple. Sorry, but no, we are not going to change this long-term coding style rule for no real reason at this point in time. greg k-h

Re: [GIT PULL] Modules fixes for v6.15-rc6

2025-05-09 Thread Petr Pavlu
On 5/9/25 18:19, Linus Torvalds wrote: > On Fri, 9 May 2025 at 08:09, Petr Pavlu wrote: >> >> The fix has been on modules-next only since yesterday but should be safe. > > Hmm. > > At a minimum, the *description* of this bug is garbage. > > It talks about an "uninitialized completion pointer",

[PATCH v2 31/62] objtool: Avoid emptying lists for duplicate sections

2025-05-09 Thread Josh Poimboeuf
When a to-be-created section already exists, there's no point in emptying the various lists if their respective sections already exist. In fact it's better to leave them intact as they might get used later. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 4 1 file changed, 4 delet

Re: [PATCH 4/7] rust: str: convert `rusttest` tests into KUnit

2025-05-09 Thread John Hubbard
On 5/2/25 2:51 PM, Miguel Ojeda wrote: > In general, we should aim to test as much as possible within the actual > kernel, and not in the build host. > > Thus convert these `rusttest` tests into KUnit tests. yes yes yes! :) Like many, many kernel developers, I've been using separate development

Re: [PATCH] selftests/bpf: Fix bpf selftest build error

2025-05-09 Thread Stephen Rothwell
Hi Alexei, On Fri, 9 May 2025 10:04:18 -0700 Alexei Starovoitov wrote: > > On Fri, May 9, 2025 at 5:24 AM Saket Kumar Bhaskar > wrote: > > > > On linux-next, build for bpf selftest displays an error due to > > mismatch in the expected function signature of bpf_testmod_test_read > > and bpf_tes

[PATCH v2 12/62] objtool: Speed up SHT_GROUP reindexing

2025-05-09 Thread Josh Poimboeuf
After elf_update_group_sh_info() was introduced, a prototype version of "objtool klp diff" went from taking ~1s to several minutes, due to looping almost endlessly in elf_update_group_sh_info() while creating thousands of local symbols in a file with thousands of sections. Dramatically improve the

[PATCH 7/9] CodingStyle: new variable declaration placement rule

2025-05-09 Thread Alexey Dobriyan
Linux finally compiles without -Wdeclaration-after-statement allowing to declare variables anywhere in the code. The rule is that variable is declared as late as possible: 1) it is possible to typo a variable and use by mistake between declaration and first legitimate use. Declaring variab

[PATCH v2 17/62] objtool: Fix weak symbol detection

2025-05-09 Thread Josh Poimboeuf
find_symbol_hole_containing() fails to find a symbol hole (aka stripped weak symbol) if its section has no symbols before the hole. This breaks weak symbol detection if -ffunction-sections is enabled. Fix that by allowing the interval tree to contain section symbols, which are always at offset ze

Re: [PATCH v2 06/19] iommufd/viommu: Add IOMMU_VIOMMU_SET/UNSET_VDEV_ID ioctl

2025-05-09 Thread Jason Gunthorpe
On Fri, May 09, 2025 at 12:57:18PM +1000, Alexey Kardashevskiy wrote: > > > On 7/5/25 22:24, Jason Gunthorpe wrote: > > On Wed, May 07, 2025 at 09:18:29PM +1000, Alexey Kardashevskiy wrote: > > > > > > We should not destroy the vdevice for something like that. In a CC > > > > case that would unp

[PATCH v2 28/62] objtool: Fix weak symbol hole detection for .cold functions

2025-05-09 Thread Josh Poimboeuf
When ignore_unreachable_insn() looks for weak function holes which jump to their .cold functions, it assumes the parent function comes before the corresponding .cold function in the symbol table. That's not necessarily the case with -ffunction-sections. Mark all the holes beforehand (including .c

[PATCH v2 4/6] modpost: Create modalias for builtin modules

2025-05-09 Thread Alexey Gladkov
For some modules, modalias is generated using the modpost utility and the section is added to the module file. When a module is added inside vmlinux, modpost does not generate modalias for such modules and the information is lost. As a result kmod (which uses modules.builtin.modinfo in userspace)

Re: [PATCH v2 43/62] x86/alternative: Define ELF section entry size for alternatives

2025-05-09 Thread Borislav Petkov
On Fri, May 09, 2025 at 02:54:00PM -0700, Josh Poimboeuf wrote: > On Fri, May 09, 2025 at 11:36:35PM +0200, Borislav Petkov wrote: > > On Fri, May 09, 2025 at 01:17:07PM -0700, Josh Poimboeuf wrote: > > > +#define ALTINSTR_SIZE14 > > > > We have sizeof(struct alt_instr) to offer... >

Re: (subset) [PATCH 0/2] Fix fallback qcom,ipc parse

2025-05-09 Thread Bjorn Andersson
On Mon, 21 Apr 2025 04:04:15 +0200, Barnabás Czémán wrote: > mbox_request_channel() returning value was changed in case of error. > It uses returning value of of_parse_phandle_with_args(). > It is returning with -ENOENT instead of -ENODEV when no mboxes property > exists. > > ENODEV was checked

Re: [PATCH 1/3] dt-bindings: remoteproc: qcom,sm8350-pas: Add SC8280XP

2025-05-09 Thread Rob Herring (Arm)
On Sat, 03 May 2025 00:37:59 +0200, Konrad Dybcio wrote: > From: Konrad Dybcio > > From the software POV, it matches the SM8350's implementation. > Describe it as such, with a fallback. > > Signed-off-by: Konrad Dybcio > --- > .../bindings/remoteproc/qcom,sm8350-pas.yaml | 54 > ++

[PATCH v2 19/62] objtool: Fix __pa_symbol() relocation handling

2025-05-09 Thread Josh Poimboeuf
__pa_symbol() generates a relocation which refers to a physical address. Convert it to back its virtual form before calculating the addend. Signed-off-by: Josh Poimboeuf --- tools/objtool/arch/x86/decode.c | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tools/ob

Re: [PATCH v2 1/5] ASoC: dt-bindings: qcom,q6afe: Document q6usb subnode

2025-05-09 Thread Rob Herring (Arm)
On Thu, 01 May 2025 08:48:47 +0200, Luca Weiss wrote: > Document the subnode for Q6USB, used for USB audio offloading. > > Cc: Wesley Cheng > Signed-off-by: Luca Weiss > --- > Documentation/devicetree/bindings/sound/qcom,q6afe.yaml | 13 + > 1 file changed, 13 insertions(+) > Ac

Re: [PATCH v2 43/62] x86/alternative: Define ELF section entry size for alternatives

2025-05-09 Thread Josh Poimboeuf
On Fri, May 09, 2025 at 11:36:35PM +0200, Borislav Petkov wrote: > On Fri, May 09, 2025 at 01:17:07PM -0700, Josh Poimboeuf wrote: > > +#define ALTINSTR_SIZE 14 > > We have sizeof(struct alt_instr) to offer... Right, but IIRC, sizeof(struct alt_instr) isn't available at macro expansi

[PATCH 5/9] CodingStyle: institute better inline assembly formatting

2025-05-09 Thread Alexey Dobriyan
Signed-off-by: Alexey Dobriyan --- Documentation/process/coding-style.rst | 40 +- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst index 5c5902a0f897..63c41125e713 100644 --- a/

Re: [PATCH v2 43/62] x86/alternative: Define ELF section entry size for alternatives

2025-05-09 Thread Borislav Petkov
On Fri, May 09, 2025 at 01:17:07PM -0700, Josh Poimboeuf wrote: > +#define ALTINSTR_SIZE14 We have sizeof(struct alt_instr) to offer... -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette

Re: [PATCH 9/9] CodingStyle: flip the rule about curlies

2025-05-09 Thread Randy Dunlap
On 5/9/25 1:34 PM, Alexey Dobriyan wrote: > Require set of curlies {} in all if/else branches and all loops > not matter how simple. > > The rationale is that maintaining curlies increases churn and make > patches bigger when those if/else branches grow and shrink so it is > easier to always ad

[PATCH v2 41/62] objtool: Add elf_create_file()

2025-05-09 Thread Josh Poimboeuf
Add interface to enable the creation of a new ELF file. Signed-off-by: Josh Poimboeuf --- tools/objtool/builtin-check.c | 2 +- tools/objtool/elf.c | 144 +++- tools/objtool/include/objtool/elf.h | 5 +- 3 files changed, 147 insertions(+), 4 dele

[PATCH v2 35/62] objtool: Refactor add_jump_destinations()

2025-05-09 Thread Josh Poimboeuf
The add_jump_destinations() logic is a bit weird and convoluted after being incrementally tweaked over the years. Refactor it to hopefully be more logical and straightforward. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 227 +--- tools/objtool

[PATCH v2 33/62] objtool: Rename --Werror to --werror

2025-05-09 Thread Josh Poimboeuf
The objtool --Werror option name is stylistically inconsistent: halfway between GCC's single-dash capitalized -Werror and objtool's double-dash --lowercase convention, making it unnecessarily hard to remember. Make the 'W' lower case (--werror) for consistency with objtool's other options. Signed

[PATCH v2 14/62] objtool: Propagate elf_truncate_section() error in elf_write()

2025-05-09 Thread Josh Poimboeuf
Properly check and propagate the return value of elf_truncate_section() to avoid silent failures. Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index b009d9feed76..19e249f47

[PATCH v2 51/62] objtool/klp: Add --debug-checksum= to show per-instruction checksums

2025-05-09 Thread Josh Poimboeuf
Add a --debug-checksum= option to the check subcommand to print the calculated checksum of each instruction in the given functions. This is useful for determining where two versions of a function begin to diverge. Signed-off-by: Josh Poimboeuf --- tools/objtool/builtin-check.c| 6 +

[PATCH v2 30/62] objtool: Simplify reloc offset calculation in unwind_read_hints()

2025-05-09 Thread Josh Poimboeuf
Simplify the relocation offset calculation in unwind_read_hints(), similar to other conversions which have already been done. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/

[PATCH v2 39/62] objtool: Add elf_create_data()

2025-05-09 Thread Josh Poimboeuf
In preparation for the objtool klp diff subcommand, refactor elf_add_string() by adding a new elf_add_data() helper which allows the adding of arbitrary data to a section. Make both interfaces public so they can be used by the upcoming klp diff code. Signed-off-by: Josh Poimboeuf --- tools/objt

[PATCH v2 40/62] objtool: Introduce elf_create_reloc() and elf_init_reloc()

2025-05-09 Thread Josh Poimboeuf
elf_create_rela_section() is quite limited in that it requires the caller to know how many relocations need to be allocated up front. In preparation for the objtool klp diff subcommand, allow an arbitrary number of relocations to be created and initialized on demand after section creation. Signed

[PATCH v2 36/62] objtool: Simplify special symbol handling in elf_update_symbol()

2025-05-09 Thread Josh Poimboeuf
!sym->sec isn't actually a thing: even STT_UNDEF and other special symbol types belong to NULL section 0. Simplify the initialization of 'shndx' accordingly. Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/objt

[PATCH v2 37/62] objtool: Generalize elf_create_symbol()

2025-05-09 Thread Josh Poimboeuf
In preparation for the objtool klp diff subcommand, broaden the elf_create_symbol() interface to give callers more control and reduce duplication of some subtle setup logic. While at it, make elf_create_symbol() and elf_create_section_symbol() public so sections can be created by the upcoming klp

[PATCH v2 27/62] objtool: Mark .cold subfunctions

2025-05-09 Thread Josh Poimboeuf
Introduce a flag to identify .cold subfunctions so they can be detected easier and faster. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 14 ++ tools/objtool/elf.c | 19 ++- tools/objtool/include/objtool/elf.h | 1 + 3 files

Re: [PATCH 1/9] CodingStyle: make Documentation/CodingStyle into symlink

2025-05-09 Thread Ozgur Kara
Alexey Dobriyan , 9 May 2025 Cum, 23:35 tarihinde şunu yazdı: > > Every time I open Documentation/CodingStyle it says the party moved > somewhere else. :-( > Hello, I dont understand, this already exists so when you look in Documentation/CodingStyle file it will guide you? $ cat Documentation/Co

[PATCH v2 00/62] objtool,livepatch: klp-build livepatch module generation

2025-05-09 Thread Josh Poimboeuf
This series introduces new objtool features and a klp-build script to generate livepatch modules using a source .patch as input. This builds on concepts from the longstanding out-of-tree kpatch [1] project which began in 2012 and has been used for many years to generate livepatch modules for produ

[PATCH v2 57/62] livepatch/klp-build: Introduce fix-patch-lines script to avoid __LINE__ diff noise

2025-05-09 Thread Josh Poimboeuf
The __LINE__ macro creates challenges for binary diffing. When a .patch file adds or removes lines, it shifts the line numbers for all code below it. This can cause the code generation of functions using __LINE__ to change due to the line number constant being embedded in a MOV instruction, despi

[PATCH v2 50/62] objtool/klp: Add --checksum option to generate per-function checksums

2025-05-09 Thread Josh Poimboeuf
In preparation for the objtool klp diff subcommand, add a command-line option to generate a unique checksum for each function. This will enable detection of functions which have changed between two versions of an object file. Signed-off-by: Josh Poimboeuf --- tools/objtool/Makefile

[PATCH v2 04/62] x86/kprobes: Remove STACK_FRAME_NON_STANDARD annotation

2025-05-09 Thread Josh Poimboeuf
Since commit 877b145f0f47 ("x86/kprobes: Move trampoline code into RODATA"), the optprobe template code is no longer analyzed by objtool so it doesn't need to be ignored. Signed-off-by: Josh Poimboeuf --- arch/x86/kernel/kprobes/opt.c | 4 1 file changed, 4 deletions(-) diff --git a/arch/x

[PATCH v2 59/62] livepatch/klp-build: Introduce klp-build script for generating livepatch modules

2025-05-09 Thread Josh Poimboeuf
Add a klp-build script which automates the generation of a livepatch module from a source .patch file by performing the following steps: - Builds an original kernel with -function-sections and -fdata-sections, plus objtool function checksumming. - Applies the .patch file and rebuilds the

[PATCH 8/9] CodingStyle: tell people how to split long "for" loops

2025-05-09 Thread Alexey Dobriyan
Signed-off-by: Alexey Dobriyan --- Documentation/process/coding-style.rst | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst index e17de69845ff..494ab3201112 100644 --- a/Documentati

[PATCH 9/9] CodingStyle: flip the rule about curlies

2025-05-09 Thread Alexey Dobriyan
Require set of curlies {} in all if/else branches and all loops not matter how simple. The rationale is that maintaining curlies increases churn and make patches bigger when those if/else branches grow and shrink so it is easier to always add them. There are more important things in life than her

[PATCH 1/9] CodingStyle: make Documentation/CodingStyle into symlink

2025-05-09 Thread Alexey Dobriyan
Every time I open Documentation/CodingStyle it says the party moved somewhere else. :-( Of course, I forget where it moved to by the next time. Signed-off-by: Alexey Dobriyan --- Documentation/CodingStyle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 12 Docume

[PATCH 6/9] CodingStyle: recommend static_assert/_Static_assert

2025-05-09 Thread Alexey Dobriyan
Linux's BUG_ON is done backwards (condition is inverted). But it is a long story. However C11/C23 allow to partially transition to what all normal programmers are used to, namely assert(). Deprecate BUILD_BUG_ON, recommend static_assert/_Static_assert. And then some day BUG_ON will be flipped as

[PATCH 4/9] CodingStyle: mention "typedef struct S {} S;" if typedef is used

2025-05-09 Thread Alexey Dobriyan
Signed-off-by: Alexey Dobriyan --- Documentation/process/coding-style.rst | 14 ++ 1 file changed, 14 insertions(+) diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst index ac9c1dbe00b7..5c5902a0f897 100644 --- a/Documentation/process/coding

[PATCH 3/9] CodingStyle: advise on using "sysctl" in sysctl variables

2025-05-09 Thread Alexey Dobriyan
Signed-off-by: Alexey Dobriyan --- Documentation/process/coding-style.rst | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/process/coding-style.rst b/Documentation/process/coding-style.rst index a4fbe45c3eb9..ac9c1dbe00b7 100644 --- a/Documentation/process/coding-style.rst +

[PATCH v2 62/62] livepatch: Introduce source code helpers for livepatch modules

2025-05-09 Thread Josh Poimboeuf
Add some helper macros which can be used by livepatch source .patch files to register callbacks or patch syscalls. Signed-off-by: Josh Poimboeuf --- include/linux/livepatch_helpers.h | 68 +++ 1 file changed, 68 insertions(+) create mode 100644 include/linux/livepatc

[PATCH v2 56/62] objtool: Add base objtool support for livepatch modules

2025-05-09 Thread Josh Poimboeuf
In preparation for klp-build, enable "classic" objtool to work on livepatch modules: - Avoid duplicate symbol/section warnings for prefix symbols and the .static_call_sites and __mcount_loc sections which may have already been extracted by klp diff. - Add __klp_funcs to the IBT functi

[PATCH v2 55/62] objtool: Disallow duplicate prefix symbols

2025-05-09 Thread Josh Poimboeuf
In preparation for adding objtool 'check' support for analyzing livepatch modules, error out if a duplicate prefix symbol is attempted. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 12 +++- tools/objtool/elf.c | 9 + tools/objtool/inclu

[PATCH v2 60/62] livepatch/klp-build: Add --debug option to show cloning decisions

2025-05-09 Thread Josh Poimboeuf
Add a --debug option which gets passed to "objtool klp diff" to enable debug output related to cloning decisions. Signed-off-by: Josh Poimboeuf --- scripts/livepatch/klp-build | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/livepatch/klp-build b/scri

[PATCH v2 61/62] livepatch/klp-build: Add --show-first-changed option to show function divergence

2025-05-09 Thread Josh Poimboeuf
Add a --show-first-changed option to identify where changed functions begin to diverge: - Parse 'objtool klp diff' output to find changed functions. - Run objtool again on each object with --debug-checksum=. - Diff the per-instruction checksum debug output to locate the first differing

[PATCH v2 58/62] livepatch/klp-build: Add stub init code for livepatch modules

2025-05-09 Thread Josh Poimboeuf
Add a module initialization stub which can be linked with binary diff objects to produce a livepatch module. Signed-off-by: Josh Poimboeuf --- scripts/livepatch/init.c | 108 +++ 1 file changed, 108 insertions(+) create mode 100644 scripts/livepatch/init.c d

[PATCH v2 54/62] objtool/klp: Add post-link subcommand to finalize livepatch modules

2025-05-09 Thread Josh Poimboeuf
Livepatch needs some ELF magic which linkers don't like: - Two relocation sections (.rela*, .klp.rela*) for the same text section. - Use of SHN_LIVEPATCH to mark livepatch symbols. Unfortunately linkers tend to mangle such things. To work around that, klp diff generates a linker-complia

[PATCH v2 53/62] objtool/klp: Add --debug option to show cloning decisions

2025-05-09 Thread Josh Poimboeuf
Add a --debug option to klp diff which prints cloning decisions and an indented dependency tree for all cloned symbols and relocations. This helps visualize which symbols and relocations were included and why. Signed-off-by: Josh Poimboeuf --- tools/objtool/include/objtool/warn.h | 21

[PATCH v2 52/62] objtool/klp: Introduce klp diff subcommand for diffing object files

2025-05-09 Thread Josh Poimboeuf
Add a new klp diff subcommand which performs a binary diff between two object files and extracts changed functions into a new object which can then be linked into a livepatch module. This builds on concepts from the longstanding out-of-tree kpatch [1] project which began in 2012 and has been used

[PATCH v2 47/62] x86/orc: Define ELF section entry size for unwind hints

2025-05-09 Thread Josh Poimboeuf
In preparation for the objtool klp diff subcommand, define the entry size for the discard.unwind_hints section in its ELF header. This will allow tooling to extract individual entries. Signed-off-by: Josh Poimboeuf --- arch/x86/kernel/unwind_orc.c | 2 ++ include/linux/objtool.h | 9 ++

[PATCH v2 49/62] kbuild,objtool: Defer objtool validation step for CONFIG_LIVEPATCH

2025-05-09 Thread Josh Poimboeuf
In preparation for the objtool klp diff subcommand, defer objtool validation for CONFIG_LIVEPATCH until the final pre-link archive (e.g., vmlinux.o, module-foo.o) is built. This will simplify the process of generating livepatch modules. Delayed objtool is generally preferred anyway, and is alread

[PATCH v2 46/62] x86/bug: Define ELF section entry size for the bug table

2025-05-09 Thread Josh Poimboeuf
In preparation for the objtool klp diff subcommand, define the entry size for the __bug_table section in its ELF header. This will allow tooling to extract individual entries. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/bug.h | 44 -- 1 file change

[PATCH v2 48/62] objtool: Make STACK_FRAME_NON_STANDARD consistent

2025-05-09 Thread Josh Poimboeuf
The C version of STACK_FRAME_NON_STANDARD differs from its asm counterpart in that it creates eight-byte entries (vs four) and creates a superfluous temporary variable. Make the entry sizes consistent by converting the C version to four byte entries. Signed-off-by: Josh Poimboeuf --- include/li

[PATCH v2 42/62] kbuild,x86: Fix module permissions for __jump_table and __bug_table

2025-05-09 Thread Josh Poimboeuf
An upcoming patch will add the SHF_MERGE flag to x86 __jump_table and __bug_table so their entry sizes can be defined in inline asm. However, those sections have SHF_WRITE, which the Clang linker (lld) explicitly forbids combining with SHF_MERGE. Those sections are modified at runtime and must re

[PATCH v2 43/62] x86/alternative: Define ELF section entry size for alternatives

2025-05-09 Thread Josh Poimboeuf
In preparation for the objtool klp diff subcommand, define the entry size for the .altinstructions section in its ELF header. This will allow tooling to extract individual entries. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/alternative.h | 7 +-- arch/x86/kernel/alternative.c

[PATCH v2 45/62] x86/extable: Define ELF section entry size for exception tables

2025-05-09 Thread Josh Poimboeuf
In preparation for the objtool klp diff subcommand, define the entry size for the __ex_table section in its ELF header. This will allow tooling to extract individual entries. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/asm.h | 20 kernel/extable.c | 2

[PATCH v2 44/62] x86/jump_label: Define ELF section entry size for jump table

2025-05-09 Thread Josh Poimboeuf
In preparation for the objtool klp diff subcommand, define the entry size for the __jump_table section in its ELF header. This will allow tooling to extract individual entries. Signed-off-by: Josh Poimboeuf --- arch/x86/include/asm/jump_label.h | 32 +-- include/linu

[PATCH v2 38/62] objtool: Generalize elf_create_section()

2025-05-09 Thread Josh Poimboeuf
In preparation for the objtool klp diff subcommand, broaden the elf_create_section() interface to give callers more control and reduce duplication of some subtle setup logic. While at it, make elf_create_rela_section() public so sections can be created by the upcoming klp diff code. Signed-off-by

[PATCH v2 34/62] objtool: Reindent check_options[]

2025-05-09 Thread Josh Poimboeuf
Bring the cmdline check_options[] array back into vertical alignment for better readability. Signed-off-by: Josh Poimboeuf --- tools/objtool/builtin-check.c | 50 +-- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/tools/objtool/builtin-check.c b/t

[PATCH v2 32/62] objtool: Suppress section skipping warnings with --dryrun

2025-05-09 Thread Josh Poimboeuf
It's common to use --dryrun on binaries that have already been processed. Don't print the section skipping warnings in that case. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 28 +--- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/tools/objto

[PATCH v2 29/62] objtool: Mark prefix functions

2025-05-09 Thread Josh Poimboeuf
In preparation for the objtool klp diff subcommand, introduce a flag to identify __pfx_*() and __cfi_*() functions in advance so they don't need to be manually identified every time a check is needed. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 3 +-- tools/objtool/el

[PATCH v2 26/62] objtool: Add section/symbol type helpers

2025-05-09 Thread Josh Poimboeuf
Add some helper macros to improve readability. Signed-off-by: Josh Poimboeuf --- tools/objtool/arch/x86/special.c| 2 +- tools/objtool/check.c | 58 - tools/objtool/elf.c | 20 - tools/objtool/include/objtool/elf.h | 66 +

[PATCH v2 25/62] objtool: Convert elf iterator macros to use 'struct elf'

2025-05-09 Thread Josh Poimboeuf
'struct objtool_file' is specific to the check code and doesn't belong in the elf code which is supposed to be objtool_file-agnostic. Convert the elf iterator macros to use 'struct elf' instead. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 22 +++--- t

[PATCH v2 24/62] objtool: Remove .parainstructions reference

2025-05-09 Thread Josh Poimboeuf
The .parainstructions section no longer exists since the following commit: 60bc276b129e ("x86/paravirt: Switch mixed paravirt/alternative calls to alternatives"). Remove the reference to it. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 1 - 1 file changed, 1 deletion(-) diff -

[PATCH v2 21/62] objtool: Check for missing annotation entries in read_annotate()

2025-05-09 Thread Josh Poimboeuf
Add a sanity check to make sure none of the relocations for the .discard.annotate_insn section have gone missing. Signed-off-by: Josh Poimboeuf --- tools/objtool/check.c | 5 + 1 file changed, 5 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 53793b9ea974..0cd

[PATCH v2 23/62] objtool: Clean up compiler flag usage

2025-05-09 Thread Josh Poimboeuf
KBUILD_HOSTCFLAGS and KBUILD_HOSTLDFLAGS aren't defined when objtool is built standalone. Also, the EXTRA_WARNINGS flags are rather arbitrary. Make things simpler and more consistent by specifying compiler flags explicitly and tweaking the warnings. Also make a few code tweaks to make the new wa

[PATCH v2 20/62] objtool: Fix "unexpected end of section" warning for alternatives

2025-05-09 Thread Josh Poimboeuf
Due to the short circuiting logic in next_insn_to_validate(), control flow may silently transition from .altinstr_replacement to .text without a corresponding nested call to validate_branch(). As a result the validate_branch() 'sec' variable doesn't get reinitialized, which can trigger a confusing

[PATCH v2 22/62] objtool: Const string cleanup

2025-05-09 Thread Josh Poimboeuf
Use 'const char *' where applicable. Signed-off-by: Josh Poimboeuf --- tools/objtool/arch/loongarch/decode.c | 2 +- tools/objtool/arch/powerpc/decode.c | 2 +- tools/objtool/arch/x86/decode.c | 2 +- tools/objtool/elf.c | 6 +++--- tools/objtool/include/objtool/arch.h

[PATCH v2 18/62] objtool: Fix x86 addend calculation

2025-05-09 Thread Josh Poimboeuf
On x86, arch_dest_reloc_offset() hardcodes the addend adjustment to four, but the actual adjustment depends on the relocation type. Fix that. Signed-off-by: Josh Poimboeuf --- tools/objtool/arch/loongarch/decode.c | 4 ++-- tools/objtool/arch/powerpc/decode.c | 4 ++-- tools/objtool/arch/x8

[PATCH v2 15/62] objtool: Add empty symbols to the symbol tree again

2025-05-09 Thread Josh Poimboeuf
The following commit 5da6aea375cd ("objtool: Fix find_{symbol,func}_containing()") fixed the issue where overlapping symbols weren't getting sorted properly in the symbol tree. Therefore the workaround to skip adding empty symbols from the following commit a2e38dffcd93 ("objtool: Don't add

[PATCH v2 16/62] objtool: Fix interval tree insertion for zero-length symbols

2025-05-09 Thread Josh Poimboeuf
Zero-length symbols get inserted in the wrong spot. Fix that. Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c index a8a78b55d3ec..c024937eb12a 100644 --- a/tools/objtool/elf.c +++

[PATCH v2 10/62] x86/alternative: Refactor INT3 call emulation selftest

2025-05-09 Thread Josh Poimboeuf
The INT3 call emulation selftest is a bit fragile as it relies on the compiler not inserting any extra instructions before the int3_selftest_ip() definition. Also, the int3_selftest_ip() symbol overlaps with the int3_selftest symbol(), which can confuse objtool. Fix those issues by slightly rewor

[PATCH v2 13/62] objtool: Fix broken error handling in read_symbols()

2025-05-09 Thread Josh Poimboeuf
The free(sym) call in the read_symbols() error path is fundamentally broken: 'sym' doesn't point to any allocated block. If triggered, things would go from bad to worse. Remove the free() and simplify the error paths. Freeing memory isn't necessary here anyway, these are fatal errors which lead

[PATCH v2 11/62] objtool: Make find_symbol_containing() less arbitrary

2025-05-09 Thread Josh Poimboeuf
In the rare case of overlapping symbols, find_symbol_containing() just returns the first one it finds. Make it slightly less arbitrary by returning the smallest symbol with size > 0. Signed-off-by: Josh Poimboeuf --- tools/objtool/elf.c | 25 - 1 file changed, 20 inserti

[PATCH v2 09/62] modpost: Ignore unresolved section bounds symbols

2025-05-09 Thread Josh Poimboeuf
In preparation for klp-build livepatch module creation tooling, suppress warnings for unresolved references to linker-generated __start_* and __stop_* section bounds symbols. These symbols are expected to be undefined when modpost runs, as they're created later by the linker. Cc: Masahiro Yamada

[PATCH v2 08/62] kbuild: Remove 'kmod_' prefix from __KBUILD_MODNAME

2025-05-09 Thread Josh Poimboeuf
In preparation for the objtool klp diff subcommand, remove the arbitrary 'kmod_' prefix from __KBUILD_MODNAME and instead add it explicitly in the __initcall_id() macro. This change supports the standardization of "unique" symbol naming by ensuring the non-unique portion of the name comes before t

[PATCH v2 07/62] elfnote: Change ELFNOTE() to use __UNIQUE_ID()

2025-05-09 Thread Josh Poimboeuf
In preparation for the objtool klp diff subcommand, replace the custom unique symbol name generation in ELFNOTE() with __UNIQUE_ID(). This standardizes the naming format for all "unique" symbols, which will allow objtool to properly correlate them. Note this also removes the "one ELF note per lin

[PATCH v2 05/62] compiler: Tweak __UNIQUE_ID() naming

2025-05-09 Thread Josh Poimboeuf
In preparation for the objtool klp diff subcommand, add an underscore between the name and the counter. This will make it possible for objtool to distinguish between the non-unique and unique parts of the symbol name so it can properly correlate the symbols. Signed-off-by: Josh Poimboeuf --- in

[PATCH v2 06/62] compiler.h: Make addressable symbols less of an eyesore

2025-05-09 Thread Josh Poimboeuf
Avoid underscore overload by changing: __UNIQUE_ID___addressable_loops_per_jiffy_868 to the following: __UNIQUE_ID_addressable_loops_per_jiffy_868 This matches the format used by other __UNIQUE_ID()-generated symbols and improves readability for those who stare at ELF symbol table dumps. S

[PATCH v2 01/62] s390/vmlinux.lds.S: Prevent thunk functions from getting placed with normal text

2025-05-09 Thread Josh Poimboeuf
The s390 indirect thunks are placed in the .text.__s390_indirect_jump_* sections. Certain config options which enable -ffunction-sections have a custom version of the TEXT_TEXT macro: .text.[0-9a-zA-Z_]* That unintentionally matches the thunk sections, causing them to get grouped with normal t

[PATCH v2 03/62] x86/module: Improve relocation error messages

2025-05-09 Thread Josh Poimboeuf
Add the section number and reloc index to relocation error messages to help find the faulty relocation. Signed-off-by: Josh Poimboeuf --- arch/x86/kernel/module.c | 15 +-- kernel/livepatch/core.c | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/arch/x86/ke

[PATCH v2 02/62] vmlinux.lds: Unify TEXT_MAIN, DATA_MAIN, and related macros

2025-05-09 Thread Josh Poimboeuf
TEXT_MAIN, DATA_MAIN and friends are defined differently depending on whether certain config options enable -ffunction-sections and/or -fdata-sections. There's no technical reason for that beyond voodoo coding. Keeping the separate implementations adds unnecessary complexity, fragments the logic,

Re: [PATCH 04/12] mm: move randomize_va_space into memory.c

2025-05-09 Thread Kees Cook
On Fri, May 09, 2025 at 02:54:08PM +0200, Joel Granados wrote: > Move the randomize_va_space variable together with all its sysctl table > elements into memory.c. Register it to the "kernel" directory by > adding it to the subsys initialization calls > > This is part of a greater effort to move ct

Re: [PATCH] kunit: configs: Enable coverage of the bitfield packing library

2025-05-09 Thread Rae Moar
On Fri, Apr 25, 2025 at 6:19 PM Mark Brown wrote: > > There are KUnit tests for the bitfield packing library but these depend > on CONFIG_PACKING which is not enabled by anything in either the > existing KUnit all_tests.config or the base UML config it runs on as > standard. Enable that in all_te

Re: [PATCH] rcu/nocb: Fix possible invalid rdp's->nocb_cb_kthread pointer access

2025-05-09 Thread Joel Fernandes
On 5/7/2025 7:26 AM, Zqiang wrote: > In the preparation stage of CPU online, if the corresponding > the rdp's->nocb_cb_kthread does not exist, will be created, > there is a situation where the rdp's rcuop kthreads creation fails, > and then de-offload this CPU's rdp, does not assign this CPU's >

Re: [PATCH] selftests/seccomp: fix negative_ENOSYS tracer tests on arm32

2025-05-09 Thread Kees Cook
On Fri, 09 May 2025 12:56:22 +0100, Terry Tritton wrote: > TRACE_syscall.ptrace.negative_ENOSYS and TRACE_syscall.seccomp.negative_ENOSYS > on arm32 are being reported as failures instead of skipping. > > The teardown_trace_fixture function sets the test to KSFT_FAIL in case of a > non 0 return va

Re: [PATCH v2] rcu/nocb: Add Safe checks for access offloaded rdp

2025-05-09 Thread Joel Fernandes
On 5/9/2025 9:33 AM, Frederic Weisbecker wrote: > Le Thu, May 08, 2025 at 02:43:11PM +0800, Z qiang a écrit : >> On Thu, May 8, 2025 at 12:25 AM Frederic Weisbecker >> wrote: >>> On a second thought, isn't "rdp == this_cpu_ptr(&rcu_data)" enough? >> >> If the CONFIG_DEBUG_PREEMPT=y, the follow

Re: [PATCH] rcutorture: Fix rcutorture_one_extend_check() splat in RT kernels

2025-05-09 Thread Joel Fernandes
On 5/7/2025 5:04 PM, Paul E. McKenney wrote: > On Wed, May 07, 2025 at 07:26:03PM +0800, Zqiang wrote: >> For built with CONFIG_PREEMPT_RT=y kernels, running rcutorture >> tests resulted in the following splat: >> >> [ 68.797425] rcutorture_one_extend_check during change: Current 0x1 To >> a

Re: [PATCH v2 3/3] remoteproc: imx_rproc: add power mode check for remote core attachment

2025-05-09 Thread Hiago De Franco
On Fri, May 09, 2025 at 12:37:02PM +0200, Ulf Hansson wrote: > On Thu, 8 May 2025 at 22:28, Hiago De Franco wrote: > > > > Hello, > > > > On Thu, May 08, 2025 at 12:03:33PM +0200, Ulf Hansson wrote: > > > On Wed, 7 May 2025 at 18:02, Hiago De Franco > > > wrote: > > > > > > > > From: Hiago De Fr

Re: [PATCH] rcu/nocb: Fix possible invalid rdp's->nocb_cb_kthread pointer access

2025-05-09 Thread Joel Fernandes
On 5/9/2025 3:07 PM, Joel Fernandes wrote: > > > On 5/7/2025 7:26 AM, Zqiang wrote: >> In the preparation stage of CPU online, if the corresponding >> the rdp's->nocb_cb_kthread does not exist, will be created, >> there is a situation where the rdp's rcuop kthreads creation fails, >> and then de-

Re: [PATCH 1/3] selftests/timens: Print TAP headers

2025-05-09 Thread Kees Cook
On Fri, May 09, 2025 at 05:41:03PM +0200, Thomas Weißschuh wrote: > The suppression was actually there at some point and got removed by Kees in > commit f41c322f17ec ("selftests: Remove KSFT_TAP_LEVEL"). Right, to get consistent output and to work with indentation, there's no need to track level a

Re: [PATCH 03/12] rcu: Move rcu_stall related sysctls into rcu/tree_stall.h

2025-05-09 Thread Kees Cook
On Fri, May 09, 2025 at 02:54:07PM +0200, Joel Granados wrote: > Move sysctl_panic_on_rcu_stall and sysctl_max_rcu_stall_to_panic into > the kernel/rcu subdirectory. Make these static in tree_stall.h and > removed them as extern from panic.h as their scope is now confined into > one file. > > This

Re: [PATCH 05/12] parisc/power: Move soft-power into power.c

2025-05-09 Thread Kees Cook
On Fri, May 09, 2025 at 02:54:09PM +0200, Joel Granados wrote: > Move the soft-power ctl table into parisc/power.c. As a consequence the > pwrsw_enabled var is made static. > > This is part of a greater effort to move ctl tables into their > respective subsystems which will reduce the merge confli

Re: [PATCH 06/12] fork: mv threads-max into kernel/fork.c

2025-05-09 Thread Kees Cook
On Fri, May 09, 2025 at 02:54:10PM +0200, Joel Granados wrote: > make sysctl_max_threads static as it no longer needs to be exported into > sysctl.c. > > This is part of a greater effort to move ctl tables into their > respective subsystems which will reduce the merge conflicts in > kernel/sysctl.

  1   2   >