authorgravatar for alex_naskos@hotmail.comAlexandros Naskos <alex_naskos@hotmail.com> 2020-03-03 12:41:11+02:00
committergravatar for alex_naskos@hotmail.comAlexandros Naskos <alex_naskos@hotmail.com> 2020-03-03 12:41:11+02:00
log755941830555b7423903053742fcc21d49cd3923
tree5db8ce8640b18a106e80feadaabebcd76a49ef01
parenta48cd1cf585a0f69f381a61ac43678c64e4a9a81

Added comment justifying wrapping operations


1 files changed, 4 insertions(+), 0 deletions(-)

lib/std/os/linux/vdso.zig+4
......@@ -22,6 +22,10 @@ pub fn lookup(vername: []const u8, name: []const u8) usize {
2222 }) {
2323 const this_ph = @intToPtr(*elf.Phdr, ph_addr);
2424 switch (this_ph.p_type) {
25 // On WSL1 as well as older kernels, the VDSO ELF image is pre-linked in the upper half
26 // of the memory space (e.g. p_vaddr = 0xffffffffff700000 on WSL1).
27 // Wrapping operations are used on this line as well as subsequent calculations relative to base
28 // (lines 47, 78) to ensure no overflow check is tripped.
2529 elf.PT_LOAD => base = vdso_addr +% this_ph.p_offset -% this_ph.p_vaddr,
2630 elf.PT_DYNAMIC => maybe_dynv = @intToPtr([*]usize, vdso_addr + this_ph.p_offset),
2731 else => {},