From nobody Fri Dec 03 14:53:42 2021 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 312EF18C14CD; Fri, 3 Dec 2021 14:53:44 +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 4J5G6Z6RPqz51sX; Fri, 3 Dec 2021 14:53:42 +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 9BADC12AAE; Fri, 3 Dec 2021 14:53:42 +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 1B3ErgLJ081074; Fri, 3 Dec 2021 14:53:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B3ErgsF081073; Fri, 3 Dec 2021 14:53:42 GMT (envelope-from git) Date: Fri, 3 Dec 2021 14:53:42 GMT Message-Id: <202112031453.1B3ErgsF081073@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 069d7fa63b21 - stable/13 - minidump: Use provided msgbuf pointer 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 069d7fa63b219d526958b7e207d7843a7920d91c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638543223; 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=nsMP7WWUqCDmEzs4Em38ffG8iK9dAd0Pomj7GVu7Om8=; b=bh9NqWJNhkpFEtBXFJSjz9P0EaNI+4YOO/vTyrYleuc5mwFGlsAmYBeL3YaP6zvH5OVBYa JY7lEI9Iatu/z2PcuZxYOFCc7qtnOIGonsyRs75U8RmLyG3AsUJR1f9Q9apgbvToa5ZQGp keRUcRRv40UyX3cyKXAh9BmmXCTEIVILpuoVn7ch4UYAyflshiWwhlT3JWJub0IWAQ2vMS 4gCUxHf/tvEksIaTQwks5AlRAywqiA5eMEpqaH9Q4wtMBVc09FfN+e1lX+e2yqhN+bOBj2 BTJ/PGH4Ples0qyWK9hMFDsSfV0RZU/jMvcILo0qlGwrHfrxpATMXSN1VYxdYQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638543223; a=rsa-sha256; cv=none; b=dzFZ98cx9edMwe0DZTWZBsGCGux6uQ027rpeCY01kZNvNNL2TNIyTJmZIet0/Bt6yxlpKl egj1jUOhX7j+XbeMU1iKMWpfT/icPupSHbFgj6rnEHmIRMtM4/MxuzhwqonZpM2yAnPsD2 1WetJobgff5dBNaNtXSVF1iXsKbb9T7b40JJ9l4ZY1ctY0NJ86sA9L7VfJYHBRbltHvkjW zukUYAzq1WZf+UXYsa1xEKmVZNYcSAd+vR4op/oRBXd5xOpkYScHwlyi94ARjEVv2nqKd0 tCAe0x0mwFsqDm4xxSP7ClYXxtjWWnjuw3fykhdkZQb2ZitJ9cYmGSyEeGOGdw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=069d7fa63b219d526958b7e207d7843a7920d91c commit 069d7fa63b219d526958b7e207d7843a7920d91c Author: Mitchell Horne AuthorDate: 2021-11-17 15:34:13 +0000 Commit: Mitchell Horne CommitDate: 2021-12-03 14:02:03 +0000 minidump: Use provided msgbuf pointer Don't assume we are dumping the global message buffer, but use the one provided by the state argument. While here, drop superfluous cast to char *. Reviewed by: markj, jhb MFC after: 2 weeks Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31991 (cherry picked from commit 1d2d1418b492359921716aaa41e93750969b6e1f) --- sys/amd64/amd64/minidump_machdep.c | 8 +++++--- sys/arm/arm/minidump_machdep.c | 9 +++++---- sys/arm64/arm64/minidump_machdep.c | 9 +++++---- sys/i386/i386/minidump_machdep_base.c | 9 ++++++--- sys/mips/mips/minidump_machdep.c | 9 +++++---- sys/powerpc/powerpc/minidump_machdep.c | 11 ++++++----- sys/riscv/riscv/minidump_machdep.c | 9 +++++---- 7 files changed, 37 insertions(+), 27 deletions(-) diff --git a/sys/amd64/amd64/minidump_machdep.c b/sys/amd64/amd64/minidump_machdep.c index 975ae038cfdf..8d2bc3bca84a 100644 --- a/sys/amd64/amd64/minidump_machdep.c +++ b/sys/amd64/amd64/minidump_machdep.c @@ -171,6 +171,7 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) int ii, j, k, n; int retry_count; struct minidumphdr mdhdr; + struct msgbuf *mbp; retry_count = 0; retry: @@ -252,8 +253,9 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) } /* Calculate dump size. */ + mbp = state->msgbufp; dumpsize = pmapsize; - dumpsize += round_page(msgbufp->msg_size); + dumpsize += round_page(mbp->msg_size); dumpsize += round_page(sizeof(dump_avail)); dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); VM_PAGE_DUMP_FOREACH(pa) { @@ -273,7 +275,7 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) bzero(&mdhdr, sizeof(mdhdr)); strcpy(mdhdr.magic, MINIDUMP_MAGIC); mdhdr.version = MINIDUMP_VERSION; - mdhdr.msgbufsize = msgbufp->msg_size; + mdhdr.msgbufsize = mbp->msg_size; mdhdr.bitmapsize = round_page(BITSET_SIZE(vm_page_dump_pages)); mdhdr.pmapsize = pmapsize; mdhdr.kernbase = VM_MIN_KERNEL_ADDRESS; @@ -299,7 +301,7 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) goto fail; /* Dump msgbuf up front */ - error = blk_write(di, (char *)msgbufp->msg_ptr, 0, round_page(msgbufp->msg_size)); + error = blk_write(di, mbp->msg_ptr, 0, round_page(mbp->msg_size)); if (error) goto fail; diff --git a/sys/arm/arm/minidump_machdep.c b/sys/arm/arm/minidump_machdep.c index e3bf37599d4a..76ce89f895e3 100644 --- a/sys/arm/arm/minidump_machdep.c +++ b/sys/arm/arm/minidump_machdep.c @@ -156,6 +156,7 @@ int cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) { struct minidumphdr mdhdr; + struct msgbuf *mbp; uint64_t dumpsize, *dump_avail_buf; uint32_t ptesize; uint32_t pa, prev_pa = 0, count = 0; @@ -190,8 +191,9 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) } /* Calculate dump size. */ + mbp = state->msgbufp; dumpsize = ptesize; - dumpsize += round_page(msgbufp->msg_size); + dumpsize += round_page(mbp->msg_size); dumpsize += round_page(nitems(dump_avail) * sizeof(uint64_t)); dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); VM_PAGE_DUMP_FOREACH(pa) { @@ -209,7 +211,7 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) bzero(&mdhdr, sizeof(mdhdr)); strcpy(mdhdr.magic, MINIDUMP_MAGIC); mdhdr.version = MINIDUMP_VERSION; - mdhdr.msgbufsize = msgbufp->msg_size; + mdhdr.msgbufsize = mbp->msg_size; mdhdr.bitmapsize = round_page(BITSET_SIZE(vm_page_dump_pages)); mdhdr.ptesize = ptesize; mdhdr.kernbase = KERNBASE; @@ -235,8 +237,7 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) goto fail; /* Dump msgbuf up front */ - error = blk_write(di, (char *)msgbufp->msg_ptr, 0, - round_page(msgbufp->msg_size)); + error = blk_write(di, mbp->msg_ptr, 0, round_page(mbp->msg_size)); if (error) goto fail; diff --git a/sys/arm64/arm64/minidump_machdep.c b/sys/arm64/arm64/minidump_machdep.c index 5814cce632a9..5a935d3c379d 100644 --- a/sys/arm64/arm64/minidump_machdep.c +++ b/sys/arm64/arm64/minidump_machdep.c @@ -151,6 +151,7 @@ int cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) { struct minidumphdr mdhdr; + struct msgbuf *mbp; pd_entry_t *l0, *l1, l1e, *l2, l2e; pt_entry_t *l3, l3e; vm_offset_t va, kva_end; @@ -209,8 +210,9 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) } /* Calculate dump size. */ + mbp = state->msgbufp; dumpsize = pmapsize; - dumpsize += round_page(msgbufp->msg_size); + dumpsize += round_page(mbp->msg_size); dumpsize += round_page(sizeof(dump_avail)); dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); VM_PAGE_DUMP_FOREACH(pa) { @@ -227,7 +229,7 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) bzero(&mdhdr, sizeof(mdhdr)); strcpy(mdhdr.magic, MINIDUMP_MAGIC); mdhdr.version = MINIDUMP_VERSION; - mdhdr.msgbufsize = msgbufp->msg_size; + mdhdr.msgbufsize = mbp->msg_size; mdhdr.bitmapsize = round_page(BITSET_SIZE(vm_page_dump_pages)); mdhdr.pmapsize = pmapsize; mdhdr.kernbase = VM_MIN_KERNEL_ADDRESS; @@ -254,8 +256,7 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) goto fail; /* Dump msgbuf up front */ - error = blk_write(di, (char *)msgbufp->msg_ptr, 0, - round_page(msgbufp->msg_size)); + error = blk_write(di, mbp->msg_ptr, 0, round_page(mbp->msg_size)); if (error) goto fail; diff --git a/sys/i386/i386/minidump_machdep_base.c b/sys/i386/i386/minidump_machdep_base.c index 9b036f0fd700..196c375bec56 100644 --- a/sys/i386/i386/minidump_machdep_base.c +++ b/sys/i386/i386/minidump_machdep_base.c @@ -164,6 +164,7 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) pt_entry_t *pt, pte; int j, k; struct minidumphdr mdhdr; + struct msgbuf *mbp; /* Snapshot the KVA upper bound in case it grows. */ kva_end = kernel_vm_end; @@ -212,8 +213,9 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) } /* Calculate dump size. */ + mbp = state->msgbufp; dumpsize = ptesize; - dumpsize += round_page(msgbufp->msg_size); + dumpsize += round_page(mbp->msg_size); dumpsize += round_page(sizeof(dump_avail)); dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); VM_PAGE_DUMP_FOREACH(pa) { @@ -232,7 +234,7 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) bzero(&mdhdr, sizeof(mdhdr)); strcpy(mdhdr.magic, MINIDUMP_MAGIC); mdhdr.version = MINIDUMP_VERSION; - mdhdr.msgbufsize = msgbufp->msg_size; + mdhdr.msgbufsize = mbp->msg_size; mdhdr.bitmapsize = round_page(BITSET_SIZE(vm_page_dump_pages)); mdhdr.ptesize = ptesize; mdhdr.kernbase = KERNBASE; @@ -257,7 +259,8 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) goto fail; /* Dump msgbuf up front */ - error = blk_write(di, (char *)msgbufp->msg_ptr, 0, round_page(msgbufp->msg_size)); + error = blk_write(di, (char *)mbp->msg_ptr, 0, + round_page(mbp->msg_size)); if (error) goto fail; diff --git a/sys/mips/mips/minidump_machdep.c b/sys/mips/mips/minidump_machdep.c index 06a63834cab8..49a5ee3f15a7 100644 --- a/sys/mips/mips/minidump_machdep.c +++ b/sys/mips/mips/minidump_machdep.c @@ -109,6 +109,7 @@ int cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) { struct minidumphdr mdhdr; + struct msgbuf *mbp; uint64_t *dump_avail_buf; uint32_t ptesize; vm_paddr_t pa; @@ -148,8 +149,9 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) } /* Calculate dump size. */ + mbp = state->msgbufp; dumpsize = ptesize; - dumpsize += round_page(msgbufp->msg_size); + dumpsize += round_page(mbp->msg_size); dumpsize += round_page(nitems(dump_avail) * sizeof(uint64_t)); dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); VM_PAGE_DUMP_FOREACH(pa) { @@ -167,7 +169,7 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) bzero(&mdhdr, sizeof(mdhdr)); strcpy(mdhdr.magic, MINIDUMP_MAGIC); mdhdr.version = MINIDUMP_VERSION; - mdhdr.msgbufsize = msgbufp->msg_size; + mdhdr.msgbufsize = mbp->msg_size; mdhdr.bitmapsize = round_page(BITSET_SIZE(vm_page_dump_pages)); mdhdr.ptesize = ptesize; mdhdr.kernbase = VM_MIN_KERNEL_ADDRESS; @@ -191,8 +193,7 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) goto fail; /* Dump msgbuf up front */ - error = write_buffer(di, (char *)msgbufp->msg_ptr, - round_page(msgbufp->msg_size)); + error = write_buffer(di, mbp->msg_ptr, round_page(mbp->msg_size)); if (error) goto fail; diff --git a/sys/powerpc/powerpc/minidump_machdep.c b/sys/powerpc/powerpc/minidump_machdep.c index e6a0f3918883..c7e8d1965b98 100644 --- a/sys/powerpc/powerpc/minidump_machdep.c +++ b/sys/powerpc/powerpc/minidump_machdep.c @@ -195,6 +195,7 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) int error, retry_count; uint32_t pmapsize; struct minidumphdr mdhdr; + struct msgbuf *mbp; retry_count = 0; retry: @@ -210,8 +211,9 @@ retry: } /* Calculate dump size */ + mbp = state->msgbufp; dumpsize = PAGE_SIZE; /* header */ - dumpsize += round_page(msgbufp->msg_size); + dumpsize += round_page(mbp->msg_size); dumpsize += round_page(sizeof(dump_avail)); dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); dumpsize += pmapsize; @@ -229,7 +231,7 @@ retry: strcpy(mdhdr.magic, MINIDUMP_MAGIC); strncpy(mdhdr.mmu_name, pmap_mmu_name(), sizeof(mdhdr.mmu_name) - 1); mdhdr.version = MINIDUMP_VERSION; - mdhdr.msgbufsize = msgbufp->msg_size; + mdhdr.msgbufsize = mbp->msg_size; mdhdr.bitmapsize = round_page(BITSET_SIZE(vm_page_dump_pages)); mdhdr.pmapsize = pmapsize; mdhdr.kernbase = VM_MIN_KERNEL_ADDRESS; @@ -260,9 +262,8 @@ retry: dump_total("header", PAGE_SIZE); /* Dump msgbuf up front */ - error = blk_write(di, (char *)msgbufp->msg_ptr, 0, - round_page(msgbufp->msg_size)); - dump_total("msgbuf", round_page(msgbufp->msg_size)); + error = blk_write(di, mbp->msg_ptr, 0, round_page(mbp->msg_size)); + dump_total("msgbuf", round_page(mbp->msg_size)); /* Dump dump_avail */ _Static_assert(sizeof(dump_avail) <= sizeof(pgbuf), diff --git a/sys/riscv/riscv/minidump_machdep.c b/sys/riscv/riscv/minidump_machdep.c index 8f5a4a4d1289..814c2dd00697 100644 --- a/sys/riscv/riscv/minidump_machdep.c +++ b/sys/riscv/riscv/minidump_machdep.c @@ -158,6 +158,7 @@ cpu_minidumpsys(struct dumperinfo *di, const struct minidumpstate *state) pd_entry_t *l1, *l2, l2e; pt_entry_t *l3, l3e; struct minidumphdr mdhdr; + struct msgbuf *mbp; uint32_t pmapsize; vm_offset_t va, kva_max; vm_paddr_t pa; @@ -211,8 +212,9 @@ retry: } /* Calculate dump size */ + mbp = state->msgbufp; dumpsize = pmapsize; - dumpsize += round_page(msgbufp->msg_size); + dumpsize += round_page(mbp->msg_size); dumpsize += round_page(sizeof(dump_avail)); dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); VM_PAGE_DUMP_FOREACH(pa) { @@ -230,7 +232,7 @@ retry: bzero(&mdhdr, sizeof(mdhdr)); strcpy(mdhdr.magic, MINIDUMP_MAGIC); mdhdr.version = MINIDUMP_VERSION; - mdhdr.msgbufsize = msgbufp->msg_size; + mdhdr.msgbufsize = mbp->msg_size; mdhdr.bitmapsize = round_page(BITSET_SIZE(vm_page_dump_pages)); mdhdr.pmapsize = pmapsize; mdhdr.kernbase = KERNBASE; @@ -257,8 +259,7 @@ retry: goto fail; /* Dump msgbuf up front */ - error = blk_write(di, (char *)msgbufp->msg_ptr, 0, - round_page(msgbufp->msg_size)); + error = blk_write(di, mbp->msg_ptr, 0, round_page(mbp->msg_size)); if (error) goto fail;