Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <YdS7rrVPInqjpFTu@debussy>
Date: Tue, 4 Jan 2022 15:27:10 -0600
From: Nihal Jere <nihal@...aljere.xyz>
To: musl@...ts.openwall.com
Subject: Dynamic linker segfault

Hi,

ldd from master segfaults when run on [1] and [2]. It happens on
this[3] line. It seems to happen due to the intersection of a few
factors:

1. The segment at the lowest address is read-only.
2. A segment on the the same page is read/write.
3. The read/write segment has memsz > filesz.

This results in a segfault, as it tries to memset[3] on the mmap
created here[4], which has the same protection as the segment at
the lowest address (i.e. read-only).

As far as I can see, the options are to either:

a. detect this and throw an error.
b. 'or' together the protection flags of all the segments on the page.

I'm not sure what the right behavior is, but I don't think segfaulting
is right, and I'm sure there are people here what's correct.

Best,
Nihal

[1] https://github.com/golang/go/blob/master/src/debug/elf/testdata/go-relocation-test-gcc930-ranges-no-rela-x86-64
[2] https://github.com/golang/go/blob/master/src/debug/elf/testdata/go-relocation-test-gcc930-ranges-with-rela-x86-64
[3] https://git.musl-libc.org/cgit/musl/tree/ldso/dynlink.c#n783
[4] https://git.musl-libc.org/cgit/musl/tree/ldso/dynlink.c#n742

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.