bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/30150] addr2line returns wrong results after several thous


From: lveyde at gmail dot com
Subject: [Bug binutils/30150] addr2line returns wrong results after several thousands of requests in pipe mode
Date: Wed, 22 Feb 2023 20:32:12 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=30150

--- Comment #24 from Lev Veyde <lveyde at gmail dot com> ---
So, as discussed it with Nick it's quite tricky situation.

Some of the affected symbols don't exist in any of the source code files, and
probably are generated using macro or some other construct, but a similar
symbol does exist, with it's own address.

I.e. x86_pmu_handle_irq function clearly exists in the arch/x86/events/core.c,
line 1670:

int x86_pmu_handle_irq(struct pt_regs *regs)
{
...

and can be properly resolved:

$ addr2line -fie vmlinux 0xffffffff81008640
x86_pmu_handle_irq
/tmp/linux-5.15.95/arch/x86/events/core.c:1670


However __SCT__x86_pmu_handle_irq can't be found anywhere, and it's created by
the macro which appears in the same file, at line 63:

/*
 * This here uses DEFINE_STATIC_CALL_NULL() to get a static_call defined
 * from just a typename, as opposed to an actual function.
 */
DEFINE_STATIC_CALL_NULL(x86_pmu_handle_irq,  *x86_pmu.handle_irq);

...


The macro include flow is generally:

include/linux/static_call.h:    that contains #define
DEFINE_STATIC_CALL_NULL(name, _func):

#define DEFINE_STATIC_CALL_NULL(name, _func)                            \
        DECLARE_STATIC_CALL(name, _func);                               \
        struct static_call_key STATIC_CALL_KEY(name) = {                \
                .func = NULL,                                           \
                .type = 1,                                              \
        };                                                              \
        ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name)



arch/x86/include/asm/static_call.h:    that contains #define
ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name):


#define __ARCH_DEFINE_STATIC_CALL_TRAMP(name, insns)                    \
        asm(".pushsection .static_call.text, \"ax\"             \n"     \
            ".align 4                                           \n"     \
            ".globl " STATIC_CALL_TRAMP_STR(name) "             \n"     \
            STATIC_CALL_TRAMP_STR(name) ":                      \n"     \
            insns "                                             \n"     \
            ".type " STATIC_CALL_TRAMP_STR(name) ", @function   \n"     \
            ".size " STATIC_CALL_TRAMP_STR(name) ", . - "
STATIC_CALL_TRAMP_STR(name) " \n" \
            ".popsection                                        \n")

#define ARCH_DEFINE_STATIC_CALL_TRAMP(name, func)                       \
        __ARCH_DEFINE_STATIC_CALL_TRAMP(name, ".byte 0xe9; .long " #func " - (.
+ 4)")

#ifdef CONFIG_RETHUNK
#define ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name)                        \
        __ARCH_DEFINE_STATIC_CALL_TRAMP(name, "jmp __x86_return_thunk")
#else
#define ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name)                        \
        __ARCH_DEFINE_STATIC_CALL_TRAMP(name, "ret; int3; nop; nop; nop")
#endif



tools/include/linux/static_call_types.h:    that contains #define
STATIC_CALL_TRAMP_STR(name):

#define STATIC_CALL_TRAMP_PREFIX        __SCT__
#define STATIC_CALL_TRAMP_PREFIX_STR    __stringify(STATIC_CALL_TRAMP_PREFIX)
#define STATIC_CALL_TRAMP_PREFIX_LEN    (sizeof(STATIC_CALL_TRAMP_PREFIX_STR) -
1)
#define STATIC_CALL_TRAMP(name)         __PASTE(STATIC_CALL_TRAMP_PREFIX, name)
#define STATIC_CALL_TRAMP_STR(name)     __stringify(STATIC_CALL_TRAMP(name))


So it's not clear why arch/x86/include/asm/paravirt.h file is associated with
the __SCT__ symbols in any way.

If __SCT__x86_pmu_handle_irq to be resolvable to any file, that should have
been  arch/x86/events/core.c:63 as that is where the expanded macro is defined.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]