From owner-dev-commits-src-all@freebsd.org Fri Aug 20 09:32:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6038D65D018; Fri, 20 Aug 2021 09:32:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GrbyX1v2Jz57tX; Fri, 20 Aug 2021 09:32:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2597116866; Fri, 20 Aug 2021 09:32:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17K9WaAw010364; Fri, 20 Aug 2021 09:32:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17K9WarF010363; Fri, 20 Aug 2021 09:32:36 GMT (envelope-from git) Date: Fri, 20 Aug 2021 09:32:36 GMT Message-Id: <202108200932.17K9WarF010363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 02e46073bd8a - stable/13 - rtld: Round down relro_size MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 02e46073bd8a98a8c3adc96b1885b5e47ebb3d4f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Aug 2021 09:32:36 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=02e46073bd8a98a8c3adc96b1885b5e47ebb3d4f commit 02e46073bd8a98a8c3adc96b1885b5e47ebb3d4f Author: Konstantin Belousov AuthorDate: 2021-08-12 02:45:15 +0000 Commit: Konstantin Belousov CommitDate: 2021-08-20 09:31:46 +0000 rtld: Round down relro_size (cherry picked from commit c9f833abf1d76ea194b82caafa06a0627790ad97) --- libexec/rtld-elf/map_object.c | 3 ++- libexec/rtld-elf/rtld.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c index 273e477fbda5..b725fe93b8f6 100644 --- a/libexec/rtld-elf/map_object.c +++ b/libexec/rtld-elf/map_object.c @@ -325,7 +325,8 @@ map_object(int fd, const char *path, const struct stat *sb) } obj->stack_flags = stack_flags; obj->relro_page = obj->relocbase + trunc_page(relro_page); - obj->relro_size = round_page(relro_size); + obj->relro_size = trunc_page(relro_page + relro_size) - + trunc_page(relro_page); if (note_start < note_end) digest_notes(obj, note_start, note_end); if (note_map != NULL) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index f60872f12c52..eaad89339d07 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1557,7 +1557,8 @@ digest_phdr(const Elf_Phdr *phdr, int phnum, caddr_t entry, const char *path) case PT_GNU_RELRO: obj->relro_page = obj->relocbase + trunc_page(ph->p_vaddr); - obj->relro_size = round_page(ph->p_memsz); + obj->relro_size = trunc_page(ph->p_vaddr + ph->p_memsz) - + trunc_page(ph->p_vaddr); break; case PT_NOTE: