From nobody Thu May 19 10:33:20 2022 X-Original-To: dev-commits-src-main@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 C6F671AE3728; Thu, 19 May 2022 10:33:20 +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 4L3mR44qpvz3FQS; Thu, 19 May 2022 10:33:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652956400; 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=9nMdMd1qUP761GOmBLjoSk8xuZbHGc1vYW+3KqSTS1Q=; b=m8NgUuQByagvTqC49Ci1lEhcVntziIBox4DhShtzAQmPHb+JI+unGQYT70iuuOGC+4PTx5 Jq2Raox56yGH/9P6AW9YrUtHYD+00e+L0X4T3Ab0FCnJFiAT+qXLDUJfnMCR2V07b6nPFr 3yDZOpbeQ9bOag4ipmQr4bQoDx01UfAjM24AvNdEiR6kxw405O99TrInsIgGP6+HoJOYWk oAiUkrIA3y1X+5UECYzKU+YHuFG5MZPeSRuBzufa6cCk93lUr0j/k0chiaVxbuib6j45Hl NK36czB5XkghRwu7fr3sMRxlfNCiG8MarX2kxX1h2yCWoxiY5Y0CrlmyWtp0DA== 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 85D2E1C0BA; Thu, 19 May 2022 10:33:20 +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 24JAXKCR043550; Thu, 19 May 2022 10:33:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24JAXKXA043549; Thu, 19 May 2022 10:33:20 GMT (envelope-from git) Date: Thu, 19 May 2022 10:33:20 GMT Message-Id: <202205191033.24JAXKXA043549@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: f9ca52bab510 - main - Use getpagesize in gcore to find the page size List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: f9ca52bab510ff97c6a3c513ddce698a0d19934c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1652956400; 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=9nMdMd1qUP761GOmBLjoSk8xuZbHGc1vYW+3KqSTS1Q=; b=bNzcOZteTWpzLxowZ2fSnM9/buQN5q4SSk2k6nTFgwuWuFh+K+9szDvGmWE0Rp8wWDkZ9N xUJZO6c8FCSUE34FVQerNmeO6UOtaSb2p6WtLZFKgF06O4lFdAGuXcDN6kp0NmlTh0sDcI zTwoKGw8svYqtSrHU2pGz7nlyREFvTnvGns5gk1Dl4gm6y3WxOI949CFiTBKiaoM92Jy1n 5CafwWE7G125BKipxFqx+6YDW/oSiFBUR+csqdx/Y8QV/zImJ94xFB/b8frUgMIGOJR+0+ 051O89StU8bu8eM0jU2Ojc5T81MQRCJuxcNsaNmFX5eE4XhjdtCpUxvVESqHnA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1652956400; a=rsa-sha256; cv=none; b=WWtE12YymqA0jz674e6p4BcawF4WK1l5V9jTK077sOY50P1mufEUok6GHUPa5HGBvIkfZq pANrXkIAmZJZaTRZpNtc1chMQqy0O34yW8ffDoQ73BFUzfKQrmKSmLgww2dGLyXdST4B8x XHk5Ts1nX+ULBGrRq3hpaauLRKDOmF/FR3uWzxoQcldb3+tZWCXFccLxSY8U3eyD6OwDwo +b4SFOLkJ/gwkK7SXaSvSFE1Buae7DB34nggaYxlZTcRojBKOK83u1Q3wkaHXrKlYhwl8N LAmjRM5yPvjsRX6bl8KvjWeOzRQqQWfBn+jeNyXBa1yd0WpBVzCUlSvtcxo+hQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f9ca52bab510ff97c6a3c513ddce698a0d19934c commit f9ca52bab510ff97c6a3c513ddce698a0d19934c Author: Andrew Turner AuthorDate: 2022-05-13 11:56:14 +0000 Commit: Andrew Turner CommitDate: 2022-05-19 10:32:26 +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 --- 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;