Message ID | 20230412163922.327282-2-peterx@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 4EEBDC77B6F for <linux-mm@archiver.kernel.org>; Wed, 12 Apr 2023 16:41:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BDD98900006; Wed, 12 Apr 2023 12:41:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B17C1900005; Wed, 12 Apr 2023 12:41:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9B9E0900006; Wed, 12 Apr 2023 12:41:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 86480900005 for <linux-mm@kvack.org>; Wed, 12 Apr 2023 12:41:28 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5A93E1C4795 for <linux-mm@kvack.org>; Wed, 12 Apr 2023 16:41:28 +0000 (UTC) X-FDA: 80673304656.28.02F188A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 219FA80006 for <linux-mm@kvack.org>; Wed, 12 Apr 2023 16:41:25 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=L1WtCURk; spf=pass (imf02.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681317686; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=09jtKKMdBkZ99/jQ3MHG3Gpu4kZKeE61xD5S9ADSCnE=; b=Hel6t+yBJOr+BO4whyQhzwzRP4UN4z+a415tTaeNA70zwXzsh97KAGoZaz8ANDNEwwr4X9 pNBqPdVCcIvjg1Udu1+ihC6I0iuHt/y2EPWoMRVhVqQTYYcdl5RT8Q4NpyVAqIN8JT6BgE m5yxtoceeLjQQEuxQ8QhIg4bGmPRwKY= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=L1WtCURk; spf=pass (imf02.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681317686; a=rsa-sha256; cv=none; b=VWDwJi5za/t//uizKwriJTf5k9uIbrdEzN37p+/KMIeuvXoPODavxOPYSIIhK1yxvkDSQa +tHxwYm9gI45Gbjy3EA2cHBRuzZb+K0n02NXOFmNzLbVNJLxV0LzxV//WHDiH6POGqILrU u0+NbT8K5jTG1Wt/dU6P0ZG8XOkwc/0= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681317685; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=09jtKKMdBkZ99/jQ3MHG3Gpu4kZKeE61xD5S9ADSCnE=; b=L1WtCURkVmmrnaVbrSh3rk+PeoTcvFQO3r9RR4E3kVnwaD58gkAoHTvzQ94WGNtcm25Q4C bhXhYlUFeZwoIQQ1CEU1B6DDjYUzLlKLFa3XaU2ZUaLyF3TW45SxROiyliKDy+ICmWK9iI iz+09Ti5Q6ltKHiGnlwUXy/smJyk4MI= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-342-2fG4ityJM2GIPJ2hvl6AIQ-1; Wed, 12 Apr 2023 12:39:31 -0400 X-MC-Unique: 2fG4ityJM2GIPJ2hvl6AIQ-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-74a25fcda05so77557285a.1 for <linux-mm@kvack.org>; Wed, 12 Apr 2023 09:39:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681317565; x=1683909565; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=09jtKKMdBkZ99/jQ3MHG3Gpu4kZKeE61xD5S9ADSCnE=; b=iXeIvBXGsM6aPmocEWkgAnkccSF5HMkqx4t/OwW96uPUk7dCVgwKBwzgoNHEvW5TE/ kzgndShzn6pMEp1qIOVX+ojRrO/sRfpkrgXgjFiQvKBHLW588rhk7ad2yZKyQRxDgHUM bT3fib3ZzLUUYUBO5EPlPLQEZdHv8pW8duNc/vdQAd+TLwdf7+DxrHKaGv+PX61WmAR6 oBai3cs0hxPZWBhMzYmEc2kEAiz5n7xcp2OietXGgMhu6u4z8LCdpag5WHlg5vl38/th jUYoZyhwNRf6zaRfqcwfoeVKJ57HSEF130x1YrdA8sntPqqcjDyO4OhwVDhk6jkKS4TW ZYag== X-Gm-Message-State: AAQBX9f7kaki1U13hJuOIdrZcsYer5X/hIzFrI7/TtV1yVhteCMIcTQS DoDxFflXzFmvaKL37GsxVNqkwehZYE1CPPLbsrhPyXpTpqZ/FNTnoE6pZ66Jk/bfWjg5po8CcBJ vNVT1EwcDx0SYdDITmdwXupLg3b+Ah3KnyyLXCjrNYfq9AwkjNb2ldsuZ3dDu278GWorS X-Received: by 2002:a05:6214:401a:b0:5ea:a212:3fe1 with SMTP id kd26-20020a056214401a00b005eaa2123fe1mr4433909qvb.4.1681317565796; Wed, 12 Apr 2023 09:39:25 -0700 (PDT) X-Google-Smtp-Source: AKy350Yg5QWvOjiNFwdYfa/fZm9pN7qYxhapB7GAqOu9LrBAaJTeYn6HJOMM2S2srwUeyNYUeY/ZiA== X-Received: by 2002:a05:6214:401a:b0:5ea:a212:3fe1 with SMTP id kd26-20020a056214401a00b005eaa2123fe1mr4433881qvb.4.1681317565461; Wed, 12 Apr 2023 09:39:25 -0700 (PDT) Received: from x1n.redhat.com (bras-base-aurron9127w-grc-40-70-52-229-124.dsl.bell.ca. [70.52.229.124]) by smtp.gmail.com with ESMTPSA id u13-20020a0cc48d000000b005ead602acfesm2669536qvi.35.2023.04.12.09.39.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 09:39:24 -0700 (PDT) From: Peter Xu <peterx@redhat.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Leonardo Bras Soares Passos <lsoaresp@redhat.com>, Andrea Arcangeli <aarcange@redhat.com>, Axel Rasmussen <axelrasmussen@google.com>, Nadav Amit <nadav.amit@gmail.com>, Andrew Morton <akpm@linux-foundation.org>, Mike Rapoport <rppt@linux.vnet.ibm.com>, Mike Kravetz <mike.kravetz@oracle.com>, David Hildenbrand <david@redhat.com>, peterx@redhat.com, Dmitry Safonov <0x7f454c46@gmail.com>, linux-stable <stable@vger.kernel.org> Subject: [PATCH v2 01/31] Revert "userfaultfd: don't fail on unrecognized features" Date: Wed, 12 Apr 2023 12:38:52 -0400 Message-Id: <20230412163922.327282-2-peterx@redhat.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230412163922.327282-1-peterx@redhat.com> References: <20230412163922.327282-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 219FA80006 X-Stat-Signature: gje9mac5oqi7prhu9xknobsjbajgk7ih X-HE-Tag: 1681317685-919997 X-HE-Meta: U2FsdGVkX18RbcNT8XPrnIpQRwllGvLpKAuxpMWVMMFZnrh0WKdNXPoMgSiK+fjNR65S7N/hDOtjruxfA+DMyd4Dp7yapLbjmMEXLENR51Hvk2VpHodGqDBi58997ayuivyhxvpG0cvRrfqECgwUc157BfFbbSZT+7TrelnFKlhTsyv7QrBnP01BNVH1QWjOPvDjGDFC0j6ESz7m/XDQ8tyX+0WiAT8kVW8ouaNMKNHrMCYAvGBrzVrOF4c/9a4MKiyAVhH5zqNu3ExrqiTKv8ebFO8B//4qylD/Fto+Ie8YvfpXapkxWIRz13kCtDOxqdULCqKKe7bwY1KyKSAPii0PThTOGFgZJa9kDwh1tabEVNLh1W/PRzSU5I2ChaV2OCNCKRfqlkT64bVmIbOjcdAHF/A3mLfXhxEx/9+SRqLHtQE/Q193CmkXGriRL8zFiVjnB+40eNFnl0jUFJNkw5LH4spEDuEZb9qawBNPKAN4v0G6JyDRr4MngcI2m3UrUxX9gml/Y5FXpd8hjvA+C5mDZGowUyb8ByNH62rfUo3RtdqSgWCs0hK5xIwI1QOoYwg/FviV9REKhwb00dFgVymbNMRM3sFcjOygy+NLIb3OPC7WfjaFNAquLVdV5msphPKbNj50PCM47WjsJJOEqYgYFa4OfxZT30UtEHWLG4CeTD968E0AW/ZJC1S3EdXSj2G9ggO9lnCgUzf+KhBqGBw57SKTydV8ZM+KtNbDwB2x6nhhwrWH+yK9gnQ/+zAromHky4bunzXW5keBT3si1MFwLWoYWw9zDroHJPAkOUGKIEVZLDTS/hve9nPCAY7UD8Rwec3xh+Ii6lQvs68cO0bVje31Iz/PeoigAMA2Ck+f6FvRgx66Qca6SArCRL+l4Sy7FWq2K9Zk3fDrDUFtsZiRtIEveGhAOTcq7wXyKNypPbZRIX0DvLW6mi64vGV0jNWcV9mnyJBeGLM2QGz VT6nZnmC baQERl5o12I8zpwdUNF19q/xt8iQL4xNVzpmSC2XfpfkUmmgbDU4nWWX9P0Os6M0fK2Gf5FUje7MfVnhdT3p+xIwKBD/GxHXIu7EmUf3S6WtskJhQP0PRnXFWQJbDzJmWU77Y28nbVTZmsGyDSDJ0zgy94142atL/wUAYzI3lCWEW2+7VDCv2s08XCeoc80pJLcy0XK6dvos7uq7jNONbU2qx6cYT7PDrrXnSswb0YWGleXKW2te/oldmYajITu4wY6xDdq4TmQMLL0qJIxqt1PDy34fA1ozBkySdnUb6apm8Odgk9mLhvZTr4UFkSpZboMbnDlTYdHx1qsCJoZZ3EaZgFlGlwdoxi0eH/Cf6TZqij9ZYwTDRH6sAImetUmqOYlaHOxnJRnPkj606Y1758mlAjhaPgfmlYsPIiyXqh/vPWYHgvEaLPIrN+/jDtOdYseHfApoGSufa17vAXble3TNoYGHSCQB9iWGcD+WxtZkkXUFEgDI8h/HSZtSRPe4McmOzXSxWjz2kdohYGCZckiWoziL3V4fnhyCC8oMdWkhpOX1RYXAm8k10/DKfbbDQnxmfulnRPVTsZdMouGZnaW/YsmddGs7N3qAY X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
selftests/mm: Split / Refactor userfault test
|
expand
|
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index 8395605790f6..3b2a41c330e6 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -1977,8 +1977,10 @@ static int userfaultfd_api(struct userfaultfd_ctx *ctx, ret = -EFAULT; if (copy_from_user(&uffdio_api, buf, sizeof(uffdio_api))) goto out; - /* Ignore unsupported features (userspace built against newer kernel) */ - features = uffdio_api.features & UFFD_API_FEATURES; + features = uffdio_api.features; + ret = -EINVAL; + if (uffdio_api.api != UFFD_API || (features & ~UFFD_API_FEATURES)) + goto err_out; ret = -EPERM; if ((features & UFFD_FEATURE_EVENT_FORK) && !capable(CAP_SYS_PTRACE)) goto err_out;