Hi Aaron, On Tue, Nov 24, 2026 at 08:33:59PM -0500, Aaron Merey wrote: > On Mon, Nov 23, 2026 at 11:18 AM Mark Wielaard <[email protected]> wrote: > > diff --git a/libelf/elf32_getphdr.c b/libelf/elf32_getphdr.c > > index e41c660daf54..e9828b46f97b 100644 > > --- a/libelf/elf32_getphdr.c > > +++ b/libelf/elf32_getphdr.c > > [...] > > @@ -129,16 +128,12 @@ __elfw2(LIBELFBITS,getphdr_wrlock) (Elf *elf) > > byte order. */ > > > > if (ehdr->e_ident[EI_DATA] == MY_ELFDATA) > > - { > > - assert (! ALLOW_UNALIGNED); > > - memcpy (phdr, file_phdr, size); > > - } > > + memcpy (phdr, file_phdr, size); > > else > > { > > - bool copy = ! (ALLOW_UNALIGNED > > - || ((uintptr_t) file_phdr > > - & (__alignof__ (ElfW2(LIBELFBITS,Phdr)) > > - - 1)) == 0); > > + bool copy = ((uintptr_t) file_phdr > > + & (__alignof__ (ElfW2(LIBELFBITS,Phdr)) - 1 > > + != 0)); > > The closing brackets are misplaced. As written this is equivalent to > bool copy = (uintptr_t) file_phdr & 1; > which sets copy to true iff file_phdr is odd. Odd addresses are always > misaligned but this skips copying a misaligned file_phdr when the > address is even. > > It should instead be written > ((uintptr_t) file_phdr > & (__alignof__ (ElfW2(LIBELFBITS,Phdr)) - 1)) != 0;
Oops. Too many brackets. > The rest of the patches in this series LGTM except there is still one > ALLOW_UNALIGNED remaining in gelf_xlate.c which should also be removed > in this series. O right, sorry I missed that. It should indeed be removed and the fallback should use memcpy instead of the packed union trick. I'll apply the first 5 patches in this series, then post a V2 for the rest that includes the xlate cleanup. Thanks, Mark
