• Hengqi Chen's avatar
    selftests/bpf: Add tests for symbol versioning for uprobe · 7089f85a
    Hengqi Chen authored
    This exercises the newly added dynsym symbol versioning logics.
    Now we accept symbols in form of func, func@LIB_VERSION or
    func@@LIB_VERSION.
    
    The test rely on liburandom_read.so. For liburandom_read.so, we have:
    
        $ nm -D liburandom_read.so
                         w __cxa_finalize@GLIBC_2.17
                         w __gmon_start__
                         w _ITM_deregisterTMCloneTable
                         w _ITM_registerTMCloneTable
        0000000000000000 A LIBURANDOM_READ_1.0.0
        0000000000000000 A LIBURANDOM_READ_2.0.0
        000000000000081c T urandlib_api@@LIBURANDOM_READ_2.0.0
        0000000000000814 T urandlib_api@LIBURANDOM_READ_1.0.0
        0000000000000824 T urandlib_api_sameoffset@LIBURANDOM_READ_1.0.0
        0000000000000824 T urandlib_api_sameoffset@@LIBURANDOM_READ_2.0.0
        000000000000082c T urandlib_read_without_sema@@LIBURANDOM_READ_1.0.0
        00000000000007c4 T urandlib_read_with_sema@@LIBURANDOM_READ_1.0.0
        0000000000011018 D urandlib_read_with_sema_semaphore@@LIBURANDOM_READ_1.0.0
    
    For `urandlib_api`, specifying `urandlib_api` will cause a conflict because
    there are two symbols named urandlib_api and both are global bind.
    For `urandlib_api_sameoffset`, there are also two symbols in the .so, but
    both are at the same offset and essentially they refer to the same function
    so no conflict.
    Signed-off-by: default avatarHengqi Chen <hengqi.chen@gmail.com>
    Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
    Reviewed-by: default avatarAlan Maguire <alan.maguire@oracle.com>
    Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
    Link: https://lore.kernel.org/bpf/20230918024813.237475-4-hengqi.chen@gmail.com
    7089f85a
urandom_read.c 2.19 KB