1. 22 Sep, 2023 2 commits
    • Hengqi Chen's avatar
      libbpf: Support symbol versioning for uprobe · bb7fa093
      Hengqi Chen authored
      In current implementation, we assume that symbol found in .dynsym section
      would have a version suffix and use it to compare with symbol user supplied.
      According to the spec ([0]), this assumption is incorrect, the version info
      of dynamic symbols are stored in .gnu.version and .gnu.version_d sections
      of ELF objects. For example:
      
          $ nm -D /lib/x86_64-linux-gnu/libc.so.6 | grep rwlock_wrlock
          000000000009b1a0 T __pthread_rwlock_wrlock@GLIBC_2.2.5
          000000000009b1a0 T pthread_rwlock_wrlock@@GLIBC_2.34
          000000000009b1a0 T pthread_rwlock_wrlock@GLIBC_2.2.5
      
          $ readelf -W --dyn-syms /lib/x86_64-linux-gnu/libc.so.6 | grep rwlock_wrlock
            706: 000000000009b1a0   878 FUNC    GLOBAL DEFAULT   15 __pthread_rwlock_wrlock@GLIBC_2.2.5
            2568: 000000000009b1a0   878 FUNC    GLOBAL DEFAULT   15 pthread_rwlock_wrlock@@GLIBC_2.34
            2571: 000000000009b1a0   878 FUNC    GLOBAL DEFAULT   15 pthread_rwlock_wrlock@GLIBC_2.2.5
      
      In this case, specify pthread_rwlock_wrlock@@GLIBC_2.34 or
      pthread_rwlock_wrlock@GLIBC_2.2.5 in bpf_uprobe_opts::func_name won't work.
      Because the qualified name does NOT match `pthread_rwlock_wrlock` (without
      version suffix) in .dynsym sections.
      
      This commit implements the symbol versioning for dynsym and allows user to
      specify symbol in the following forms:
        - func
        - func@LIB_VERSION
        - func@@LIB_VERSION
      
      In case of symbol conflicts, error out and users should resolve it by
      specifying a qualified name.
      
        [0]: https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/symversion.htmlSigned-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-3-hengqi.chen@gmail.com
      bb7fa093
    • Hengqi Chen's avatar
      libbpf: Resolve symbol conflicts at the same offset for uprobe · 7257cee6
      Hengqi Chen authored
      Dynamic symbols in shared library may have the same name, for example:
      
          $ nm -D /lib/x86_64-linux-gnu/libc.so.6 | grep rwlock_wrlock
          000000000009b1a0 T __pthread_rwlock_wrlock@GLIBC_2.2.5
          000000000009b1a0 T pthread_rwlock_wrlock@@GLIBC_2.34
          000000000009b1a0 T pthread_rwlock_wrlock@GLIBC_2.2.5
      
          $ readelf -W --dyn-syms /lib/x86_64-linux-gnu/libc.so.6 | grep rwlock_wrlock
           706: 000000000009b1a0   878 FUNC    GLOBAL DEFAULT   15 __pthread_rwlock_wrlock@GLIBC_2.2.5
          2568: 000000000009b1a0   878 FUNC    GLOBAL DEFAULT   15 pthread_rwlock_wrlock@@GLIBC_2.34
          2571: 000000000009b1a0   878 FUNC    GLOBAL DEFAULT   15 pthread_rwlock_wrlock@GLIBC_2.2.5
      
      Currently, users can't attach a uprobe to pthread_rwlock_wrlock because
      there are two symbols named pthread_rwlock_wrlock and both are global
      bind. And libbpf considers it as a conflict.
      
      Since both of them are at the same offset we could accept one of them
      harmlessly. Note that we already does this in elf_resolve_syms_offsets.
      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-2-hengqi.chen@gmail.com
      7257cee6
  2. 21 Sep, 2023 36 commits
  3. 20 Sep, 2023 2 commits
    • Linus Torvalds's avatar
      Merge tag 'media/v6.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · 42dc8149
      Linus Torvalds authored
      Pull media fixes from Mauro Carvalho Chehab:
      
       - driver fixes due to incorrect fwnode_handle_put() call
      
       - bt8xx: bttv_risc_packed(): remove field checks
      
       - vb2: frame_vector.c: replace WARN_ONCE with a comment
      
       - imx219: a couple typo fixes and perform a full mode set
         unconditionally
      
       - uvcvideo: Fix OOB read
      
       - some dependency fixes
      
      * tag 'media/v6.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
        media: imx-mipi-csis: Remove an incorrect fwnode_handle_put() call
        media: vb2: frame_vector.c: replace WARN_ONCE with a comment
        media: uvcvideo: Fix OOB read
        media: bt8xx: bttv_risc_packed(): remove field checks
        media: i2c: rdacm21: Remove an incorrect fwnode_handle_put() call
        media: i2c: imx219: Perform a full mode set unconditionally
        media: i2c: imx219: Fix crop rectangle setting when changing format
        media: i2c: imx219: Fix a typo referring to a wrong variable
        media: i2c: max9286: Remove an incorrect fwnode_handle_put() call
        media: ivsc: Depend on VIDEO_DEV
        media: via: Use correct dependency for camera sensor drivers
        media: v4l: Use correct dependency for camera sensor drivers
        media: pci: ivsc: Select build dependencies
      42dc8149
    • Linus Torvalds's avatar
      Merge tag 'for-6.6-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · a229cf67
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "A few more followup fixes to the directory listing.
      
        People have noticed different behaviour compared to other filesystems
        after changes in 6.5. This is now unified to more "logical" and
        expected behaviour while still within POSIX. And a few more fixes for
        stable.
      
         - change behaviour of readdir()/rewinddir() when new directory
           entries are created after opendir(), properly tracking the last
           entry
      
         - fix race in readdir when multiple threads can set the last entry
           index for a directory
      
        Additionally:
      
         - use exclusive lock when direct io might need to drop privs and call
           notify_change()
      
         - don't clear uptodate bit on page after an error, this may lead to a
           deadlock in subpage mode
      
         - fix waiting pattern when multiple readers block on Merkle tree
           data, switch to folios"
      
      * tag 'for-6.6-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: fix race between reading a directory and adding entries to it
        btrfs: refresh dir last index during a rewinddir(3) call
        btrfs: set last dir index to the current last index when opening dir
        btrfs: don't clear uptodate on write errors
        btrfs: file_remove_privs needs an exclusive lock in direct io write
        btrfs: convert btrfs_read_merkle_tree_page() to use a folio
      a229cf67