Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1368547ybi; Wed, 19 Jun 2019 19:26:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqyf/za/4bcEcxTGheblxZmuGvllmjN1fFPo5ovrh2AKDQnwhQc1GMpvgcrOY2eic7qGM2mT X-Received: by 2002:a63:5d61:: with SMTP id o33mr10729300pgm.114.1560997603317; Wed, 19 Jun 2019 19:26:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560997603; cv=none; d=google.com; s=arc-20160816; b=wlhLdLgo4VZ00AUaktj34KQ/V0j/1eUEGg6OVmh0XzadX+w2Kd4V0nEaqiTb797+3d 0wH6Sw4z5l2tNgnpITcW9dD/3AYl/1UA20xwx5JeQgMV1tz3p4PwtJQZ9FnkRr792hMM rzSQDF5AdWw64QhyuXmJndXcrAtVZT3dB2eOO7sujF6xsq5e6/I3LFYYoGxzlKbec/8K 1kipb5SbgO5UlblGyfnk9teAyin/tcqxsR9Z69c/zS7yJx5lQ+HmagCxNkjPCm5M+jIb fy2Xa+oAQaOADi/nHRbxzmhIhc0lB6a/jyforFEQv3TtNN6oQup8/q7OhomcIEr5GTGx InGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ULiOcDZKihkOBhbiRwYSv6/Li2uCDaTi6jb3hQtUL44=; b=fDSzxh7mUSoecEY6XSw1ILhWfKaKCS9EzpeNmfbzty6PJIQlGk15YBMrdsiENgraQs OGp8hS+i9HUjOpka6L0cPl3uqmAWwpDgCcSozyOPs25KA8sEIHtympF85NrA9Jp6Y6Vj rYl4ygg8RvUsKSF7yngOohX1HEBbJgbYL7eES3GtVZ3Fsq4UUhJXdFkI8FAMtAvsI0ZS 7N/Vv2lViQMCEBpSmJXAFKTwpEVn6AwOiuXQTlNcfN8vFKpfbitxUB3hj9bhFLSwxsaD cO/y0eCgZAReH5JgOHvxcY/zTNjzTXTeenK7sR9V8JyHfrKRNZLZij7scNeILz6ODXDv W6HQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cf7si17203890plb.435.2019.06.19.19.26.28; Wed, 19 Jun 2019 19:26:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731474AbfFTCYi (ORCPT + 99 others); Wed, 19 Jun 2019 22:24:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54304 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726370AbfFTCYi (ORCPT ); Wed, 19 Jun 2019 22:24:38 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0BEE1C05D3E4; Thu, 20 Jun 2019 02:24:38 +0000 (UTC) Received: from xz-x1.redhat.com (ovpn-12-78.pek2.redhat.com [10.72.12.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02BE01001DE7; Thu, 20 Jun 2019 02:24:19 +0000 (UTC) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: David Hildenbrand , Hugh Dickins , Maya Gokhale , Jerome Glisse , Pavel Emelyanov , Johannes Weiner , peterx@redhat.com, Martin Cracauer , Denis Plotnikov , Shaohua Li , Andrea Arcangeli , Mike Kravetz , Marty McFadden , Mike Rapoport , Mel Gorman , "Kirill A . Shutemov" , "Dr . David Alan Gilbert" , Pavel Emelyanov , Rik van Riel Subject: [PATCH v5 20/25] userfaultfd: wp: enabled write protection in userfaultfd API Date: Thu, 20 Jun 2019 10:20:03 +0800 Message-Id: <20190620022008.19172-21-peterx@redhat.com> In-Reply-To: <20190620022008.19172-1-peterx@redhat.com> References: <20190620022008.19172-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 20 Jun 2019 02:24:38 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Shaohua Li Now it's safe to enable write protection in userfaultfd API Cc: Andrea Arcangeli Cc: Pavel Emelyanov Cc: Rik van Riel Cc: Kirill A. Shutemov Cc: Mel Gorman Cc: Hugh Dickins Cc: Johannes Weiner Signed-off-by: Shaohua Li Signed-off-by: Andrea Arcangeli Reviewed-by: Jerome Glisse Reviewed-by: Mike Rapoport Signed-off-by: Peter Xu --- include/uapi/linux/userfaultfd.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/userfaultfd.h b/include/uapi/linux/userfaultfd.h index 95c4a160e5f8..e7e98bde221f 100644 --- a/include/uapi/linux/userfaultfd.h +++ b/include/uapi/linux/userfaultfd.h @@ -19,7 +19,8 @@ * means the userland is reading). */ #define UFFD_API ((__u64)0xAA) -#define UFFD_API_FEATURES (UFFD_FEATURE_EVENT_FORK | \ +#define UFFD_API_FEATURES (UFFD_FEATURE_PAGEFAULT_FLAG_WP | \ + UFFD_FEATURE_EVENT_FORK | \ UFFD_FEATURE_EVENT_REMAP | \ UFFD_FEATURE_EVENT_REMOVE | \ UFFD_FEATURE_EVENT_UNMAP | \ @@ -34,7 +35,8 @@ #define UFFD_API_RANGE_IOCTLS \ ((__u64)1 << _UFFDIO_WAKE | \ (__u64)1 << _UFFDIO_COPY | \ - (__u64)1 << _UFFDIO_ZEROPAGE) + (__u64)1 << _UFFDIO_ZEROPAGE | \ + (__u64)1 << _UFFDIO_WRITEPROTECT) #define UFFD_API_RANGE_IOCTLS_BASIC \ ((__u64)1 << _UFFDIO_WAKE | \ (__u64)1 << _UFFDIO_COPY) -- 2.21.0