[Bug libelf/28101] elf_strptr slow with address sanitizer, passes entire section range to memrchr.

mark at klomp dot org sourceware-bugzilla@sourceware.org
Mon Jul 19 13:58:41 GMT 2021


Mark Wielaard <mark at klomp dot org> changed:

           What    |Removed                     |Added
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Mark Wielaard <mark at klomp dot org> ---
(In reply to Jan Smets from comment #2)
> The patch optimizes perfectly and avoids the expensive call.

Thanks for testing, I pushed a variant of the fix as:

commit 0aed4315b2f6c54f4efcf8a8d22e59a36e6eb30d
Author: Mark Wielaard <mark@klomp.org>
Date:   Mon Jul 19 15:52:51 2021 +0200

    libelf: Optimize elf_strptr.c validate_str by checking last char first

    In most cases the last char of the sectio will be zero. Check that
    first before calling memrchr. This is a minor optimization in normal
    cases. But it helps asan a lot by removing the memrchr call in most


    Signed-off-by: Mark Wielaard <mark@klomp.org>

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

More information about the Elfutils-devel mailing list