Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2788147lqp; Mon, 25 Mar 2024 09:12:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXfHdcJa4JYCfirlBbJ3CwFbvuIjeXnTQFN9Ah/9hTRyPWkHSqDhHSPi4wgiE9eHjIiRg2SAqUJa9lt2KNEkcF4znSWh6Vdq9TETaRDyA== X-Google-Smtp-Source: AGHT+IFrFocijCS+CFZwgUdvOtPC12OQCax1RFSul5NA6hFHTiwXkwKJg4P2QqIwaKkAqUoXS9Dj X-Received: by 2002:a05:6a20:4388:b0:1a3:720b:7bb3 with SMTP id i8-20020a056a20438800b001a3720b7bb3mr7320719pzl.55.1711383164757; Mon, 25 Mar 2024 09:12:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711383164; cv=pass; d=google.com; s=arc-20160816; b=FakUJiD9g8DTcwLINbRWG2jRIEs2atqNbOfkxgD3PU2NQgk7HcU42j1kXA/5QEtwI+ Wz95RdIGam6Gy3IMOOuBhYrY3ijHjCBbqBtEmekE0+/FSAxx8gXoxIm0FDRn0AZCeax9 mf9Z4p8zSyPGDTYi5fpHLTY3o2IgOf3sgnOR0QUjT+MHr+gT96p0JPBthKO2luACulo1 DWhLWN5D9+3UZUT4/nrv4PL5xJ2EzFIoaTdUVXeVtzmRTLn127qJRzvEzINpNk61TpaX SOLNettZ5TE64+nOGkw/BtdWuZvL1wiuUtxBnqqTddV8CJimj4xdjqJ7aXUIwNnreWZ7 TrXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=stQvP6laILDGNlyKdB5zsolFqWnOVdSrYR9bZmkcQ4c=; fh=rWcW5SCaRpCC57PFTQcoQDfIJzSkNevcPBdi/zC66HA=; b=NijtdZHxhnq0AN0d34VgOmxjWMquhGCuHX0JuNbU0wFzuenjaNRpBEsliEyyIgG7Gn qwp/Cm8Us9c4JeQiVckDwd5RfdJ/rStmutpH+DqxF+javoCh1y6ApSvX9CryEt/Cf8tS qIqzDDhY2THW5PaAxJIP8zo7DyvjsTMYlZOZSkx9ppfRcjTr1gdANfPH/jCu+sRbjtaT T+6y/ntUr6BP/wZxp9z8MU96SAV6VZf5dpoJ49teRx+2xBzUd21OhfeZkZmsbZX9XDV1 H+QtSZU6RaIQ02ixQj3S6HYe7VP+vyvQMc8hYgvML95YPFvYHjTohy2Afcs4ok9s89Na b9gg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T292jTaQ; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-117160-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117160-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j5-20020aa78dc5000000b006ea871c00e5si5403951pfr.83.2024.03.25.09.12.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 09:12:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117160-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=T292jTaQ; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-117160-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117160-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A5B793449E6 for ; Mon, 25 Mar 2024 16:01:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CBE012DD80; Mon, 25 Mar 2024 13:41:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="T292jTaQ" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D20C83CDE for ; Mon, 25 Mar 2024 13:41:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711374089; cv=none; b=GPSZRyPF5vSdbl4EIyETkRqp9mkR81FACg0de4Wr+sHc+l86pvLOzXz0OkY/mYyqK8VTCHge2ljWQCbROSPWZ7ZoSj6WgXBYtVkf78DBh9NQhtHYSoxb8VIU59T43fBbkB23idTTAwHovCZVAJ0LTDYV7bT/JmG9wu2+BIWCKn0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711374089; c=relaxed/simple; bh=RwZOPAwjCEBMOkBn0hi/OdheNFiglgJTPGD5gXKkYx4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=j0MxgGkRpwN+RYErIVw5/qGP1NjGzBAIARLF4FRp2OKeJvnBfYuH3PprmdBlIChlAk+qcDmQG8Wquez6Hx9yHknuYB9vxdEHHDri0+VnSPkNwgGDocrOHwoTtCgcDefOaZEnOPU8raHCvkg5OKvL/9q0VZeI3AxbAMcjNRhAvZ0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=T292jTaQ; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711374087; 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=T292jTaQ6zK/9Fse61YJqS6/+ALhpHLXvdT4BM13nSNQ50PMz15lBEs27EU/XIjcEE++XY 4DvV3RBw26FtG3iYTV5ud2iwpKZWR9m+aud04Wx6aLW6N4mski17hlHhoPY41Ls/IpJEQF sKwvTTeCEncNZnByYfReonggCQCW1ok= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 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(-) -- 2.43.2