Always add AT_BASE even if there is no interpreter.

Linux will ALWAYS add AT_BASE even for a static binary, expect it
will be set to 0 [1].

1. https://github.com/torvalds/linux/blob/master/fs/binfmt_elf.c#L253

PiperOrigin-RevId: 209811129
Change-Id: I92cc66532f23d40f24414a921c030bd3481e12a0
This commit is contained in:
Brian Geffon
2018-08-22 12:37:09 -07:00
committed by Shentubot
parent 23ca133657
commit 545ea7ab3f
+3
View File
@@ -655,6 +655,9 @@ func loadELF(ctx context.Context, m *mm.MemoryManager, mounts *fs.MountNamespace
// Start in the interpreter.
// N.B. AT_ENTRY above contains the *original* entry point.
bin.entry = interp.entry
} else {
// Always add AT_BASE even if there is no interpreter.
bin.auxv = append(bin.auxv, arch.AuxEntry{linux.AT_BASE, 0})
}
return bin, ac, nil