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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D70DC433EF for ; Sun, 10 Oct 2021 05:29:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A0EDB60F5B for ; Sun, 10 Oct 2021 05:29:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A0EDB60F5B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id DEB766B006C; Sun, 10 Oct 2021 01:29:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D9B7D6B0072; Sun, 10 Oct 2021 01:29:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8A64900002; Sun, 10 Oct 2021 01:29:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id B56AA6B006C for ; Sun, 10 Oct 2021 01:29:28 -0400 (EDT) Received: from smtpin37.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 6711A18024CF9 for ; Sun, 10 Oct 2021 05:29:28 +0000 (UTC) X-FDA: 78679400016.37.DE1FAD0 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by imf07.hostedemail.com (Postfix) with ESMTP id AB8FA1002ADF for ; Sun, 10 Oct 2021 05:29:27 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19A5BiEC025590; Sun, 10 Oct 2021 01:29:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=pp1; bh=shUZ6uqlQTOHed2KAnYjTi0w/xXr6hUSlmrC1GmJuNI=; b=qavXZzNrbaNTpa1IcpTgPSXomJ7rEtgtIZmWFHX2upg0lG9PX9Ou4Xt56crxT+8WJJor Aw9WCDoO3exGtXBTHUHb0h4fshk44sEhj2HrcFY9xwzhL/gsmyTsEQGx5sJARyz7lAIx P8fMwrqughz5QRMaIbgVaBYhPNuQNRw/aBNJ+ERSlxUEQkUQ8sSVJkxwtj6DPgZKyG44 ObzcC9L92eIEz+cMqrsKYifpf5eS7lr7mGXbjhzpwG3PkpDOh0CTr22E6z8kzbfvrjA0 KsLF2jhFsgg+E5+aGyMKm5okqjUYTqjeQYCj+8KB2AcWlXvVAqNZLgH4s8sNFOsPeCAz EA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bkstd85tf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 10 Oct 2021 01:29:26 -0400 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 19A5TQ0r011505; Sun, 10 Oct 2021 01:29:26 -0400 Received: from ppma03ams.nl.ibm.com (62.31.33a9.ip4.static.sl-reverse.com [169.51.49.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 3bkstd85t6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 10 Oct 2021 01:29:26 -0400 Received: from pps.filterd (ppma03ams.nl.ibm.com [127.0.0.1]) by ppma03ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 19A5R9AN006970; Sun, 10 Oct 2021 05:29:24 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma03ams.nl.ibm.com with ESMTP id 3bk2q8w0e5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 10 Oct 2021 05:29:24 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 19A5TLnO62587264 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 10 Oct 2021 05:29:21 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CB09EA4054; Sun, 10 Oct 2021 05:29:21 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A453FA405C; Sun, 10 Oct 2021 05:29:20 +0000 (GMT) Received: from linux.ibm.com (unknown [9.145.54.246]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sun, 10 Oct 2021 05:29:20 +0000 (GMT) Date: Sun, 10 Oct 2021 08:29:18 +0300 From: Mike Rapoport To: David Hildenbrand Cc: Nadav Amit , Andrew Morton , Peter Xu , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Nadav Amit , Andrea Arcangeli , Mike Rapoport , Jan Kara , stable@vger.kernel.org Subject: Re: [PATCH] mm/userfaultfd: provide unmasked address on page-fault Message-ID: References: <20211007235055.469587-1-namit@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: K_g-r_8Z10k5Tl0NqMdiPO_rmmbBoPg2 X-Proofpoint-GUID: tO4xLlIrcooGRdes9d51jzYTPheidXTO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-10-10_01,2021-10-07_02,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1011 suspectscore=0 mlxscore=0 bulkscore=0 mlxlogscore=673 lowpriorityscore=0 malwarescore=0 priorityscore=1501 spamscore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110100034 X-Rspamd-Queue-Id: AB8FA1002ADF X-Stat-Signature: zepwr9iehcofwt3ftgq1kug3pwi8pwah Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=ibm.com header.s=pp1 header.b=qavXZzNr; spf=pass (imf07.hostedemail.com: domain of rppt@linux.ibm.com designates 148.163.158.5 as permitted sender) smtp.mailfrom=rppt@linux.ibm.com; dmarc=pass (policy=none) header.from=ibm.com X-Rspamd-Server: rspam06 X-HE-Tag: 1633843767-172342 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: On Fri, Oct 08, 2021 at 10:05:36AM +0200, David Hildenbrand wrote: > On 08.10.21 01:50, Nadav Amit wrote: > > From: Nadav Amit > > > > Userfaultfd is supposed to provide the full address (i.e., unmasked) of > > the faulting access back to userspace. However, that is not the case for > > quite some time. > > > > Even running "userfaultfd_demo" from the userfaultfd man page provides > > the wrong output (and contradicts the man page). Notice that > > "UFFD_EVENT_PAGEFAULT event" shows the masked address. > > > > Address returned by mmap() = 0x7fc5e30b3000 > > > > fault_handler_thread(): > > poll() returns: nready = 1; POLLIN = 1; POLLERR = 0 > > UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fc5e30b3000 > > (uffdio_copy.copy returned 4096) > > Read address 0x7fc5e30b300f in main(): A > > Read address 0x7fc5e30b340f in main(): A > > Read address 0x7fc5e30b380f in main(): A > > Read address 0x7fc5e30b3c0f in main(): A > > > > Add a new "real_address" field to vmf to hold the unmasked address. It > > is possible to keep the unmasked address in the existing address field > > (and mask whenever necessary) instead, but this is likely to cause > > backporting problems of this patch. > > Can we be sure that no existing users will rely on this behavior that has > been the case since end of 2016 IIRC, one year after UFFD was upstreamed? I > do wonder what the official ABI nowadays is, because man pages aren't > necessarily the source of truth. > > I checked QEMU (postcopy live migration), and I think it should be fine with > this change. CRIU is Ok with this change, we anyway mask the address. -- Sincerely yours, Mike.