From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AE65D6EC05 for ; Fri, 29 Nov 2024 12:35:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E4F536B0083; Fri, 29 Nov 2024 07:35:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DFFE16B0085; Fri, 29 Nov 2024 07:35:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC8816B0088; Fri, 29 Nov 2024 07:35:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B1BA06B0083 for ; Fri, 29 Nov 2024 07:35:08 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 4C4471A0CFB for ; Fri, 29 Nov 2024 12:35:08 +0000 (UTC) X-FDA: 82839077244.22.75D2530 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf24.hostedemail.com (Postfix) with ESMTP id B212C180016 for ; Fri, 29 Nov 2024 12:35:05 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=YR+V2nnc; spf=pass (imf24.hostedemail.com: domain of alx@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alx@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732883697; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pfeHgU5+xfeFfx5XgDoz5q+ry2sy6wy/jSxpdndXY7Y=; b=p5b/PrDuXLsROOQ3WrcqdORKSl1D8lbhPcdDcyPXOMmhDqB48JkTl/vkWvS1gT7a1/Rp/w 1CIje8cnJHzFuCkR0EAMzz1dfqlXVHdNedTcWZNtZkSs0yw17VymYJRh0kW0FF7BnsbLq6 hgZltaeu2kJRiztAsVq3JZruuXD3r+8= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=YR+V2nnc; spf=pass (imf24.hostedemail.com: domain of alx@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=alx@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732883697; a=rsa-sha256; cv=none; b=Aq9ebN1Pn2wkyGMLNZHf3fuvXaBpg1qdnsZxS5uPq/jI6jPAKTl9S0f86rCvWUH4brUWvR J5fn6KK0cRe9OusUdiz8yVu5u47Kuv8YNNARJB3Jodr5X4FWZsL3zN6QsYvD0a9C8ibZmj AS/mpzlAuiCaAt/cX3zqGOS5j2Uijr0= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 6377C5C5BC9; Fri, 29 Nov 2024 12:34:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9ECAC4CECF; Fri, 29 Nov 2024 12:35:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1732883705; bh=XNE0oksd1acGuTlw3D8v1/YWaH6Tn3mMvwHi0ZtORf8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YR+V2nncD41i5MMoWMXI8FA0PvOu9wdl3jXSrK0RVzoJnyNsk7SxedyVCVGsjkgJW YouTu7MgwIMgXJbnQc0E7rUmiO1NOXl+euYIEpHlCQm/rnLPMNhYjp8d6gu7HRut04 p9sdOGTRqxL5RdEIIaOZUOdykX1jN8vt5sd2YKOTsc+c7FSFtS6XYW75bt6R9uNW8N v61CEA728izmkzLjSJRXdsGgHQHxSf6duqendm/aemZlP1Q+TYnp8XA2VaZMA1MZ8u 0VjnNLtPGd1WAnxaaXSMPYWbcbehm86KmkHXxZ+B090l67TeuXOmbtgroyFsT8HZfe kfZyOp2PTvQ2Q== Date: Fri, 29 Nov 2024 13:35:01 +0100 From: Alejandro Colomar To: Lorenzo Stoakes Cc: linux-man@vger.kernel.org, Suren Baghdasaryan , "Liam R . Howlett" , Matthew Wilcox , Vlastimil Babka , Jann Horn , linux-mm@kvack.org Subject: Re: [PATCH man-pages] madvise.2: add MADV_GUARD_INSTALL, MADV_GUARD_REMOVE description Message-ID: <20241129123501.hvw6cij4trdao4do@devuan> References: <20241129093205.8664-1-lorenzo.stoakes@oracle.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="erqfvu75ahekda4q" Content-Disposition: inline In-Reply-To: <20241129093205.8664-1-lorenzo.stoakes@oracle.com> X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: B212C180016 X-Rspam-User: X-Stat-Signature: kso4kmf98yqw4q1qy5tizsfaemruqfc9 X-HE-Tag: 1732883705-430885 X-HE-Meta: U2FsdGVkX1+xB8Kj6Ru6cYk1crkrsPlWY8lCzz2KgdMAQbm22ycTDD8bZapw/QPmWkFzRDCKTbMJ1RTqDmby1f0Nkr59F9Z47tTCI3LBKzZ8kLVu3hxv/gEcfI8busIOO4hAJxn3eWEFmtuVBX1W/K+ytbeoJbLszBbgDHWOIvOb0FCX8ArjC8RJpVBlzSZG7OPr9C+IVdHbH1fkjiU1uRePjKPyy86sRPFNtYbfcwexk23LoNuHzYnGHARdsSKzrPdIEMYTqtGKDx88PJgAvTWaZgrAS1zlH4e7a6bbT3sqRtaMwWGL4GitgOxFi/dZv5rZF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OcU/q/czu0BJ47Fanm4H2XMScU9GnA6BYBv9aWuvBWOIuyuAM1/dqwIok3eagBztcRgPGg+IcQnKm2wRN8 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: --erqfvu75ahekda4q Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH man-pages] madvise.2: add MADV_GUARD_INSTALL, MADV_GUARD_REMOVE description MIME-Version: 1.0 Hi Lorenzo, On Fri, Nov 29, 2024 at 09:32:05AM +0000, Lorenzo Stoakes wrote: > Lightweight guard region support has been added to Linux 6.13, which adds > MADV_GUARD_INSTALL and MADV_GUARD_REMOVE flags to the madvise() system > call. Therefore, update the manpage for madvise() and describe these > operations. >=20 > Signed-off-by: Lorenzo Stoakes Thanks for the patch. Please see some comments below. Have a lovely day! Alex > --- > man/man2/madvise.2 | 81 ++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 81 insertions(+) >=20 > diff --git a/man/man2/madvise.2 b/man/man2/madvise.2 > index 4f2210ee2..e539fefe4 100644 > --- a/man/man2/madvise.2 > +++ b/man/man2/madvise.2 > @@ -676,6 +676,79 @@ or secret memory regions created using > Note that with > .BR MADV_POPULATE_WRITE , > the process can be killed at any moment when the system runs out of memo= ry. > +.TP > +.BR MADV_GUARD_INSTALL " (since Linux 6.13)" > +Install a lightweight guard region into the range specified by > +.I addr > +and > +.IR size , > +causing any read or write in the range to result in a fatal > +.B SIGSEGV > +signal being raised. > +.IP > +If the region maps memory pages they will be cleared as part of the oper= ation, > +though if > +.B MADV_GUARD_INSTALL > +is applied to regions containing pre-existing lightweight guard regions,= they > +are left in place. Please use semantic newlines. See man-pages(7): $ MANWIDTH=3D72 man man-pages | sed -n '/Use semantic newlines/,/^$/p'; Use semantic newlines In the source of a manual page, new sentences should be started on new lines, long sentences should be split into lines at clause breaks (commas, semicolons, colons, and so on), and long clauses should be split at phrase boundaries. This convention, sometimes known as "semantic newlines", makes it easier to see the effect of patches, which often operate at the level of in=E2=80= =90 dividual sentences, clauses, or phrases. > +.IP > +This operation is only supported for writable anonymous private mappings= which > +have not been mlock'd. An > +.B EINVAL > +error is returned if it is attempted on any other kind of mapping. > +.IP > +This operation is more efficient than mapping a new region of memory > +.BR PROT_NONE , > +as it does not require the establishment of new mappings, instead region= s of an > +existing mapping simply have their page tables manipulated to establish = the > +desired behavior. No additional memory is used. > +.IP > +Lightweight guard regions remain on fork (except for any parts which hav= e had > +.B MADV_WIPEONFORK > +applied to them), and are not removed by > +.BR MADV_DONTNEED , > +.BR MADV_FREE , > +.BR MADV_PAGEOUT , > +or > +.BR MADV_COLD . > +.IP > +Attempting to > +.B mlock() > +lightweight guard regions will fail, as will > +.B MADV_POPULATE_READ > +or > +.BR MADV_POPULATE_WRITE . > +.IP > +If the mapping has its attributes changed, or is split or partially unma= pped, > +any existing guard regions remain in place (except if any are unmapped). > +.IP > +If a mapping is moved using > +.BR mremap() , The "()" should not be bold. They should go with the ','. > +lightweight guard regions are moved with it. > +.IP > +Lightweight guard regions are removed when unmapped, on process teardown= , or > +when the > +.B MADV_GUARD_REMOVE > +operation is applied to them. > +.TP > +.BR MADV_GUARD_REMOVE " (since Linux 6.13)" > +Remove any lightweight guard regions which exist in the range specified = by > +.I addr > +and > +.IR size . > +.IP > +All mappings in the range other than lightweight guard regions are left = in place > +(including mlock'd mappings). The operation is, however, only valid for = writable > +anonymous private mappings, returning an > +.B EINVAL > +error otherwise. > +.IP > +When lightweight guard regions are removed, they act as empty regions of= the > +containing mapping. Since only writable anonymous private mappings are > +supported, they therefore become zero-fill-on-demand pages. > +.IP > +If any transparent huge pages are encountered in the operation, they are= left in > +place. > .SH RETURN VALUE > On success, > .BR madvise () > @@ -787,6 +860,14 @@ or > or secret memory regions created using > .BR memfd_secret(2) . > .TP > +.B EINVAL > +.I advice > +is > +.B MADV_GUARD_INSTALL > +or > +.BR MADV_GUARD_REMOVE , > +but the specified address range contains an unsupported mapping. > +.TP > .B EIO > (for > .BR MADV_WILLNEED ) > --=20 > 2.47.1 >=20 --=20 --erqfvu75ahekda4q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmdJtPUACgkQnowa+77/ 2zIndQ/9ErjqhU38T69q7CVv+39FbZnEcAWNjq52JQKJReaeYtSLOSXn7QLn70Wd qCey/7mUZzG1NmZMJwziFcIBnRdjESb1bOa3tHI2J44nQ6mTuvd2IwJQtDBnNtee O80QvlV8BaCdUqKSENEnMVUfCtykWjAkuINZ5CPw7fbLlpW8/qWAIe1LoWoOLX7b PgrmDt6MaO28B2vxnsp7nb5CzKJG1svdDJy1a/YSpbiEvDbKMbNv0gA1A0db5bnF C+wQbJ8VO+SLaieJP3t5d0bQGS6Lqwq4xWT435KMOLWjqkLZMYfvg4y/AA1oeADh R7r/SV77Pi15YBlu5dlJYdEgxhCNdZPqG0rr5NtyPi+fJeX6+m0i8MDEb+D8oQuz C9BhG1bmK/Z/Wca7nSr8gveHNefAdYhoabLdwbU5zvBRqGNBZdh01l4/Z/UfCpRe ehE8+p8OQuM0ksyz7SSBj8xhRAtSazIut1vZ/XkQ89M6oOnWJ8i8csLA0q5zSdWe e0nWdpgimBjpM9Bz4bglCIcN78pcMQzmqoNfUsUPorGqQ0wgHhdMRv5U2NXOJmcY HxLkg6y8to/HUWAqLs1wkHMgeoIWcvppVB/MsGwVDhLff37CpRco97ds6C1XhIze iQQoXnJlqdh6E+TXStwsHFviO+RlHXWXJzSFvCTObnhl8/X8iIM= =DnBM -----END PGP SIGNATURE----- --erqfvu75ahekda4q--