From nobody Tue Jan 18 22:18:03 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 D933F196F8E1; Tue, 18 Jan 2022 22:18:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Jdjp45rfMz4nbm; Tue, 18 Jan 2022 22:18:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642544284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7JzCbArlLXmVPEBcCspN/J2khv4bYKvGz+wKN+UcIbg=; b=xPsvs4B7Q18A4b4068UqE1a9DZB+1IrRJUCE4aAnlM1SK+ScuHGgRv1Prg2Re8OFnSYRTq WjU4jPvixbDwv0TlTNNQwhvy5eMUOB928A5RYUtk4+BK8R6qyhMZ91Rh2GQc0q9fzw4i1J Ee09fma8o4/4t4DIh3rCfVSvaziqmjz5ODOE1QtmNlTWEb++HU6E8SGVLKKfPhcAFiK3mT J4Y4GXwdVlLLmAB0ikp1T1untxVHQPD3rimJZWhiDK2dvnJ6AGn57UKrCQ/URpgFrisnby qBQoTQ78h4rU1IRxaVhapKd9SGXgucLfRTSdolCWsXkYib7HR9Z9RjWOWh3GpA== Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 36E6B2C062; Tue, 18 Jan 2022 22:18:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <8580d8c9-bc4f-53d5-0366-23922d3bf299@FreeBSD.org> Date: Tue, 18 Jan 2022 14:18:03 -0800 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 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: git: 706f4a81a812 - main - exec: Introduce the PROC_PS_STRINGS() macro Content-Language: en-US To: Mark Johnston Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202201172113.20HLD7v9006931@gitrepo.freebsd.org> <4e0db863-71fd-faa3-41f1-3cb05d539def@FreeBSD.org> From: John Baldwin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642544284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7JzCbArlLXmVPEBcCspN/J2khv4bYKvGz+wKN+UcIbg=; b=fkpkeSnzkJM06H640k47HgS2p94yajxWeHjaGoKpOS6bXnsEfBps14TvMkOMG3p94APZZA pRrFnpGwqNSyrLnajk7lz3Ad5YkNwiOBo/3pus5r9ByF6hrZOk6DiZZVAnmaWd6sG1FiZT dWDiHDDwGH+JmFnaz1l+8a9+/sqWVAhNqm2eBhKT4sBfwPCCRKIXC/Y/a03thhk3/0o6rK /EAbTa0zvaFngW2y9E1Gs00/Ct6QqfY9/aHPiUoRpPdPyQIuhklQ5vxrX0jN6LyvdiQ0Y9 SkAQvE9mrFCbqejL1gTT5kGLKDLnS023vce60v2U0TpWybbl7CCWGVb/p8MbtA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642544284; a=rsa-sha256; cv=none; b=OU0+a2pxmavIhkPfbPxpwnutDpymqnyutjr17qI3KRb1IPQyXxDhP+XvRpjeDWIPhsR20y MuPcDCUW6yxfpm0aD7zz+LQi5XpgAKH9E7kz0kgTeUUi+Pn57CuNVZNH+nHXKjWnhDIzsL KMhY7ssvtpq3Kx2E3Z2R1X+S5b3UlIGUtdQVq24rjGiQtg3dYwpDPTygscaH47bOCnfkOD k4YUkHncIUgTbE2rli4mE+EhhzPSGpgztjQ8LXVtqv68gdOO4HjA+AMAxy8RdZ1DtQFZvC lMsYFqjaxhoYv4KK1gwRWgbkH6FBOmem4MsN01etR1DNSDIF9SP0ejtpt92CBw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N On 1/18/22 11:58 AM, Mark Johnston wrote: > On Tue, Jan 18, 2022 at 07:31:47AM -0800, John Baldwin wrote: >> On 1/17/22 1:13 PM, Mark Johnston wrote: >>> The branch main has been updated by markj: >>> >>> URL: https://cgit.FreeBSD.org/src/commit/?id=706f4a81a81250a326ea25914e7effe1768f1a37 >>> >>> commit 706f4a81a81250a326ea25914e7effe1768f1a37 >>> Author: Mark Johnston >>> AuthorDate: 2022-01-17 16:42:28 +0000 >>> Commit: Mark Johnston >>> CommitDate: 2022-01-17 21:11:54 +0000 >>> >>> exec: Introduce the PROC_PS_STRINGS() macro >>> >>> Rather than fetching the ps_strings address directly from a process' >>> sysentvec, use this macro. With stack address randomization the >>> ps_strings address is no longer fixed. >>> >>> Reviewed by: kib >>> MFC after: 2 weeks >>> Sponsored by: The FreeBSD Foundation >>> Differential Revision: https://reviews.freebsd.org/D33704 >> >> FWIW, in CheriBSD we have a 'p_psstrings' member in struct proc that is a pointer >> to the ps_strings structure in user space that is set by the ABI during exec. > > I did the exact same thing in an earlier version of the patch. It ended > up being more useful to keep the stacktop address, and to derive the > ps_strings address from that. I would like to MFC this as well, and > that'll be easier without having modified the layout of struct proc. Ok. >> CHERI removes the need for ASLR, but due to alignment requirements of capabilities >> the stack is not a fixed location as its address can vary based on the size. > > Is it possible to use PROC_PS_STRINGS() there? Well, the other trick is that I think a more recent change from Brooks is that we have completely divorced the strings area (argv, envp, auxv, ps_strings, etc.) from the stack, so we will still need the separate pointer in CheriBSD. -- John Baldwin