Message ID | 20220414104611.17748-1-joey.gouly@arm.com (mailing list archive) |
---|---|
Headers | show |
Series | Enable orphan-handling=warn for VDSO | expand |
Hi Joey, On 4/14/22 11:46 AM, Joey Gouly wrote: > Hi all, > > This small series enables the orphan-handling linker flag for the VDSO. > This could catch subtle errors if features that use special sections are > introduced into the VDSO implementation. > > Sorry for the extra version, I forgot to include Kees' and Vincenzo's > reviewed-by tags. That's the only change to the patches. > The patches look fine. Could you please provide some test results with [1] or [2]? [1] https://github.com/nlynch-mentor/vdsotest [2] <kernel_tree>/tools/testing/selftests/vDSO > Changes from v3 [1]: > - Adding missing r-b tags > > Changes from v2 [2]: > - Include vdso compat support > > Thanks, > Joey > > [1]: https://lore.kernel.org/linux-arm-kernel/20220413101832.4594-1-joey.gouly@arm.com/ > [2]: https://lore.kernel.org/linux-arm-kernel/20220407101304.539-1-joey.gouly@arm.com/ > > Joey Gouly (4): > arm64: vdso: put ELF related sections in the linker script > arm64: vdso: enable orphan handling for VDSO > arm64: vdso32: put ELF related sections in the linker script > arm64: vdso32: enable orphan handling for VDSO > > arch/arm64/kernel/vdso/Makefile | 8 +++++++- > arch/arm64/kernel/vdso/vdso.lds.S | 4 ++++ > arch/arm64/kernel/vdso32/Makefile | 1 + > arch/arm64/kernel/vdso32/vdso.lds.S | 4 ++++ > 4 files changed, 16 insertions(+), 1 deletion(-) >
Hi, On Tue, Apr 19, 2022 at 12:10:25PM +0100, Vincenzo Frascino wrote: > Hi Joey, > > On 4/14/22 11:46 AM, Joey Gouly wrote: > > Hi all, > > > > This small series enables the orphan-handling linker flag for the VDSO. > > This could catch subtle errors if features that use special sections are > > introduced into the VDSO implementation. > > > > Sorry for the extra version, I forgot to include Kees' and Vincenzo's > > reviewed-by tags. That's the only change to the patches. > > > > The patches look fine. Could you please provide some test results with [1] or [2]? > > [1] https://github.com/nlynch-mentor/vdsotest > [2] <kernel_tree>/tools/testing/selftests/vDSO Testing with the selftests: $ ./vdso_test_abi TAP version 13 1..16 [vDSO kselftest] VDSO_VERSION: LINUX_2.6.39 # The time is 1650369341.228566 ok 1 vdso_test_gettimeofday(): PASS # clock_id: CLOCK_REALTIME # The time is 1650369341.229413165 ok 2 vdso_test_clock_gettime(): PASS # The vdso resolution is 0 1 # The syscall resolution is 0 1 ok 3 vdso_test_clock_getres(): PASS # clock_id: CLOCK_BOOTTIME # The time is 1524.388896408 ok 4 vdso_test_clock_gettime(): PASS # The vdso resolution is 0 1 # The syscall resolution is 0 1 ok 5 vdso_test_clock_getres(): PASS # clock_id: CLOCK_TAI # The time is 1650369341.231390753 ok 6 vdso_test_clock_gettime(): PASS # The vdso resolution is 0 1 # The syscall resolution is 0 1 ok 7 vdso_test_clock_getres(): PASS # clock_id: CLOCK_REALTIME_COARSE # The time is 1650369341.227127861 ok 8 vdso_test_clock_gettime(): PASS # The vdso resolution is 0 4000000 # The syscall resolution is 0 4000000 ok 9 vdso_test_clock_getres(): PASS # clock_id: CLOCK_MONOTONIC # The time is 1524.391519475 ok 10 vdso_test_clock_gettime(): PASS # The vdso resolution is 0 1 # The syscall resolution is 0 1 ok 11 vdso_test_clock_getres(): PASS # clock_id: CLOCK_MONOTONIC_RAW # The time is 1524.697386720 ok 12 vdso_test_clock_gettime(): PASS # The vdso resolution is 0 1 # The syscall resolution is 0 1 ok 13 vdso_test_clock_getres(): PASS # clock_id: CLOCK_MONOTONIC_COARSE # The time is 1524.389473326 ok 14 vdso_test_clock_gettime(): PASS # The vdso resolution is 0 4000000 # The syscall resolution is 0 4000000 ok 15 vdso_test_clock_getres(): PASS ok 16 # SKIP vdso_test_time(): SKIP: Could not find __kernel_time # Totals: pass:15 fail:0 xfail:0 xpass:0 skip:1 error:0 $ ./vdso_test_correctness Warning: failed to find getcpu in vDSO [RUN] Testing clock_gettime for clock CLOCK_REALTIME (0)... 1650369433.949718175 1650369433.949982211 1650369433.950033907 [OK] Test Passed. [RUN] Testing clock_gettime for clock CLOCK_MONOTONIC (1)... 1617.109425232 1617.109431840 1617.109434048 [OK] Test Passed. [RUN] Testing clock_gettime for clock CLOCK_PROCESS_CPUTIME_ID (2)... 0.039832960 0.039874448 0.039886448 [OK] Test Passed. [RUN] Testing clock_gettime for clock CLOCK_THREAD_CPUTIME_ID (3)... 0.040566320 0.040574576 0.040579552 [OK] Test Passed. [RUN] Testing clock_gettime for clock CLOCK_MONOTONIC_RAW (4)... 1617.415046976 1617.415057616 1617.415059712 [OK] Test Passed. [RUN] Testing clock_gettime for clock CLOCK_REALTIME_COARSE (5)... 1650369433.948175756 1650369433.948175756 1650369433.948175756 [OK] Test Passed. [RUN] Testing clock_gettime for clock CLOCK_MONOTONIC_COARSE (6)... 1617.110521230 1617.110521230 1617.110521230 [OK] Test Passed. [RUN] Testing clock_gettime for clock CLOCK_BOOTTIME (7)... 1617.113039789 1617.113044493 1617.113046269 [OK] Test Passed. [RUN] Testing clock_gettime for clock CLOCK_REALTIME_ALARM (8)... 1650369433.955192243 1650369433.955196547 1650369433.955199811 [OK] Test Passed. [RUN] Testing clock_gettime for clock CLOCK_BOOTTIME_ALARM (9)... 1617.114074714 1617.114079690 1617.114083210 [OK] Test Passed. [RUN] Testing clock_gettime for clock CLOCK_SGI_CYCLE (10)... [OK] No such clock. [RUN] Testing clock_gettime for clock CLOCK_TAI (11)... 1650369433.956495555 1650369433.956498307 1650369433.956500003 [OK] Test Passed. [RUN] Testing clock_gettime for clock invalid (-1)... [OK] No such clock. [RUN] Testing clock_gettime for clock invalid (-2147483648)... [OK] No such clock. [RUN] Testing clock_gettime for clock invalid (2147483647)... [OK] No such clock. [SKIP] No vDSO, so skipping clock_gettime64() tests [RUN] Testing gettimeofday... 1650369433.958323 1650369433.958397 1650369433.958470 [OK] timezones match: minuteswest=0, dsttime=0 [RUN] Testing getcpu... [OK] CPU 0: syscall: cpu 0, node 0 $ ./vdso_test_gettimeofday The time is 1650369462.312523 $ ./vdso_test_clock_getres clock_id: CLOCK_REALTIME [PASS] clock_id: CLOCK_BOOTTIME [PASS] clock_id: CLOCK_TAI [PASS] clock_id: CLOCK_REALTIME_COARSE [PASS] clock_id: CLOCK_MONOTONIC [PASS] clock_id: CLOCK_MONOTONIC_RAW [PASS] clock_id: CLOCK_MONOTONIC_COARSE [PASS] $ ./vdso_test_getcpu Could not find __vdso_getcpu So there was 2 potential issues: - vdso_test_time(): SKIP: Could not find __kernel_time - Could not find __vdso_getcpu I'm not sure what these are, maybe they don't work on arm64 or it's a kernel config issue. Thanks, Joey
Hi Joey, thank you for taking care of the tests. On 4/19/22 1:16 PM, Joey Gouly wrote: > So there was 2 potential issues: > - vdso_test_time(): SKIP: Could not find __kernel_time time() is deprecated hence not supported for aarch64 (see VDSO_HAS_TIME). > - Could not find __vdso_getcpu We do not have getcpu() support in the vDSO library on aarch64. For these reasons the tests are skipped. Hope this clarifies. > > I'm not sure what these are, maybe they don't work on arm64 or it's a kernel config issue. > > Thanks, > Joey
Hi Joey, On Thu, Apr 14, 2022 at 11:46:07AM +0100, Joey Gouly wrote: > This small series enables the orphan-handling linker flag for the VDSO. > This could catch subtle errors if features that use special sections are > introduced into the VDSO implementation. Building the 5.18-rc3 kernel with these patches, I get lots of: aarch64-linux-ld: warning: orphan section `.rela.got' from `arch/arm64/kernel/vdso/vgettimeofday.o' being placed in section `.rela.dyn' aarch64-linux-ld: warning: orphan section `.got' from `arch/arm64/kernel/vdso/vgettimeofday.o' being placed in section `.got' aarch64-linux-ld: warning: orphan section `.got.plt' from `arch/arm64/kernel/vdso/vgettimeofday.o' being placed in section `.got.plt' aarch64-linux-ld: warning: orphan section `.plt' from `arch/arm64/kernel/vdso/vgettimeofday.o' being placed in section `.plt' aarch64-linux-ld: warning: orphan section `.rela.plt' from `arch/arm64/kernel/vdso/vgettimeofday.o' being placed in section `.rela.dyn' arm-linux-gnueabihf-ld: warning: orphan section `.glue_7' from `linker stubs' being placed in section `.glue_7' arm-linux-gnueabihf-ld: warning: orphan section `.glue_7t' from `linker stubs' being placed in section `.glue_7t' arm-linux-gnueabihf-ld: warning: orphan section `.vfp11_veneer' from `linker stubs' being placed in section `.vfp11_veneer' arm-linux-gnueabihf-ld: warning: orphan section `.v4_bx' from `linker stubs' being placed in section `.v4_bx' arm-linux-gnueabihf-ld: warning: orphan section `.rel.got' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.rel.dyn' arm-linux-gnueabihf-ld: warning: orphan section `.got.plt' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.got.plt' arm-linux-gnueabihf-ld: warning: orphan section `.plt' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.plt' arm-linux-gnueabihf-ld: warning: orphan section `.iplt' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.iplt' arm-linux-gnueabihf-ld: warning: orphan section `.rel.iplt' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.rel.dyn' arm-linux-gnueabihf-ld: warning: orphan section `.igot.plt' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.igot.plt' arm-linux-gnueabihf-ld: warning: orphan section `.rel.text' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.rel.dyn' Do they need fixing or there's something wrong with my toolchain?
Hi Catalin, On Wed, Apr 27, 2022 at 07:20:34PM +0100, Catalin Marinas wrote: > Hi Joey, > > On Thu, Apr 14, 2022 at 11:46:07AM +0100, Joey Gouly wrote: > > This small series enables the orphan-handling linker flag for the VDSO. > > This could catch subtle errors if features that use special sections are > > introduced into the VDSO implementation. > > Building the 5.18-rc3 kernel with these patches, I get lots of: > > aarch64-linux-ld: warning: orphan section `.rela.got' from `arch/arm64/kernel/vdso/vgettimeofday.o' being placed in section `.rela.dyn' > aarch64-linux-ld: warning: orphan section `.got' from `arch/arm64/kernel/vdso/vgettimeofday.o' being placed in section `.got' [..] > arm-linux-gnueabihf-ld: warning: orphan section `.rel.iplt' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.rel.dyn' > arm-linux-gnueabihf-ld: warning: orphan section `.igot.plt' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.igot.plt' > arm-linux-gnueabihf-ld: warning: orphan section `.rel.text' from `arch/arm64/kernel/vdso32/note.o' being placed in section `.rel.dyn' > > Do they need fixing or there's something wrong with my toolchain? > I can reproduce this with binutils ld, I was previously testing with LLD. Seems to me that LLD discards more sections than ld. I will fix it and send out v5. Thanks, Joey