[PATCH] libdw: pre-compute leb128 loop limits

Mark Wielaard mjw at redhat.com
Wed Dec 17 15:37:58 UTC 2014


On Tue, 2014-12-16 at 14:15 +0100, Mark Wielaard wrote:
> So at least compared to 0.160 we are not slower (although 0.160 was
> slower than 0.158). But we do have a lot more robustness checking.
> 
> I would like to push the following patches, currently on mjw/pending, to
> master:
> 
> commit 0f512f1201dc606fb1793f4a596d6b773033b10e
> Author: Mark Wielaard <mjw at redhat.com>
> Date:   Tue Dec 16 10:53:22 2014 +0100
> 
>     libdw: Unroll the first get_sleb128 step to help the compiler optimize.
>     
>     The common case is a single-byte. So no extra (max len) calculation is
>     necessary then.
>     
>     Signed-off-by: Mark Wielaard <mjw at redhat.com>
> 
> commit 56698acce00bd0cbc8ace327263dfe147fae18fa
> Author: Josh Stone <jistone at redhat.com>
> Date:   Mon Dec 15 12:18:25 2014 -0800
> 
>     libdw: pre-compute leb128 loop limits
>     
>     Signed-off-by: Josh Stone <jistone at redhat.com>
> 
> commit 1df99d104efaa7d0b824f0761493010027a7303e
> Author: Mark Wielaard <mjw at redhat.com>
> Date:   Sun Dec 14 21:48:23 2014 +0100
> 
>     libdw: Add get_uleb128 and get_sleb128 bounds checking.
>     
>     Both get_uleb128 and get_sleb128 now take an end pointer to prevent
>     reading too much data. Adjust all callers to provide the end pointer.
>     
>     There are still two exceptions. "Raw" dwarf_getabbrevattr and
>     read_encoded_valued don't have a end pointer associated yet.
>     They will have to be provided in the future.
>     
>     Signed-off-by: Mark Wielaard <mjw at redhat.com>
> 
> commit 1e777486d0c0191c7cc3adc29738e51f348cf039
> Author: Mark Wielaard <mjw at redhat.com>
> Date:   Fri Dec 12 16:43:04 2014 +0100
> 
>     libdw: Make sure all attributes come with a (fake) CU for bound checks.
>     
>     All attributes now have a reference to a (fake) CU that has startp and
>     endp set to the data section where the form data comes from. Use that
>     for bounds checking in __libdw_form_val_len and dwarf_formblock to make
>     sure data read doesn't overflow any data section. Remove libdwP.h cu_data
>     and use cu startp and endp directly where appropriate.
>     
>     Signed-off-by: Mark Wielaard <mjw at redhat.com>

I just did push all the above patches to master.

Cheers,

Mark


More information about the elfutils-devel mailing list