Date: Fri, 20 Dec 2019 01:00:18 +0000 (UTC) From: Konstantin Belousov <kib@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: r355919 - stable/12/libexec/rtld-elf Message-ID: <201912200100.xBK10I4a067443@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Fri Dec 20 01:00:18 2019 New Revision: 355919 URL: https://svnweb.freebsd.org/changeset/base/355919 Log: MFC r355676: rtld: make checks for mmap(2) failures compliant with documentation. Modified: stable/12/libexec/rtld-elf/map_object.c Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rtld-elf/map_object.c ============================================================================== --- stable/12/libexec/rtld-elf/map_object.c Fri Dec 20 00:25:56 2019 (r355918) +++ stable/12/libexec/rtld-elf/map_object.c Fri Dec 20 01:00:18 2019 (r355919) @@ -203,7 +203,7 @@ map_object(int fd, const char *path, const struct stat base_flags |= MAP_FIXED | MAP_EXCL; mapbase = mmap(base_addr, mapsize, PROT_NONE, base_flags, -1, 0); - if (mapbase == (caddr_t) -1) { + if (mapbase == MAP_FAILED) { _rtld_error("%s: mmap of entire address space failed: %s", path, rtld_strerror(errno)); goto error; @@ -259,7 +259,7 @@ map_object(int fd, const char *path, const struct stat bss_addr = mapbase + (bss_vaddr - base_vaddr); if (bss_vlimit > bss_vaddr) { /* There is something to do */ if (mmap(bss_addr, bss_vlimit - bss_vaddr, data_prot, - data_flags | MAP_ANON, -1, 0) == (caddr_t)-1) { + data_flags | MAP_ANON, -1, 0) == MAP_FAILED) { _rtld_error("%s: mmap of bss failed: %s", path, rtld_strerror(errno)); goto error1; @@ -343,7 +343,7 @@ get_elf_header(int fd, const char *path, const struct hdr = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_PRIVATE | MAP_PREFAULT_READ, fd, 0); - if (hdr == (Elf_Ehdr *)MAP_FAILED) { + if (hdr == MAP_FAILED) { _rtld_error("%s: read error: %s", path, rtld_strerror(errno)); return (NULL); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912200100.xBK10I4a067443>