From nobody Sun Sep 04 23:59:18 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 4MLTCC1XKTz4c3WP; Sun, 4 Sep 2022 23:59:19 +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 4MLTCC17WGz3hwd; Sun, 4 Sep 2022 23:59:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662335959; 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=+8pNf0si0TXqty4t79Ux8hAz2LU3KO+BUUT8SXL9OVQ=; b=sgtJtqmUhEHOOiOTHZv6ybk9K+6BZpVv8F3pK2R37oqbyIyAmQDvxP5LuAo7dWSgoQxkOl FmbryMGfR0CC+l/9gOJ3pMCYXrl4e6tYMfoQL8Jzl+3NSQucXY2zl34HnGv41bW95cnWlC JMX2hIwlb6LuEHKjMmugRRoasYFHScouQC7AYe3YB76W3q3iWmkYqJwj2A8j+A0jxE9Yz3 uyxyx0rxBBC9MSeuwxskqzTt5TwAh3zSIgbomA95iVcky59DMmzSEbf+BPbAqq2kGpJUxh YkMwWMOeW5FQAXgpxlDT4ZeaDEb0qlvwJQcFoo7ZVCo9pUQBDXLW8g0ATSRxmA== 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 4MLTCC0FGbzfK3; Sun, 4 Sep 2022 23:59:19 +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 284NxIfL082858; Sun, 4 Sep 2022 23:59:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 284NxIHC082857; Sun, 4 Sep 2022 23:59:18 GMT (envelope-from git) Date: Sun, 4 Sep 2022 23:59:18 GMT Message-Id: <202209042359.284NxIHC082857@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 74408970498a - stable/13 - Clarify code comments on ASLR default settings 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 74408970498a7934672a73f8d0894401ba54b813 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662335959; 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=+8pNf0si0TXqty4t79Ux8hAz2LU3KO+BUUT8SXL9OVQ=; b=fggDiKsGnKw1KFOKy33zXg+4+/EO63r6xI4k/xUSfGe7IUsXXaDeb5amC4RW4DxDr6iByY kUQZeLh8rfOMBNRkkTfoC1qxNTKpFxXjRRMrJz2vp4n988sce/DbhX029gFL0bskAz5xxu 0NE/37iYCUvhqjzYTeUm5H2jsognTP9gCfpfDNkAMOifO0tvLnDcdJbhVUxSrk0U33mbOF uHgNCbJtJOippgVXpOETjJJ6GvVpL6vArX/mIwT8SGkTRpPS2cafRns6CYiHABllRHEee7 gCIxC+MFxA6Q8y/Ykl/6ZhqGHjuIEOezWF0h+Y5gozZnThyi06LwliJA+b4XMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662335959; a=rsa-sha256; cv=none; b=UPFsktoGanMZg3BlfReaiUOumFbubjW424138WelqyJwLtvwusxeVUQnLoILgIe6GNwuYk qoxgu9IfJiYipDUAMsR2KBVZSXeo1Z6+CQaWfiTTcd0pEWuMups6+G9dRH1dfT/GF8HF2f QU2R8T6EwNbmAFu+t1R4w/+k6BllOuHbtj+KzslhvB8lFHWEaghoeUbDPQRI/7MzNZAhu1 4aGCSvH5MEZi/wnVRP9zEDQRqMmhlhKk5KL9ZNScz6RZRM/ESmwiuGIQWjZRZRZNTOS+o7 bthB/OLwoZFFm1CWxKAIINjiDFplsUkTU8NpzhRb6U/lDWTX/Ev/XkutM0B8nQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=74408970498a7934672a73f8d0894401ba54b813 commit 74408970498a7934672a73f8d0894401ba54b813 Author: Ed Maste AuthorDate: 2022-08-05 14:01:07 +0000 Commit: Ed Maste CommitDate: 2022-09-04 23:57:28 +0000 Clarify code comments on ASLR default settings Sponsored by: The FreeBSD Foundation (cherry picked from commit f0687f3e0e4d09edce906308f79b312abd574553) --- sys/kern/imgact_elf.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c index 548a65a6f677..34cfef0d7cd9 100644 --- a/sys/kern/imgact_elf.c +++ b/sys/kern/imgact_elf.c @@ -173,10 +173,9 @@ SYSCTL_NODE(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, aslr, #define ASLR_NODE_OID __CONCAT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), _aslr) /* - * While for 64-bit machines ASLR works properly, there are - * still some problems when using 32-bit architectures. For this - * reason ASLR is only enabled by default when running native - * 64-bit non-PIE executables. + * Enable ASLR by default for 64-bit non-PIE binaries. 32-bit architectures + * have limited address space (which can cause issues for applications with + * high memory use) so we leave it off there. */ static int __elfN(aslr_enabled) = __ELF_WORD_SIZE == 64; SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, enable, CTLFLAG_RWTUN, @@ -185,7 +184,7 @@ SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, enable, CTLFLAG_RWTUN, ": enable address map randomization"); /* - * Enable ASLR only for 64-bit PIE binaries by default. + * Enable ASLR by default for 64-bit PIE binaries. */ static int __elfN(pie_aslr_enabled) = __ELF_WORD_SIZE == 64; SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, pie_enable, CTLFLAG_RWTUN, @@ -194,9 +193,9 @@ SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, pie_enable, CTLFLAG_RWTUN, ": enable address map randomization for PIE binaries"); /* - * Sbrk is now deprecated and it can be assumed, that in most - * cases it will not be used anyway. This setting is valid only - * for the ASLR enabled and allows for utilizing the bss grow region. + * Sbrk is deprecated and it can be assumed that in most cases it will not be + * used anyway. This setting is valid only with ASLR enabled, and allows ASLR + * to use the bss grow region. */ static int __elfN(aslr_honor_sbrk) = 0; SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, honor_sbrk, CTLFLAG_RW,