Date: Wed, 23 Sep 2020 21:57:29 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r366094 - in stable: 11/lib/libc/gen 12/lib/libc/gen Message-ID: <202009232157.08NLvTxo042618@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Wed Sep 23 21:57:29 2020 New Revision: 366094 URL: https://svnweb.freebsd.org/changeset/base/366094 Log: MFC 365278: Don't assume objects in program sections have a size of a pointer. The size of the object at 'addr' is unknown and might be smaller than the size of a pointer (e.g. some x86 instructions are smaller than a pointer). Instead, just check that the address is in the bounds of the program header. Modified: stable/12/lib/libc/gen/elf_utils.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/libc/gen/elf_utils.c Directory Properties: stable/11/ (props changed) Modified: stable/12/lib/libc/gen/elf_utils.c ============================================================================== --- stable/12/lib/libc/gen/elf_utils.c Wed Sep 23 19:54:59 2020 (r366093) +++ stable/12/lib/libc/gen/elf_utils.c Wed Sep 23 21:57:29 2020 (r366094) @@ -65,7 +65,7 @@ __elf_phdr_match_addr(struct dl_phdr_info *phdr_info, #endif if (phdr_info->dlpi_addr + ph->p_vaddr <= (uintptr_t)addr && - (uintptr_t)addr + sizeof(addr) < phdr_info->dlpi_addr + + (uintptr_t)addr < phdr_info->dlpi_addr + ph->p_vaddr + ph->p_memsz) break; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009232157.08NLvTxo042618>