diff options
author | Rich Felker <dalias@aerifal.cx> | 2021-03-05 11:09:32 -0500 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2021-03-05 11:13:02 -0500 |
commit | cfdfd5ea3ce14c6abf7fb22a531f3d99518b5a1b (patch) | |
tree | 21fa324b6947b11a815baff22278131cd3cddc4c /ldso/dynlink.c | |
parent | e48e99c112246fb580596404074445cb25d7858d (diff) | |
download | musl-cfdfd5ea3ce14c6abf7fb22a531f3d99518b5a1b.tar.gz musl-cfdfd5ea3ce14c6abf7fb22a531f3d99518b5a1b.tar.xz musl-cfdfd5ea3ce14c6abf7fb22a531f3d99518b5a1b.zip |
don't fail to map library/executable with zero-length segment maps
reportedly the GNU linker can emit such segments, causing spurious failure to load due to mmap with a length of zero producing EINVAL. no action is required for such a load map (it's effectively a nop in the program headers table) so just treat it as always successful.
Diffstat (limited to 'ldso/dynlink.c')
-rw-r--r-- | ldso/dynlink.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ldso/dynlink.c b/ldso/dynlink.c index 6b868c84..aaadcce0 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -579,6 +579,7 @@ static void *mmap_fixed(void *p, size_t n, int prot, int flags, int fd, off_t of { static int no_map_fixed; char *q; + if (!n) return p; if (!no_map_fixed) { q = mmap(p, n, prot, flags|MAP_FIXED, fd, off); if (!DL_NOMMU_SUPPORT || q != MAP_FAILED || errno != EINVAL) |