From nobody Tue Jun 07 14:23:32 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 787587CB010; Tue, 7 Jun 2022 14:23:33 +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 4LHXdw5MTVz3rF3; Tue, 7 Jun 2022 14:23:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654611812; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R2vzpOoVNRXkP4l0ofi1xHHVnSAg2KH0DzK2tGAgYpk=; b=IYGwCToBp7kzSn9v18s9ntri62PE0W35N/ujc9If/qJ90ybjjzwwr9PrnwW1lsElDoorrW n/eZwJlUz497nJ5pyzZd03MZUY6Ypf7KJPXp5DLK+ajNl2jDOCJX/+pQ0fMp1M73AWOXq5 RWu6e/j9pNmYPr2ji/zjbKdPaz4iCFfFKfdMNf6qKAYOMSMIoW2AnvSTSzk0S4+8Jhe8J3 crx5yqtK6fT2CNnfRIkOwwe0S4AgKLQbqg+VuYlETvgooySjdDPLbU/dGup9TrOEpqaXxR xWp1cmHZg1IJJNnAoDhVySJqcwQ/RaK/BTeTTjANJxhX0r/6OQ0hDEVtxdgxjg== 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 53F2B1CA11; Tue, 7 Jun 2022 14:23:32 +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 257ENW88020356; Tue, 7 Jun 2022 14:23:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 257ENWGq020355; Tue, 7 Jun 2022 14:23:32 GMT (envelope-from git) Date: Tue, 7 Jun 2022 14:23:32 GMT Message-Id: <202206071423.257ENWGq020355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: c74a6c3038ea - stable/13 - Use getpagesize in gcore to find the page size List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c74a6c3038ea1cf381931b59f4c9a3cb2b6eae20 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654611812; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=R2vzpOoVNRXkP4l0ofi1xHHVnSAg2KH0DzK2tGAgYpk=; b=ty+yJmSG3lpz5q1pL/i62cnVJc7YJJL0s8PFbq/OhtLoNyQ0vlh/91bqYQeUZndbDfBdMo ILelrNA87tJ90+Ihmqqt10VykBNFUJp3HMH6qI24DzsHQbq27Cl+U6WgaswFBHFWZL+K6D o5iu3BYq+DShbeLYty1mJ3q4cLvKjRYLXYAxuuc1i1swKMaHXVzUsSWeu6JyTXtWSAxiww FS3vHct8hE1qoKbrLqGbI//UDJHPH5OYSJsCNQqlu4owRsHt7+/gPjrBk7ByDAypr41VyP LSmw21cgBi3lzE75/0klWUhNca1N8dycjY9NmV42T4CmlX7xp42Si1dr/mHWsQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654611812; a=rsa-sha256; cv=none; b=p3YjRJpeGlF7ayj0OfDHLggQKixYicsuBFd81j2P1nUBMAUCezVD+EQT+epeCE1iiwP0O7 0FwRo+DnxFkdx6lFFwGKrLA5AKSYxbmLHpGEW9BFQq80/ThrhqVtxi6I5kXve3pZGqOjBC c5bVUt+c6K7WcGoZELj103AUN7ZbY/3nY7uSC1sMGrCrhzu7qTGfUpfupYGruzt4/mbmRw Qa5UPzaa3MxbOOqYP7HmSSt5YK4zgaG6TJvDhHnRjDa45rxmkk7wCQ4q3sFLq9MEoovwxg cnUQ1NRyhyNtjPfDcAT5p2+1DdiyQGyNFKfABumua/ds0lbGN3B53HFSp2UmmQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=c74a6c3038ea1cf381931b59f4c9a3cb2b6eae20 commit c74a6c3038ea1cf381931b59f4c9a3cb2b6eae20 Author: Andrew Turner AuthorDate: 2022-05-13 11:56:14 +0000 Commit: Andrew Turner CommitDate: 2022-06-07 14:20:18 +0000 Use getpagesize in gcore to find the page size Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35194 (cherry picked from commit f9ca52bab510ff97c6a3c513ddce698a0d19934c) --- usr.bin/gcore/elfcore.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.bin/gcore/elfcore.c b/usr.bin/gcore/elfcore.c index 1fcd14698a9e..6ef1f31d28cd 100644 --- a/usr.bin/gcore/elfcore.c +++ b/usr.bin/gcore/elfcore.c @@ -234,7 +234,7 @@ elf_coredump(int efd, int fd, pid_t pid) /* Put notes. */ elf_putnotes(pid, sb, ¬esz); /* Align up to a page boundary for the program segments. */ - sbuf_end_section(sb, -1, PAGE_SIZE, 0); + sbuf_end_section(sb, -1, getpagesize(), 0); if (sbuf_finish(sb) != 0) err(1, "sbuf_finish"); hdr = sbuf_data(sb); @@ -295,15 +295,17 @@ cb_put_phdr(struct map_entry *entry, void *closure) { struct phdr_closure *phc = (struct phdr_closure *)closure; Elf_Phdr *phdr = phc->phdr; + size_t page_size; - phc->offset = round_page(phc->offset); + page_size = getpagesize(); + phc->offset = roundup2(phc->offset, page_size); phdr->p_type = PT_LOAD; phdr->p_offset = phc->offset; phdr->p_vaddr = entry->start; phdr->p_paddr = 0; phdr->p_filesz = phdr->p_memsz = entry->end - entry->start; - phdr->p_align = PAGE_SIZE; + phdr->p_align = page_size; phdr->p_flags = 0; if (entry->protection & VM_PROT_READ) phdr->p_flags |= PF_R;