From nobody Mon Jan 31 14:56:38 2022 X-Original-To: dev-commits-src-branches@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 2ED021994EE4; Mon, 31 Jan 2022 14:56:39 +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 4JnWNl0Ycjz4T24; Mon, 31 Jan 2022 14:56:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643640999; 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=tUbWCFW1rUoRjTC2zc9FOf5yJnIirLkUirq7KU/1Ik0=; b=hYr2TUMSm7pzw5os6Fe6hOE72e//NrMmxhX3c1CuDM4vduJdo1/GBuPjQ/2EN88zqVknej F2g0vo/Hv99giRLVqrlNuUnpY7BRD7XSdOsE6x6pTQAZxWHtGcLlU3cQdemnFskF/p6QgK 7NQavY2/sbtWH9tLftMLSJmexzjAPGrSCu+LGcKzDl0AAb/OfS2RngHnqLdXBcV1MSdNIN 6W1ZP3edkZHrzhRHYfqjGtBs4O/knSEPBfjmtv5vIyhU2+IKeteXv3sDJNic0VihoQ7Mj5 oac2jfuPS/i9TGjjdn1yN4RfeJvqIB6DyoNDoh6ZxnNqIefe2lXbVeiHn+uvNA== 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 DD5261E434; Mon, 31 Jan 2022 14:56:38 +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 20VEucZC082272; Mon, 31 Jan 2022 14:56:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20VEucAP082271; Mon, 31 Jan 2022 14:56:38 GMT (envelope-from git) Date: Mon, 31 Jan 2022 14:56:38 GMT Message-Id: <202201311456.20VEucAP082271@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 947e849150b8 - stable/13 - sysent: Add a sv_psstringssz field to struct sysentvec List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 947e849150b8826ea9876595b09bf73a85392ce1 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643640999; 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=tUbWCFW1rUoRjTC2zc9FOf5yJnIirLkUirq7KU/1Ik0=; b=el5rQI/4Ax21NDP1Rm8VbtogjvJaOk6mHi19koNDEh/yXzFW6DFg/nWEtJdbjdy7Sldtvj /hygZe5xbmgREz//SfK0fkwn6N2TgvpVMEDLMCkasbU/E1jhY+x1CvGdZFL0jZROdbxvVu YlK0uuI36aUkrBr3BQYjoe1/2kh72CSIRajtpZ9BsYUvyVEQQgT/f4u6TSggIrmZkEltS1 zpneRU4754poyl4nBwEhyd1nJxcIniU+Utdpk5uVCMUh9teo0osERH+IKQ0Jb/OnNvvdsU snpIvOyYhbvjyo6Ii2xjwxZY2eb5dCJ7Gk65ozEkRCmPkfzeBdKqytk5I4eRSg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643640999; a=rsa-sha256; cv=none; b=diTIST9O6B80sOFne+qBgGIXSydfpuOy2OLo25Wp4YWXfEgsOMMtgiSQoKyIcICsrvaVAB 2EG7nSGOSK7zMFLfVN9c7DbW2J+AY+82QdEXaTwAQbz6VwHSDBZyMTcaYRzAAc8kA+uW+q ljDIaCIRLBdnJBkTyDTXCTR7W/yWEhRji/1WHgL2EeANFRQQKuMejbALt1viRT5uHOc/kd VJ3+TAxfAvxAP2b7+n5woM27FtpiBfyFht+SXvmbE3b4vQGDElo8h/Ba8gwlrC/tORSHni aax6XGq8p53sUr9CuvcDTk8pp4USWdcjI+wA+7dOh6lp8kpa81s+KwAV1x14nA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=947e849150b8826ea9876595b09bf73a85392ce1 commit 947e849150b8826ea9876595b09bf73a85392ce1 Author: Mark Johnston AuthorDate: 2022-01-17 16:42:07 +0000 Commit: Mark Johnston CommitDate: 2022-01-31 14:48:11 +0000 sysent: Add a sv_psstringssz field to struct sysentvec The size of the ps_strings structure varies between ABIs, so this is useful for computing the address of the ps_strings structure relative to the top of the stack when stack address randomization is enabled. Reviewed by: kib Sponsored by: The FreeBSD Foundation (cherry picked from commit 3fc21fdd5f8a4eeb71f43cc6841f59ef1debaf9a) --- sys/amd64/amd64/elf_machdep.c | 2 ++ sys/amd64/linux/linux_sysvec.c | 1 + sys/amd64/linux32/linux32_sysvec.c | 1 + sys/arm/arm/elf_machdep.c | 1 + sys/arm64/arm64/elf32_machdep.c | 1 + sys/arm64/arm64/elf_machdep.c | 1 + sys/arm64/linux/linux_sysvec.c | 1 + sys/compat/ia32/ia32_sysvec.c | 1 + sys/i386/i386/elf_machdep.c | 1 + sys/i386/linux/linux_sysvec.c | 2 ++ sys/kern/imgact_aout.c | 2 ++ sys/kern/init_main.c | 1 + sys/powerpc/powerpc/elf32_machdep.c | 2 ++ sys/powerpc/powerpc/elf64_machdep.c | 2 ++ sys/riscv/riscv/elf_machdep.c | 1 + sys/sys/sysent.h | 1 + 16 files changed, 21 insertions(+) diff --git a/sys/amd64/amd64/elf_machdep.c b/sys/amd64/amd64/elf_machdep.c index 6a4c25072962..0c4a864acf16 100644 --- a/sys/amd64/amd64/elf_machdep.c +++ b/sys/amd64/amd64/elf_machdep.c @@ -72,6 +72,7 @@ struct sysentvec elf64_freebsd_sysvec_la48 = { .sv_maxuser = VM_MAXUSER_ADDRESS_LA48, .sv_usrstack = USRSTACK_LA48, .sv_psstrings = PS_STRINGS_LA48, + .sv_psstringssz = sizeof(struct ps_strings), .sv_stackprot = VM_PROT_ALL, .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, @@ -110,6 +111,7 @@ struct sysentvec elf64_freebsd_sysvec_la57 = { .sv_maxuser = VM_MAXUSER_ADDRESS_LA57, .sv_usrstack = USRSTACK_LA57, .sv_psstrings = PS_STRINGS_LA57, + .sv_psstringssz = sizeof(struct ps_strings), .sv_stackprot = VM_PROT_ALL, .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index 093360537574..d4d7146ae224 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -739,6 +739,7 @@ struct sysentvec elf_linux_sysvec = { .sv_maxuser = VM_MAXUSER_ADDRESS_LA48, .sv_usrstack = USRSTACK_LA48, .sv_psstrings = PS_STRINGS_LA48, + .sv_psstringssz = sizeof(struct ps_strings), .sv_stackprot = VM_PROT_ALL, .sv_copyout_auxargs = linux_copyout_auxargs, .sv_copyout_strings = linux_copyout_strings, diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index 2e65763062e3..935d755e1904 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -903,6 +903,7 @@ struct sysentvec elf_linux_sysvec = { .sv_maxuser = LINUX32_MAXUSER, .sv_usrstack = LINUX32_USRSTACK, .sv_psstrings = LINUX32_PS_STRINGS, + .sv_psstringssz = sizeof(struct linux32_ps_strings), .sv_stackprot = VM_PROT_ALL, .sv_copyout_auxargs = linux_copyout_auxargs, .sv_copyout_strings = linux_copyout_strings, diff --git a/sys/arm/arm/elf_machdep.c b/sys/arm/arm/elf_machdep.c index 6eaea9b92f2f..b34ade569d61 100644 --- a/sys/arm/arm/elf_machdep.c +++ b/sys/arm/arm/elf_machdep.c @@ -78,6 +78,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, + .sv_psstringssz = sizeof(struct ps_strings), .sv_stackprot = VM_PROT_ALL, .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c index 3625a4d124da..12a0e74ddc8a 100644 --- a/sys/arm64/arm64/elf32_machdep.c +++ b/sys/arm64/arm64/elf32_machdep.c @@ -96,6 +96,7 @@ static struct sysentvec elf32_freebsd_sysvec = { .sv_maxuser = FREEBSD32_MAXUSER, .sv_usrstack = FREEBSD32_USRSTACK, .sv_psstrings = FREEBSD32_PS_STRINGS, + .sv_psstringssz = sizeof(struct freebsd32_ps_strings), .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, .sv_copyout_auxargs = elf32_freebsd_copyout_auxargs, .sv_copyout_strings = freebsd32_copyout_strings, diff --git a/sys/arm64/arm64/elf_machdep.c b/sys/arm64/arm64/elf_machdep.c index 102097b2dbb5..44847ee27abf 100644 --- a/sys/arm64/arm64/elf_machdep.c +++ b/sys/arm64/arm64/elf_machdep.c @@ -74,6 +74,7 @@ static struct sysentvec elf64_freebsd_sysvec = { .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, + .sv_psstringssz = sizeof(struct ps_strings), .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 0a56cdc4f299..3188d2f2c57c 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -418,6 +418,7 @@ struct sysentvec elf_linux_sysvec = { .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, /* XXX */ + .sv_psstringssz = sizeof(struct ps_strings), .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, .sv_copyout_auxargs = linux_copyout_auxargs, .sv_copyout_strings = linux_copyout_strings, diff --git a/sys/compat/ia32/ia32_sysvec.c b/sys/compat/ia32/ia32_sysvec.c index 5cea380a744f..de6d8540e1de 100644 --- a/sys/compat/ia32/ia32_sysvec.c +++ b/sys/compat/ia32/ia32_sysvec.c @@ -118,6 +118,7 @@ struct sysentvec ia32_freebsd_sysvec = { .sv_maxuser = FREEBSD32_MAXUSER, .sv_usrstack = FREEBSD32_USRSTACK, .sv_psstrings = FREEBSD32_PS_STRINGS, + .sv_psstringssz = sizeof(struct freebsd32_ps_strings), .sv_stackprot = VM_PROT_ALL, .sv_copyout_auxargs = elf32_freebsd_copyout_auxargs, .sv_copyout_strings = freebsd32_copyout_strings, diff --git a/sys/i386/i386/elf_machdep.c b/sys/i386/i386/elf_machdep.c index 1ba0257c2763..9cf34e75ab7e 100644 --- a/sys/i386/i386/elf_machdep.c +++ b/sys/i386/i386/elf_machdep.c @@ -67,6 +67,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, + .sv_psstringssz = sizeof(struct ps_strings), .sv_stackprot = VM_PROT_ALL, .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 1478ff0bf163..d351adc4147e 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -850,6 +850,7 @@ struct sysentvec linux_sysvec = { .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = LINUX_USRSTACK, .sv_psstrings = PS_STRINGS, + .sv_psstringssz = sizeof(struct ps_strings), .sv_stackprot = VM_PROT_ALL, .sv_copyout_strings = exec_copyout_strings, .sv_setregs = linux_exec_setregs, @@ -888,6 +889,7 @@ struct sysentvec elf_linux_sysvec = { .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = LINUX_USRSTACK, .sv_psstrings = LINUX_PS_STRINGS, + .sv_psstringssz = sizeof(struct ps_strings), .sv_stackprot = VM_PROT_ALL, .sv_copyout_auxargs = linux_copyout_auxargs, .sv_copyout_strings = linux_copyout_strings, diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c index 628ce5800d37..6eb6e85cc9d7 100644 --- a/sys/kern/imgact_aout.c +++ b/sys/kern/imgact_aout.c @@ -89,6 +89,7 @@ struct sysentvec aout_sysvec = { .sv_maxuser = AOUT32_USRSTACK, .sv_usrstack = AOUT32_USRSTACK, .sv_psstrings = AOUT32_PS_STRINGS, + .sv_psstringssz = sizeof(struct ps_strings), .sv_stackprot = VM_PROT_ALL, .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, @@ -138,6 +139,7 @@ struct sysentvec aout_sysvec = { .sv_maxuser = AOUT32_USRSTACK, .sv_usrstack = AOUT32_USRSTACK, .sv_psstrings = AOUT32_PS_STRINGS, + .sv_psstringssz = sizeof(struct freebsd32_ps_strings), .sv_stackprot = VM_PROT_ALL, .sv_copyout_strings = freebsd32_copyout_strings, .sv_setregs = ia32_setregs, diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 4def00f8a018..b4e1c6683f8d 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -418,6 +418,7 @@ struct sysentvec null_sysvec = { .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, + .sv_psstringssz = sizeof(struct ps_strings), .sv_stackprot = VM_PROT_ALL, .sv_copyout_strings = NULL, .sv_setregs = NULL, diff --git a/sys/powerpc/powerpc/elf32_machdep.c b/sys/powerpc/powerpc/elf32_machdep.c index e98b4c3f08c2..134e7e39b379 100644 --- a/sys/powerpc/powerpc/elf32_machdep.c +++ b/sys/powerpc/powerpc/elf32_machdep.c @@ -106,6 +106,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_maxuser = VM_MAXUSER_ADDRESS32, .sv_usrstack = FREEBSD32_USRSTACK, .sv_psstrings = FREEBSD32_PS_STRINGS, + .sv_psstringssz = sizeof(struct freebsd32_ps_strings), .sv_copyout_strings = freebsd32_copyout_strings, .sv_setregs = ppc32_setregs, .sv_syscallnames = freebsd32_syscallnames, @@ -114,6 +115,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, + .sv_psstringssz = sizeof(struct ps_strings), .sv_copyout_strings = exec_copyout_strings, .sv_setregs = exec_setregs, .sv_syscallnames = syscallnames, diff --git a/sys/powerpc/powerpc/elf64_machdep.c b/sys/powerpc/powerpc/elf64_machdep.c index 37765381745e..71d86c6a627a 100644 --- a/sys/powerpc/powerpc/elf64_machdep.c +++ b/sys/powerpc/powerpc/elf64_machdep.c @@ -75,6 +75,7 @@ struct sysentvec elf64_freebsd_sysvec_v1 = { .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, + .sv_psstringssz = sizeof(struct ps_strings), .sv_stackprot = VM_PROT_ALL, .sv_copyout_auxargs = __elfN(powerpc_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, @@ -113,6 +114,7 @@ struct sysentvec elf64_freebsd_sysvec_v2 = { .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, + .sv_psstringssz = sizeof(struct ps_strings), .sv_stackprot = VM_PROT_ALL, .sv_copyout_auxargs = __elfN(powerpc_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, diff --git a/sys/riscv/riscv/elf_machdep.c b/sys/riscv/riscv/elf_machdep.c index 5e974aba3701..1e24cbf51004 100644 --- a/sys/riscv/riscv/elf_machdep.c +++ b/sys/riscv/riscv/elf_machdep.c @@ -78,6 +78,7 @@ struct sysentvec elf64_freebsd_sysvec = { .sv_maxuser = VM_MAXUSER_ADDRESS, .sv_usrstack = USRSTACK, .sv_psstrings = PS_STRINGS, + .sv_psstringssz = sizeof(struct ps_strings), .sv_stackprot = VM_PROT_READ | VM_PROT_WRITE, .sv_copyout_auxargs = __elfN(freebsd_copyout_auxargs), .sv_copyout_strings = exec_copyout_strings, diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 4296b47182a2..e0551fa51eff 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -123,6 +123,7 @@ struct sysentvec { vm_offset_t sv_maxuser; /* VM_MAXUSER_ADDRESS */ vm_offset_t sv_usrstack; /* USRSTACK */ vm_offset_t sv_psstrings; /* PS_STRINGS */ + size_t sv_psstringssz; /* PS_STRINGS size */ int sv_stackprot; /* vm protection for stack */ int (*sv_copyout_strings)(struct image_params *, uintptr_t *);