-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Arm64 support, including @surajjs95 & @t-msn changes #1302
base: master
Are you sure you want to change the base?
Commits on May 31, 2024
-
avoid reloc-type collisions on elf.h constants
Do we need more robust architecture protection (Issue dynup#1356) The elf.h reloc-type constants are not unique across archs #define R_PPC64_REL24 10 /* PC relative 26 bit */ #define R_X86_64_32 10 /* Direct 32 bit zero extended */ so to avoid any unexpected aliasing, guard all R_arch_type refs with a check on kelf->arch, or a global default arch set from the first elf encountered.
Configuration menu - View commit details
-
Copy full SHA for aa69a14 - Browse repository at this point
Copy the full SHA aa69a14View commit details -
test/integration/rhel-8.9: integration testing for rhel-8.9
Provides integration tests for rhel-8.9 (kernel-4.18.0-513.5.1.el8_9), note that module.test is from the linux-6.2/ directory and not rhel-8.8/ Signed-off-by: Ryan Sullivan <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 5d62944 - Browse repository at this point
Copy the full SHA 5d62944View commit details -
kpatch-build: check if gawk is installed
kpatch-build uses gawk to find special section, but gawk is not always installed. So check if gawk is installed. Signed-off-by: Hongchen Zhang <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 439876e - Browse repository at this point
Copy the full SHA 439876eView commit details -
test/integration/rhel-9.3: integration testing for rhel-9.3
Provides integration tests for rhel-9.3 (kernel-5.14.0-362.8.1.el9_3) Signed-off-by: Ryan Sullivan <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 6f64414 - Browse repository at this point
Copy the full SHA 6f64414View commit details -
kpatch-build: simplify distro support
Rather than adding yet another set of conditionals to handle the Anolis OS distribution, refactor the SUPPORTED_DISTROS code using an associative array. The array is keyed by the short distro name, and contains the longer distribution description. Signed-off-by: Wardenjohn<[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 7e7c969 - Browse repository at this point
Copy the full SHA 7e7c969View commit details -
kpatch-build: Support distro Anolis OS
Support Anolis OS Signed-off-by: Wardenjohn<[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 289045e - Browse repository at this point
Copy the full SHA 289045eView commit details -
kmod: maintain syscall metadata sections in kpatch syscall macros
The KPATCH_SYSCALL_DEFINEn macros in kpatch-syscall.h do not provide the same syscall metadata (saved in the __syscalls_metadata and _ftrace_events ELF sections) as the kernel. These same macros also instruct kpatch-build to ignore changes to these sections. This works fine as long as there are other unmodified syscalls present in the object file. However, if not, the kpatch syscall macros may result in either metadata ELF sections not appearing in the patched object file. The create-diff-object program expects to encounter any ELF section that has been marked by KPATCH_IGNORE_SECTION in the patched object file. To avoid this limitation, create dummy __syscalls_metadata and _ftrace_events entries for the kpatch-modified syscall. The specific values shouldn't matter since their sections will still be marked with KPATCH_IGNORE_SECTION and now their presence will be guarenteed for create-diff-object. Closes: dynup#1375 ("kpatch-build error when modifying an object file's only syscall") Signed-off-by: Joe Lawrence <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a78bc44 - Browse repository at this point
Copy the full SHA a78bc44View commit details -
kpatch-build: add support for OpenCloudOS
OpenCloudOS is a centos-like Linux distribution. I test kpatch in OpenCloudOS V8 and V9. It works well in V9. But v8 itself has two problems: 1. no available epol repo, so kpatch can't install ccache. 2. executing 'uname -r' can't get an accurate kernel version. Both problems have been notified to the OpenCloudOS community. After they fix these problems, kpatch will work well in all versions. Signed-off-by: Longjun Luo <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 776056a - Browse repository at this point
Copy the full SHA 776056aView commit details -
test/integration/rhel-8.10: add kernel-4.18.0-552.el8_10 tests
Signed-off-by: Ryan Sullivan <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 936afb9 - Browse repository at this point
Copy the full SHA 936afb9View commit details -
test/integration/rhel-9.4: add kernel-5.14.0-427.13.1.el9_4 tests
Signed-off-by: Ryan Sullivan <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e86e0cf - Browse repository at this point
Copy the full SHA e86e0cfView commit details -
kpatch-test: add dmesg entry at start of test
If the kernel log is empty prior to running the integration tests, the following confusing status may be reported: ... ERROR: dmesg overflow, try increasing kernel log buffer size SUCCESS This occurs because the script can't find an empty dmesg entry when the tests are complete. Copy the upstream kernel livepatching kselftests to fix this by logging a canary message at the beginning of the integration tests. This will ensure a "real" message than can be found at the end. Fixes: de1d0c6 ("kpatch-test: don't clear dmesg during test") Signed-off-by: Joe Lawrence <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 59a0f24 - Browse repository at this point
Copy the full SHA 59a0f24View commit details -
kpatch-build: handle paravirt absence in Linux v6.8+
Upstream kernel commit f7af6977621a ("x86/paravirt: Remove no longer needed paravirt patching code") v6.8+ removed the .parainstructions section and its paravirt_patch_site struct. Therefore this checks the kernel version and does not export the struct size if the kernel version is >= v6.8.0, avoiding the code path for it in create-diff-object.c entirely. Fixes: dynup#1380 Signed-off-by: Ryan Sullivan <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2060c1f - Browse repository at this point
Copy the full SHA 2060c1fView commit details -
kpatch-build: demote CONFIG_LD_ORPHAN_WARN_LEVEL
Upstream kernel v6.1+ commit linux@e1789d7c752e ("kbuild: upgrade the orphan section warning to an error if CONFIG_WERROR is set") and CONFIG_WERROR will result in failed kernel builds due to the linker reporting tons of "unplaced orphan section `.text.<function>` <object-file.o>" errors. Workaround this by temporarily demoting such errors in the top-level kernel Makefile. Reported-and-tested-by: Zhijun Wang <[email protected]> Closes: dynup#1391 ("CONFIG_WERROR=y and CONFIG_LD_ORPHAN_WARN_LEVEL="error" break kpatch-build") Signed-off-by: Joe Lawrence <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for b857c4e - Browse repository at this point
Copy the full SHA b857c4eView commit details -
kpatch-build: cleanup kernel file backup/restore
Temporarily editing kernel tree sources has become a recurring requirement in kpatch-build. Pull the saving/restoring of these files into a common function helpers to standardize the pattern. Reported-and-tested-by: Zhijun Wang <[email protected]> Signed-off-by: Joe Lawrence <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4003ca5 - Browse repository at this point
Copy the full SHA 4003ca5View commit details -
Fix formatting issue and date error
Configuration menu - View commit details
-
Copy full SHA for c8e6949 - Browse repository at this point
Copy the full SHA c8e6949View commit details -
kpatch-build: Add sym->has_func_profiling support for aarch64
The "has_function_profiling" support field in the symbol struct is used to show that a function symbol is able to be patched. This is necessary to check that functions which need to be patched are able to be. On arm64 this means the presence of 2 NOP instructions at function entry which are patched by ftrace to call the ftrace handling code. These 2 NOPs are inserted by the compiler and the location of them is recorded in a section called "__patchable_function_entries". Check whether a symbol has a corresponding entry in the "__patchable_function_entries" section and if so mark it as "has_func_profiling". Signed-off-by: Suraj Jitindar Singh <[email protected]> --- V1->V2: - Make error message standard across architectures when no patchable entry - Don't store __patchable_function_entries section in kpatch_find_func_profiling_calls(), instead find it each time
Configuration menu - View commit details
-
Copy full SHA for fc87070 - Browse repository at this point
Copy the full SHA fc87070View commit details -
create-diff-object: Split kpatch_create_mcount_sections into alloc an…
…d populate The function kpatch_create_mcount_sections() allocates the __mcount_loc section and then populates it with functions which have a patchable entry. The following patch will add aarch64 support to this function where the allocation will have to be done before the kelf_patched is torn down. Thus split this function so that the allocation can be performed earlier and the populating as before. No intended functional change. Signed-off-by: Suraj Jitindar Singh <[email protected]> --- V1->V2: - Add patch to series
Configuration menu - View commit details
-
Copy full SHA for 3521a46 - Browse repository at this point
Copy the full SHA 3521a46View commit details -
create-diff-object: Create __patchable_function_entries section for a…
…arch64 The __mcount_loc section contains the addresses of patchable ftrace sites which is used by the ftrace infrastructure in the kernel to create a list of tracable functions and to know where to patch to enable tracing of them. On aarch64 this section is called __patchable_function_entries and is generated by the compiler. Either of __mcount_loc or __patchable_function_entries is recognised by the kernel but for aarch64 use __patchable_function_entries as it is what is expected. Add aarch64 support to kpatch_alloc_mcount_sections(). The SHF_LINK_ORDER section flag must be copied to ensure that it matches to avoid the following: ld: __patchable_function_entries has both ordered [...] and unordered [...] sections Add aarch64 support to kpatch_populate_mcount_sections(). Check for the 2 required NOP instructions on function entry, which may be preceded by a BTI C instruction depending on whether the function is a leaf function. This determines the offset of the patch site. Signed-off-by: Suraj Jitindar Singh <[email protected]> --- V1->V2: - Don't preserve the __patchable_function_entries section from the patched elf as this is already verified by kpatch_check_func_profiling_calls() - Instead get the patch entry offset by checking for a preceding BTI C instr - Copy the section flags for __patchable_function_entries --- rebased, added sh_link fix from Suraj's later commit "kpatch-build: Enable ARM64 support" Signed-off-by: Pete Swain <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 22ccb91 - Browse repository at this point
Copy the full SHA 22ccb91View commit details -
kpatch-build: Enable ARM64 support
Add the final support required for aarch64 and enable building on that arch. Signed-off-by: Suraj Jitindar Singh <[email protected]> --- V1->V2: - Add # shellcheck disable=SC2086 - Add comment to kpatch_is_mapping_symbol()
Configuration menu - View commit details
-
Copy full SHA for 3650f3a - Browse repository at this point
Copy the full SHA 3650f3aView commit details -
create-diff-object: add aarch64 ASSERT_RTNL macro detection
On aarch64, only the ASSERT_RTNL macro is affected by source line number changes (WARN, BUG, etc. no longer embed line numbers in the instruction stream.) A small test function that invokes the macro for a line change from 42 to 43: 0000000000000000 <test_assert_rtnl>: 0: d503245f bti c 4: d503201f nop 8: d503201f nop c: d503233f paciasp 10: a9bf7bfd stp x29, x30, [sp, #-16]! 14: 910003fd mov x29, sp 18: 94000000 bl 0 <rtnl_is_locked> 18: R_AARCH64_CALL26 rtnl_is_locked 1c: 34000080 cbz w0, 2c <test_assert_rtnl+0x2c> 20: a8c17bfd ldp x29, x30, [sp], dynup#16 24: d50323bf autiasp 28: d65f03c0 ret 2c: 90000000 adrp x0, 0 <test_assert_rtnl> 2c: R_AARCH64_ADR_PREL_PG_HI21 .data.once 30: 39400001 ldrb w1, [x0] 30: R_AARCH64_LDST8_ABS_LO12_NC .data.once 34: 35ffff61 cbnz w1, 20 <test_assert_rtnl+0x20> 38: 52800022 mov w2, #0x1 // #1 3c: 90000001 adrp x1, 0 <test_assert_rtnl> 3c: R_AARCH64_ADR_PREL_PG_HI21 .rodata.str1.8+0x8 40: 39000002 strb w2, [x0] 40: R_AARCH64_LDST8_ABS_LO12_NC .data.once 44: 91000021 add x1, x1, #0x0 44: R_AARCH64_ADD_ABS_LO12_NC .rodata.str1.8+0x8 - 48: 52800542 mov w2, #0x2a // dynup#42 + 48: 52800562 mov w2, #0x2b // dynup#43 4c: 90000000 adrp x0, 0 <test_assert_rtnl> 4c: R_AARCH64_ADR_PREL_PG_HI21 .rodata.str1.8+0x20 50: 91000000 add x0, x0, #0x0 50: R_AARCH64_ADD_ABS_LO12_NC .rodata.str1.8+0x20 54: 94000000 bl 0 <__warn_printk> 54: R_AARCH64_CALL26 __warn_printk 58: d4210000 brk #0x800 5c: 17fffff1 b 20 <test_assert_rtnl+0x20> Create an implementation of kpatch_line_macro_change_only() for aarch64 modeled after the other architectures. Only look for relocations to __warn_printk that ASSERT_RTNL invokes. Based-on-s390x-code-by: C. Erastus Toe <[email protected]> Signed-off-by: Joe Lawrence <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 52842ef - Browse repository at this point
Copy the full SHA 52842efView commit details -
Update the kpatch-unit-test-objs submodule reference to add aarch64 unit tests. Signed-off-by: Joe Lawrence <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 62e3ba3 - Browse repository at this point
Copy the full SHA 62e3ba3View commit details -
create-diff-object: Fix mapping symbol handling on aarch64
It seems mapping symbols in aarch64 elf has section size of 0. So, exclude it in section symbol replacing code just like kpatch_correlate_symbols(). This fixes the data-read-mostly unit test on aarch64. Signed-off-by: Misono Tomohiro <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e46ddb3 - Browse repository at this point
Copy the full SHA e46ddb3View commit details -
kpatch-syscall.h: add aarch64 helper
Copy from kernel source tree. Signed-off-by: Misono Tomohiro <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9479442 - Browse repository at this point
Copy the full SHA 9479442View commit details -
Configuration menu - View commit details
-
Copy full SHA for a475523 - Browse repository at this point
Copy the full SHA a475523View commit details -
arm64: per-func __patchable_function_entries sections
new clang toolchain on arm64 produces individual __patchable_function_entries sections for each patchable func, in -ffunction-sections mode, rather than traditional single __mcount_loc section. Bend the existing logic to detect this multiplicity in the incoming kelf objects, and allocate N identical one-entry sections. These are retrieved as needed by a new function: find_nth_section_by_name() and attached to the .text sections they describe. These __pfe section are not actually arm64-specific, but a generic enhancement across gcc & clang, to allow better garbage collection of unreferenced object sections, and mcount/pfe objects which refer to them. The __pfe sections are combined in kernel-or-module final link, from 5.19.9's 9440155ccb948f8e3ce5308907a2e7378799be60. From clang-11, __pfe is supported for x86, though not yet used by kernel The split between allocate/populate phases here is necessary to enumerate/populate the outgoing section-headers before beginning to produce output sections Also adds some missing \n to log_debug()s Signed-off-by: Pete Swain <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 17a90ec - Browse repository at this point
Copy the full SHA 17a90ecView commit details -
On arm64, kpatch_find_func_profiling_calls() was skipping leaf functions, with no relocations, so they weren't patchable. Here other archs need to walk a function's reloc entries to check for __fentry__ or __mcount, so it's valid to skip over functions without sym->sec->rela, because they cannot be patchable, else they would have at least an __fentry__ call relocation. But arm64 marks functions patchable in a different way, with per-func __patchable_function_entries sections referring _to_ the func, not relocations _within_ the func, so a function w/o relocations for text or data can still be patchable. Move the sym->sec->rela check to the per-arch paths. This allows gcc-static-local-var-5.patch to generate livepatch, on arm64 & x86 Suggested-By: Bill Wendling <[email protected]> Signed-off-by: Pete Swain <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9012da5 - Browse repository at this point
Copy the full SHA 9012da5View commit details -
kpatch-cc skip arch/arm64/kernel/vdso*/*
Signed-off-by: Pete Swain <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9dd4923 - Browse repository at this point
Copy the full SHA 9dd4923View commit details -
New toolchain/arch, new conventions for section/label/etc names gcc's .LCx symbols point to string literals in '.rodata.<func>.str1.*' sections. Clang creates similar .Ltmp%d symbols in '.rodata.str' The function is_string_literal_section() generalized (too much?) to match either - clang's/arm64 /^\.rodata\.str$/ - gcc's /^\.rodata\./ && /\.str1\./ Various matchers for .data.unlikely .bss.unlikely replaced by is_data_unlikely_section() generalized to match - gcc's ".data.unlikely" - clang's ".(data|bss).module_name.unlikely" .data.once handled similarly Signed-off-by: Pete Swain <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2e26ee2 - Browse repository at this point
Copy the full SHA 2e26ee2View commit details -
testing: freshen unit tests to address ppc64le fails
merged in joe-lawrence/ppc64le-remove-eh_frame-take2 this should resolve github's test failures
Configuration menu - View commit details
-
Copy full SHA for 5c31d6a - Browse repository at this point
Copy the full SHA 5c31d6aView commit details -
create-diff-object: merge aarch64 kpatch_line_macro_change_only()
Generalized kpatch_line_macro_change_only() & insn_is_load_immediate() to collapse the aarch64 support back into parent. I'm assuming the 3rd start1 of the original /* Verify mov w2 <line number> */ if (((start1[offset] & 0b11111) != 0x2) || (start1[offset+3] != 0x52) || ((start1[offset] & 0b11111) != 0x2) || (start2[offset+3] != 0x52)) was a typo for start2. That's now absorbed into insn_is_load_immediate() leaving just one aarch64-specific piece: thinning out the match-list for diagnosing a __LINE__ reference, to just "__warn_printf".
Configuration menu - View commit details
-
Copy full SHA for 141d8a1 - Browse repository at this point
Copy the full SHA 141d8a1View commit details -
create-diff-object: keep ubsan section
If CONFIG_UBSAN is enabled, ubsan section (.data..Lubsan_{data,type}) can be created. Keep them unconditionally. NOTE: This patch needs to be verified. Signed-off-by: Misono Tomohiro <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3005626 - Browse repository at this point
Copy the full SHA 3005626View commit details -
Initialize add_off earlier, so it's obviously never used uninitialized. Clang was warning on this, even if gcc was not. No functional change, the only path which left it undefined would call ERROR() anyway.
Configuration menu - View commit details
-
Copy full SHA for 41375b5 - Browse repository at this point
Copy the full SHA 41375b5View commit details -
create-diff-object: Remove the multi_pfe flag.
In ARM64, every function section should have its own pfe section. It is a bug in GCC 11/12 which will only generate a single pfe section for all functions. The bug has been fixed in GCC 13.1. As the create-diff-object is generating the pfe sections on its own, we should also fix this bug, instead of try to repeat the bug. -- Adjusted whitespace in Zimao's proposed code. Signed-off-by: Pete Swain <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for c48342c - Browse repository at this point
Copy the full SHA c48342cView commit details -
create-diff-object: add init value for pfe flag
Set pfe_per_function default to false.
Configuration menu - View commit details
-
Copy full SHA for 9b261ab - Browse repository at this point
Copy the full SHA 9b261abView commit details
Commits on Jun 6, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 3fb4582 - Browse repository at this point
Copy the full SHA 3fb4582View commit details