Patch "libbpf: don't adjust USDT semaphore address if .stapsdt.base addr is missing" has been added to the 6.13-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    libbpf: don't adjust USDT semaphore address if .stapsdt.base addr is missing

to the 6.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     libbpf-don-t-adjust-usdt-semaphore-address-if-.staps.patch
and it can be found in the queue-6.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 624da46e36a5507a36369924b7b9eb93b1d75030
Author: Andrii Nakryiko <andrii@xxxxxxxxxx>
Date:   Thu Nov 21 14:45:58 2024 -0800

    libbpf: don't adjust USDT semaphore address if .stapsdt.base addr is missing
    
    [ Upstream commit 98ebe5ef6f5c4517ba92fb3e56f95827ebea83fd ]
    
    USDT ELF note optionally can record an offset of .stapsdt.base, which is
    used to make adjustments to USDT target attach address. Currently,
    libbpf will do this address adjustment unconditionally if it finds
    .stapsdt.base ELF section in target binary. But there is a corner case
    where .stapsdt.base ELF section is present, but specific USDT note
    doesn't reference it. In such case, libbpf will basically just add base
    address and end up with absolutely incorrect USDT target address.
    
    This adjustment has to be done only if both .stapsdt.sema section is
    present and USDT note is recording a reference to it.
    
    Fixes: 74cc6311cec9 ("libbpf: Add USDT notes parsing and resolution logic")
    Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
    Acked-by: Jiri Olsa <jolsa@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241121224558.796110-1-andrii@xxxxxxxxxx
    Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/lib/bpf/usdt.c b/tools/lib/bpf/usdt.c
index 5f085736c6c45..4e4a52742b01c 100644
--- a/tools/lib/bpf/usdt.c
+++ b/tools/lib/bpf/usdt.c
@@ -661,7 +661,7 @@ static int collect_usdt_targets(struct usdt_manager *man, Elf *elf, const char *
 		 *   [0] https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation
 		 */
 		usdt_abs_ip = note.loc_addr;
-		if (base_addr)
+		if (base_addr && note.base_addr)
 			usdt_abs_ip += base_addr - note.base_addr;
 
 		/* When attaching uprobes (which is what USDTs basically are)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux