[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#928386: syslinux: possible regression bug 'Undef symbol FAIL: memset'

Control: tags -1 + confirmed patch

Hi Andreas,

On Fri, 3 May 2019 14:21:06 +0200
Andreas Steinel <Andreas.Steinel@exirius.de> wrote:

> In version 6.04~git20190206.bf6db5b4+dfsg1-1, the bug that was closed
> in 6.04~git20171011.af7e95c3+dfsg1-6 is back - at least in the 64-bit
> UEFI part, legacy works fine:
> Full log is:
>     Undef symbol FAIL: memset
>     Failed to load libcom32.c32
>     Failed to load COM32 file vesamenu.c32

Thanks for your report.  I've looked at it and can confirm that this
error is back :( .  The good news is only the backports version is
affected and not the version in buster (CC-ing Holger who is the
backports maintainer).

The problem is that the syslinux.efi binary uses the memset and memcpy
implementation from gnu-efi which are incompatible and cause the error
above. It should use the implementation from syslinux instead.

Since the linker has two symbols to choose from, I had added the
`-zmuldefs` flag.  My guess is that the linker from stretch picks the
"wrong" symbol.  I expected the linker would always pick the first one
it encounters which would be the "right" symbol (and that's what
happens in buster).

I've attached a modification of the 0005-gnu-efi-version-compatibility
patch.  Instead of using `-zmuldefs` I'm stripping the memset and memcpy
symbols from gnu-efi so there are no longer any duplicate symbols.
Using that I was able to build a version without that bug for backports.

Holger: Can you take care of updating the backports version? I've run
my little hacky regression-testing script on the modified backports
build and it passed all my tests.

Repack libefi.a to not contain the memset and memcpy symbols to make sure the
implementation from syslinux is used and no multiple symbol definitions are
 efi/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/efi/Makefile
+++ b/efi/Makefile
@@ -43,8 +43,10 @@
 	fs/pxe/pxe.o fs/pxe/tftp.o fs/pxe/urlparse.o fs/pxe/dhcp_option.o \
 	fs/pxe/ftp.o fs/pxe/ftp_readdir.o fs/pxe/http.o fs/pxe/http_readdir.o)
+LIBEFI_STRIPPED = $(objdir)/libefi_stripped.a
 LIB_OBJS = $(addprefix $(objdir)/com32/lib/,$(CORELIBOBJS)) \
 CSRC = $(sort $(wildcard $(SRC)/*.c))
 OBJS = $(subst $(SRC)/,,$(filter-out %wrapper.o, $(patsubst %.c,%.o,$(CSRC))))
@@ -73,6 +75,13 @@
 syslinux.so: $(OBJS) $(CORE_OBJS) $(LIB_OBJS)
 	$(LD) $(LDFLAGS) --strip-debug -o $@ $^ -lgnuefi -lefi
+	ar x $(LIBEFI_STRIPPED) init.o
+	strip -N memset -N memcpy init.o
+	ar r $(LIBEFI_STRIPPED) init.o
+	rm init.o
 # We need to rename the .hash section because the EFI firmware
 # linker really doesn't like it.
 # $(OBJCOPY) --rename-section .gnu.hash=.sdata,load,data,alloc $^ $@

Reply to: