[PATCH 5.15.y v1 0/2] Return EADDRNOTAVAIL when func matches several symbols during kprobe creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!


The second patch of this series caused some troubles on 5.15.y, I apologize
about it [1].
When I tested it locally, I needed to set CONFIG_LIVEPATCH, so
kallsyms_on_each_symbol() would be known at link time.
To cope with this problem, we need to backport the first patch of this series as
pointed by Guenter Roeck [2].
This patch is only needed for 5.15, indeed the dependencies on CONFIG_LIVEPATCH
for kallsyms_on_each_symbol() was added in 3e3552056ab4
("kallsyms: only build {,module_}kallsyms_on_each_symbol when required").
This commit was first added to kernel 5.12, as git indicates it:
$ git name-rev --tags --name-only 3e3552056ab4
v5.12-rc1~67^2~8
Moreover, the first patch of this series, i.e. d721def7392a
("kallsyms: Make kallsyms_on_each_symbol generally available") was first added
in:
$ git name-rev --tags --name-only d721def7392a
v5.19-rc1~159^2~4^2~38^2~4
So, my patch only needs the first patch for the 5.15 kernel.

Regarding these two patches, I built and tested the series for several
architectures:
* i386:
  $ make ARCH=i386 defconfig kvm_guest.config
  ...
  $ make ARCH=i386 -j$(nproc)
  ...
    Kernel: arch/x86/boot/bzImage is ready  (#1)
  $ bash run_extern_kernel.sh i386
  ...
  root@vm-i386:~# uname -mr
  5.15.140+ i686
  root@vm-i386:~# echo 'p:myprobe name_show' > /sys/kernel/tracing/kprobe_events
  -bash: echo: write error: Cannot assign requested address
* x86_64:
  $ make x86_64_defconfig kvm_guest.config
  ...
  $ make -j$(nproc)
  ...
    Kernel: arch/x86/boot/bzImage is ready  (#9)
  $ bash run_extern_kernel.sh
  ...
  root@vm-amd64:~# uname -rm
  5.15.140+ x86_64
  root@vm-amd64:~# echo 'p:myprobe name_show' > /sys/kernel/tracing/kprobe_events
  -bash: echo: write error: Cannot assign requested address
* arm:
  $ make ARCH=arm defconfig kvm_guest.config
  ...
  $ make ARCH=arm menuconfig
  # Add CONFIG_KPROBES
  $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j$(nproc)
  ...
    Kernel: arch/arm/boot/zImage is ready
  $ bash run_extern_kernel.sh armel
  ...
  root@vm-armel:~# uname -mr
  5.15.140-00002-gd3fdc3ca50b5 armv7l
  root@vm-armel:~# echo 'p:myprobe name_show' > /sys/kernel/tracing/kprobe_events
  -bash: echo: write error: Cannot assign requested address
* arm64:
  $ make ARCH=arm64 defconfig kvm_guest.config
  # Add CONFIG_KPROBES
  ...
  $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j$(nproc)
  ...
    OBJCOPY arch/arm64/boot/Image
    GZIP    arch/arm64/boot/Image.gz
  $ bash run_extern_kernel.sh arm64
  ...
  root@vm-arm64:~# uname -mr
  5.15.140-00002-gd3fdc3ca50b5 aarch64
  root@vm-arm64:~# echo 'p:myprobe name_show' > /sys/kernel/tracing/kprobe_events
  -bash: echo: write error: Cannot assign requested address

If you see any ways to improve this patch, please share your feedback.

Francis Laniel (1):
  tracing/kprobes: Return EADDRNOTAVAIL when func matches several
    symbols

Jiri Olsa (1):
  kallsyms: Make kallsyms_on_each_symbol generally available

 include/linux/kallsyms.h    |  7 +++-
 kernel/kallsyms.c           |  2 -
 kernel/trace/trace_kprobe.c | 74 +++++++++++++++++++++++++++++++++++++
 kernel/trace/trace_probe.h  |  1 +
 4 files changed, 81 insertions(+), 3 deletions(-)


Best regards.
---
[1]: https://lore.kernel.org/stable/CAEUSe78tYPTFuauB7cxZzvAeMhzB_25Q8DqLUfF7Nro9WsUhNw@xxxxxxxxxxxxxx/
[2]: https://lore.kernel.org/stable/06deae26-c59c-4746-867d-ab6f5852b0af@xxxxxxxxxxxx/
--
2.34.1





[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux