From patchwork Mon Mar 25 13:41:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13602228 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 5BD23C54E58 for ; Mon, 25 Mar 2024 13:41:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C7ED86B0089; Mon, 25 Mar 2024 09:41:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C2E586B008A; Mon, 25 Mar 2024 09:41:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AF5FE6B008C; Mon, 25 Mar 2024 09:41:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A10E06B0089 for ; Mon, 25 Mar 2024 09:41:32 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 76294A0853 for ; Mon, 25 Mar 2024 13:41:32 +0000 (UTC) X-FDA: 81935673624.02.9D73670 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf29.hostedemail.com (Postfix) with ESMTP id C50B9120017 for ; Mon, 25 Mar 2024 13:41:30 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XhQ4oOvn; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711374090; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=stQvP6laILDGNlyKdB5zsolFqWnOVdSrYR9bZmkcQ4c=; b=kHM9TgQ0p+xPrVXbtqwDuj5qQ5xFBH2Ls5wDiMdTxF7wUf1pjGUW+o2Pdg5Fx734y2Cijt 8HBJIRao4hhvqjwg1+Ep8cbiUqZ16C7ee3wLZB1IE3t2txafhTAkMvHTbmXRXDaaVha0uY fsq2Np5+zON1uXigWQs0xVgVd4Bp2RU= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XhQ4oOvn; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711374090; a=rsa-sha256; cv=none; b=iA80VdjqJhxWRMU86qwSm9p2JUgMGhD4xCQmFsG8kmygEAP0g85MRAUEsH/Ti1eBGGF7gV oEidSYXHketBX1j3kUNwjDUsI4/oaJRv8rkcn2MVOH+SktTc7HekfdD7HgZVYeyVsMShdW fbjoJ3+2I4kmMmDOEtUqIExPiWvD1OA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711374090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=stQvP6laILDGNlyKdB5zsolFqWnOVdSrYR9bZmkcQ4c=; b=XhQ4oOvnqGiZSRL2eOKNtwI0boySlXrc6/HOqp5zU5blUjdTr944YseQ4Nja3NUH2H6y67 ftPTQOXHmgrnJHs5nbYjUkInu52nPUV3ofceySdEF72VdjbA5JvZ8qqO25+vZh3FhXtg9H VEct4+pxZOeWRHbqcXxNF/dUnoHcRdQ= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-180-RMWioxctObOBJuESaGvNAQ-1; Mon, 25 Mar 2024 09:41:25 -0400 X-MC-Unique: RMWioxctObOBJuESaGvNAQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3BEC91C0F478; Mon, 25 Mar 2024 13:41:24 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.193.143]) by smtp.corp.redhat.com (Postfix) with ESMTP id EEC532166B35; Mon, 25 Mar 2024 13:41:19 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Mike Rapoport , Miklos Szeredi , Lorenzo Stoakes , xingwei lee , yue sun Subject: [PATCH v1 0/3] mm/secretmem: one fix and one refactoring Date: Mon, 25 Mar 2024 14:41:11 +0100 Message-ID: <20240325134114.257544-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Rspamd-Queue-Id: C50B9120017 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: p38nn4bph8wgbp7fjxpwy6y587867x3q X-HE-Tag: 1711374090-515774 X-HE-Meta: U2FsdGVkX195ByoQRiD0lw4aisAl+3hWXMUaPmcQ8oy5Ueyzgk/pSAGUixFxggwKQvOJ5Lgh+FBPpxkZomzXphxhsyRsHUmKWt0z/kbXkls9RyC67UebdDGJFR30Gs8IW8V/vJNI/l/PZBk3hIvH21KV3Fjj5QPWVo0gjFuJLNrtJ+F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RVt6JkrL9MqbXKjdswDWFTxUNiSa3umHfxVzA== 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: Patch #1 fixes a GUP-fast issue, whereby we might succeed in pinning secretmem folios. Patch #2 extends the memfd_secret selftest to cover that case. Patch #3 removes folio_is_secretmem() and instead lets folio_fast_pin_allowed() cover that case as well. With this series, the reproducer (+selftests) works as expected. To test patch #3, the gup_longterm test does exactly what we need, and keeps on working as expected. Cc: Andrew Morton Cc: Mike Rapoport (IBM) Cc: Miklos Szeredi Cc: Lorenzo Stoakes Cc: xingwei lee Cc: yue sun David Hildenbrand (3): mm/secretmem: fix GUP-fast succeeding on secretmem folios selftests/memfd_secret: add vmsplice() test mm: merge folio_is_secretmem() into folio_fast_pin_allowed() include/linux/secretmem.h | 21 ++--------- mm/gup.c | 33 ++++++++++------- tools/testing/selftests/mm/memfd_secret.c | 44 +++++++++++++++++++++-- 3 files changed, 65 insertions(+), 33 deletions(-)