From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>,
Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org>,
Carlos O'Donell <carlos@redhat.com>,
Joseph Myers <joseph@codesourcery.com>
Subject: Re: [PATCH] elf: Replace tst-p_alignmod1-editX with a python script
Date: Wed, 26 Jan 2022 12:54:19 -0300 [thread overview]
Message-ID: <38575072-69d4-872c-1397-84b65f840604@linaro.org> (raw)
In-Reply-To: <CAMe9rOrUE8DnKe1wvqfY3kQDZ1ziV5sqoWgx24zjgury_xXs3A@mail.gmail.com>
On 26/01/2022 12:46, H.J. Lu wrote:
> On Wed, Jan 26, 2022 at 7:45 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>>
>>
>> On 26/01/2022 12:35, H.J. Lu wrote:
>>> On Wed, Jan 26, 2022 at 4:10 AM Adhemerval Zanella
>>> <adhemerval.zanella@linaro.org> wrote:
>>>>
>>>>
>>>>
>>>> On 26/01/2022 07:09, Florian Weimer wrote:
>>>>> * Adhemerval Zanella via Libc-alpha:
>>>>>
>>>>>> diff --git a/scripts/tst-elf-edit.py b/scripts/tst-elf-edit.py
>>>>>> new file mode 100644
>>>>>> index 0000000000..1fb9b8e0fe
>>>>>> --- /dev/null
>>>>>> +++ b/scripts/tst-elf-edit.py
>>>>>> @@ -0,0 +1,206 @@
>>>>>
>>>>>> +class Elf_Ehdr:
>>>>>> + def __init__(self, e_ident):
>>>>>> + endian, addr, off = elf_types_fmts(e_ident)
>>>>>> + self.fmt = '{0}HHI{1}{2}{2}IHHHHHH'.format(endian, addr, off)
>>>>>> + self.len = struct.calcsize(self.fmt)
>>>>>> +
>>>>>> + def read(self, f):
>>>>>> + buf = f.read(self.len)
>>>>>> + if not buf:
>>>>>> + error('{}: header too small'.format(f.name))
>>>>>
>>>>> I think you need to check len(buf) < self.len.
>>>>
>>>> Ack.
>>>>
>>>>>
>>>>>> +class Elf_Phdr:
>>>>>> + def __init__(self, e_ident):
>>>>>> + endian, addr, off = elf_types_fmts(e_ident)
>>>>>> + self.ei_class = e_ident[EI_CLASS]
>>>>>> + if self.ei_class == ELFCLASS32:
>>>>>> + self.fmt = '{0}I{2}{1}{1}IIII'.format(endian, addr, off)
>>>>>> + else:
>>>>>> + self.fmt = '{0}II{2}{1}{1}QQQ'.format(endian, addr, off)
>>>>>> + self.len = struct.calcsize(self.fmt)
>>>>>> +
>>>>>> + def read(self, f):
>>>>>> + buf = f.read(self.len)
>>>>>> + if not buf:
>>>>>> + error('{}: program header too small'.format(f.name))
>>>>>
>>>>> Here as well.
>>>>
>>>> Ack.
>>>>
>>>>>
>>>>> Rest looks okay.
>>>>
>>>> Thanks, I push it upstream with the above fixes installed.
>>>
>>> I got
>>>
>>> FAIL: elf/tst-p_align3
>>>
>>> [hjl@gnu-tgl-2 build-x86_64-linux]$ cat elf/tst-p_align3.out
>>> /export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/elf/tst-p_align3:
>>> error while loading shared libraries:
>>> /export/build/gnu/tools-build/glibc-cet-gitlab/build-x86_64-linux/elf/tst-p_alignmod3.so:
>>> cannot change memory protections
>>> [hjl@gnu-tgl-2 build-x86_64-linux]$
>>>
>>> Only p_align should be changed to 0x100. But I saw
>>
>> I am not sure if this is related because tst-p_align3 and tst-alignmod3.so uses
>> LDFLAGS instead:
>>
>> 1644 $(objpfx)tst-align3: $(objpfx)tst-alignmod3.so
>> 1645 ifeq (yes,$(have-fpie))
>> 1646 CFLAGS-tst-align3.c += $(PIE-ccflag)
>> 1647 endif
>> 1648 LDFLAGS-tst-align3 += -Wl,-z,max-page-size=0x200000
>> 1649 LDFLAGS-tst-alignmod3.so += -Wl,-z,max-page-size=0x200000
>> 1650 $(objpfx)tst-alignmod3.so: $(libsupport)
>>
>> And the patch only changed the way tst-p_align1 and tst-p_align2 modules were
>> changed.
>
> It is tst-p_alignmod3.so, not tst-alignmod3.so.
> ^^
My confusion here. But even though the script in not involved:
2622 LDFLAGS-tst-p_alignmod3.so += -Wl,-z,max-page-size=0x100,-z,common-page-size=0x100
2623
2624 $(objpfx)tst-p_align3: $(objpfx)tst-p_alignmod3.so
2625 $(objpfx)tst-p_align3.out: tst-p_align3.sh $(objpfx)tst-p_align3
2626 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)'; \
2627 $(evaluate-test)
That's why it is puzzling me that it start to fail now.
next prev parent reply other threads:[~2022-01-26 15:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-25 17:05 Adhemerval Zanella
2022-01-26 10:09 ` Florian Weimer
2022-01-26 12:10 ` Adhemerval Zanella
2022-01-26 15:35 ` H.J. Lu
2022-01-26 15:45 ` Adhemerval Zanella
2022-01-26 15:46 ` H.J. Lu
2022-01-26 15:54 ` Adhemerval Zanella [this message]
2022-01-26 16:11 ` H.J. Lu
2022-01-26 17:11 ` Adhemerval Zanella
2022-01-26 21:43 ` H.J. Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=38575072-69d4-872c-1397-84b65f840604@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=carlos@redhat.com \
--cc=fweimer@redhat.com \
--cc=hjl.tools@gmail.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).