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 C17BCC46467 for ; Thu, 5 Jan 2023 01:53:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D16E8E0002; Wed, 4 Jan 2023 20:53:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2800B8E0001; Wed, 4 Jan 2023 20:53:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 148D08E0002; Wed, 4 Jan 2023 20:53:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 05A468E0001 for ; Wed, 4 Jan 2023 20:53:12 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id D70314038A for ; Thu, 5 Jan 2023 01:53:11 +0000 (UTC) X-FDA: 80319072582.12.EB11375 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by imf20.hostedemail.com (Postfix) with ESMTP id 317411C0006 for ; Thu, 5 Jan 2023 01:53:09 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=OE2yoCmN; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf20.hostedemail.com: domain of jthoughton@google.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=jthoughton@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672883590; 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=ss9yhGcodWv1DQGxova2CHsdFFoeyn3lh8mVFJsJXkA=; b=dPHnRv70YwV5VqPMF9h/0QhWH18x8EjVxyHR/TvuaQsuD6oZnjTPI0N4fhK8bJcx0M50O9 MQr8rBhPvRclcHV0eF0d0ACi6oq/iDfmdImBa0hKKhjUbpn10vuY4u7wMk8xblU5VBI0AD io/f7kcQJrZr5QRD0CJglr/6nqX/9jE= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=OE2yoCmN; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf20.hostedemail.com: domain of jthoughton@google.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=jthoughton@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672883590; a=rsa-sha256; cv=none; b=DpwzdJQelvtXHexUJwzYLeq9MM0Xn4TXV8930MO6xci+XLj0e06lsYJDgUo8w5pGWAnj47 MOfhWQ3FqGCRxZa6jmHRLFB3ttGDFmUjXv17i8Ne80hbvlgDvFjSopGsNo9w+GBpJxHy8n 0lDRehVqC2EpVn0x2VrUN1MuPnZUzY4= Received: by mail-wr1-f41.google.com with SMTP id bn26so15336819wrb.0 for ; Wed, 04 Jan 2023 17:53:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ss9yhGcodWv1DQGxova2CHsdFFoeyn3lh8mVFJsJXkA=; b=OE2yoCmNzsZVAQi3rSz26k+QZIZuIfQ3AtDLS5DmPR8LsvHBwOIf6ylf5Fjyc4e9S/ QIr5/QSpvQrWnmXSwlr4ezEc6i0j9x+6h6D5cS2fzrNm9fxmOgAGOvAYk2G064ZZBoNn Pqfy1hdYxUXrLC3W2Zyqx0BkB9aGzGTtHrFJ91NkrZ641gCIR87oZwwEgO0fsUeSICTq xewdniGh3QxOmySuXp4uFVHitTl2bGU7Cl054FzG+vjvEhxIdTHf4u0ISYrBRN6cioyb 4PFv4fMFbbYcYPIY7MwkHaspC4r4wsndN6wX54EmcwpU3tqy3AiJpkIHBJwwkTrUDujD CepQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ss9yhGcodWv1DQGxova2CHsdFFoeyn3lh8mVFJsJXkA=; b=VTsp8XIQA9D7UY6XQzdOtAO6bap7ObCK90oGutGZVdUDA3CaPgUb2rK7fqvN6F8gRt /FQsCiU9ZWDlVJO8B7COY59230RvhGXUiRUH/KDBUFkSqdr8ootSBGvYr/nk/adLuK2D VgigGkpuZaQTTz+bPKh9Kra1tJK5GoDOBmazXs4GkgDlqZynj0QixG3xFUouRc3u9JBw nmN5JM7LYCTpOssHdpFw5lSqgMXyOXsPpZCno1LO3V2cPPCV4nyfCjAeLyD9By3UzvFu FtCpkRcCT8sMKzDqxWHtaK18hapwZNGwJPRy6IpLvzxfq7h+0YlPcnKcdMrOfMIIrMyE Zn0A== X-Gm-Message-State: AFqh2kprhspzdS4Hu3vhZWGrL5pqeKuQxNVbKDXqYc4zaOCY+TY4/Zw9 yxZpFh7+CU3CeHDt4864dymUux7/NWJBcSOPrS+rXX44RcsHsU+g X-Google-Smtp-Source: AMrXdXvHftDidmOqzjrCPQSF/Gf47TdU8ko2g5NM1kxKona6P4fGn+QyxnKMu64Yd7SgiR6WS2L83XW7z2JNTR26u7E= X-Received: by 2002:a5d:6148:0:b0:280:91ea:29b7 with SMTP id y8-20020a5d6148000000b0028091ea29b7mr1044383wrt.98.1672883588801; Wed, 04 Jan 2023 17:53:08 -0800 (PST) MIME-Version: 1.0 References: <20230104225207.1066932-1-peterx@redhat.com> <20230104225207.1066932-4-peterx@redhat.com> In-Reply-To: <20230104225207.1066932-4-peterx@redhat.com> From: James Houghton Date: Thu, 5 Jan 2023 01:52:56 +0000 Message-ID: Subject: Re: [PATCH 3/3] mm/uffd: Detect pgtable allocation failures To: Peter Xu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Kravetz , Muchun Song , Nadav Amit , Andrea Arcangeli , David Hildenbrand , Axel Rasmussen , Andrew Morton Content-Type: text/plain; charset="UTF-8" X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 317411C0006 X-Stat-Signature: rtt1888sn85ccs5kq6eqsnu5quhuismw X-HE-Tag: 1672883589-154497 X-HE-Meta: U2FsdGVkX1+YtwUowEajT2KIDYzFFpitSxiQhFHLStyfo9vVksflFPfaxYV3M92xkIg0okVoN/ht2agTvi3/RSBKBMfgmwAoWxzFAT3fo3O/DASuMHegi5S5RUttbjZen/aHnOjs/9xc29DyEpXr71R08+dRrWoCgzRj6GlyCGfqn4fSc5dXmAGRYdUbk5MZCpDgBLLJIBPCsbfi9svA/wKoEGouUYK69EVHryKHtBGg2+uGgdskrNH/PPQpJssc2f7IsVAyK+syPS/O+4EReRV5XmQHrt33xw2xSkKU3omjDw0g6t+RWy9mgV6yUIkdbEyS+AmPOapZ/UsnyH4jkJVaTjuLTGuMSqDmhQ9FCcfTJm3WD93XDQKvRsg93l8VaXwuk22XKl6XDpAwK7O/oEVuATdOBNs6QdwhXVUsHJktPXBEwWAAp8jeqRTLMLBLBQZR/GEOX/59XEMJO5zZLkLWWcCQYbfD/yPeswFsuN7oCDdGW5x4J6wwPJh+0uZuYUgvgQNRmnkvEFyNkoBuLaSOhxVx0XAZKSjHBA+hDIH4b8g8REiYP1uZixiSs9tbtAQsYmMawgaOerZ+/oj3+CdgzDpz2+9InLHN+Ld+OGijPM8c6oaHYCnYXRCw2NCEZgVKbaMhQ0rxUSNR9GAEk/6z4mDaGpXm3/7M8rpyP7a0jr3m6bK0aSLE91ySw9/4KQ9zeSz34OK8LU5emibXlytcp6t47o6ZYuLPNTl5hQlwD5fgJPRTfisPsm8UHOby+a9HOxfHGCNrHEr+euSmeHbOWJvEMOBU4d1mELEF0POIIgI+PReRn1J5SA/GvzR659KBtVZqSxD2JQP9cFyjGPSG+NaxTes8/IfB/q3TaBY0hylQshl2NxuMkyaLLRSht6o/4BRYX1wPOVIHNxDFD0+lQkBJJTiBS0P3vM72kVRVjFFMeG3rYInEpQR7yCAOM6oy0sKXKgTLOEQF+hL 8tmPOTdW xovuq62AGApHHkPgF4BdD1kEgy9I844W9gnljM2KuHSmxlLZ6SZRXMZ78N0KCs7h+ZZ55sp9hDCLedKM= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000048, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jan 4, 2023 at 10:52 PM Peter Xu wrote: > > Before this patch, when there's any pgtable allocation issues happened > during change_protection(), the error will be ignored from the syscall. > For shmem, there will be an error dumped into the host dmesg. Two issues > with that: > > (1) Doing a trace dump when allocation fails is not anything close to > grace.. > > (2) The user should be notified with any kind of such error, so the user > can trap it and decide what to do next, either by retrying, or stop > the process properly, or anything else. > > For userfault users, this will change the API of UFFDIO_WRITEPROTECT when > pgtable allocation failure happened. It should not normally break anyone, > though. If it breaks, then in good ways. > > One man-page update will be on the way to introduce the new -ENOMEM for > UFFDIO_WRITEPROTECT. Not marking stable so we keep the old behavior on the > 5.19-till-now kernels. > > Reported-by: James Houghton > Signed-off-by: Peter Xu Acked-by: James Houghton Thanks Peter! :)