From nobody Thu Jul 20 20:15:15 2023 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 4R6P7Z0nD6z4p5Nc; Thu, 20 Jul 2023 20:15:22 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4R6P7Y4n5Jz3GpJ; Thu, 20 Jul 2023 20:15:21 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Authentication-Results: mx1.freebsd.org; none Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 55EC13C0199; Thu, 20 Jul 2023 20:15:15 +0000 (UTC) Date: Thu, 20 Jul 2023 20:15:15 +0000 From: Brooks Davis To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 21e45c30c35c - main - mmap(MAP_STACK): on stack grow, use original protection Message-ID: References: <202307201412.36KECDSU084918@gitrepo.freebsd.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <202307201412.36KECDSU084918@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4R6P7Y4n5Jz3GpJ X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:36236, ipnet:199.48.128.0/22, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated On Thu, Jul 20, 2023 at 02:12:13PM +0000, Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=21e45c30c35c9aa732073f725924caf581c93460 > > commit 21e45c30c35c9aa732073f725924caf581c93460 > Author: Konstantin Belousov > AuthorDate: 2023-07-19 11:05:32 +0000 > Commit: Konstantin Belousov > CommitDate: 2023-07-20 14:11:42 +0000 > > mmap(MAP_STACK): on stack grow, use original protection > > If mprotect(2) changed protection in the bottom of the currently grown > stack region, currently the changed protection would be used for the > stack grow on next fault. This is arguably unexpected. > > Store the original protection for the entry at mmap(2) time in the > offset member of the gap vm_map_entry, and use it for protection of the > grown stack region. It occured to me to wonder how this interacts with __enable_execute_stack(). I think it's ok so long as the compiler always emits __enable_execute_stack() for each trampoline and doesn't depend on extentions to the stack being executable from the first trampoline creation, but I don't know where to look to verify that's the case. -- Brooks