[Rpm-maint] [PATCH] debugedit: Check .debug_str index is valid before use.

Panu Matilainen pmatilai at redhat.com
Mon Mar 12 13:55:26 UTC 2018


On 03/12/2018 03:27 PM, Mark Wielaard wrote:
> Hi Panu,
> 
> On Mon, 2018-03-12 at 14:07 +0200, Panu Matilainen wrote:
>> Actually, this breaks a bunch of testcases:
>>
>> 139: rpmbuild debuginfo subpackages multiple         FAILED
>> (rpmbuild.at:973)
>> 140: rpmbuild debuginfo subpackages multiple unique  FAILED
>> (rpmbuild.at:1058)
>> 141: rpmbuild debuginfo subpackages multiple unique debugsource FAILED
>> (rpmbuild.at:1143)
>> 142: rpmbuild debuginfo subpackages multiple excluded FAILED
>> (rpmbuild.at:1231)
>> 143: rpmbuild debuginfo subpackages multiple excluded FAILED
>> (rpmbuild.at:1296)
>>
>> They're all failing with messages like this:
>>
>> /home/pmatilai/repos/rpm/tests/testing/usr/lib/rpm/debugedit:
>> /home/pmatilai/repos/rpm/tests/testing/build/BUILDROOT/test-1.0-1.x86_64/bin/hello2:
>> Bad string pointer index 678 for unit name
> 
> That is embarrassing. I was sure I got zero FAIL on the testsuite
> before sending the patch. But now I see the same (on Fedora 27).
> 
> It might be because ./tests/testing/usr/lib/rpm/debugedit doesn't seem
> to be regenerated by the build. So you only see it on a fully fresh
> build, not on an incremental one.

Yup, the logic to update the test root contents is far from perfect...
'rm -rf tests/testing' works for forcing the issue though.

> 
> This is an interesting bug, because it was latent. We were already
> accessing a bad string before, but for some reason we got away with it.
> 
> This code walks over the DIE tree in two phases. In phase zero we want
> to collect the comp_dir (either from the DW_AT_comp_dir or the
> DW_AT_name of the compile unit). The bug happens in phase 1, when we
> don't need to collect the comp_dir. But we still do, wrongly using the
> old string table... So the error is kind of correct.
> 
> Fix attached, which looks a bit funny, but really only wraps the
> affected code in an if (phase == 0) block.

Ack, thanks for the explanation and the fast fix! Applied.

	- Panu -

> 
> Cheers,
> 
> Mark
> 



More information about the Rpm-maint mailing list