Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2971933rdg; Mon, 16 Oct 2023 23:51:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFQ1xrlhPfSgHer8N/Mvu0OWExFrpj9l0UOMaTpMVLtaAQTLXv0WMTY5REuOmDmbNyM+bvO X-Received: by 2002:a05:6a20:1442:b0:161:76a4:4f74 with SMTP id a2-20020a056a20144200b0016176a44f74mr1280865pzi.1.1697525500606; Mon, 16 Oct 2023 23:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697525500; cv=none; d=google.com; s=arc-20160816; b=J3rSOyRFjLbPp9+WB50tjGvk/A5OUt0vAd/6QRQXD9M1xeRGYsWIYIprg9jYrtukuu f1WvtZ4x1W9R3KMlFAkgt46RGkBPQtQ3VAT1C0GQmdIN9zNmxgpGjE+PXZUIdcJEWq5I Xf85Kxb8Tt2Yrbmj9Mnb30izMMqFR8rLkbdLT8L771V8P6FgyQqamzIAKk6rnKVPN50g IxZxKUl9PidqPCvn8wNSAnUdS9Db5jBu/A8tixfXQWX4UVwHbZ6DKvwY6piIF+8vsMDb ZGYFzpPJ0lg0j0M0//WIuRZ2R8k4Zvmaf7rKtEqKj1dDnacS64Dh96c0J9UoEZL44W0J f9cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=oHCjcIwAgD8r2ZfWSRWE2jRRIUmP7obRVpW9zzIvXZY=; fh=L40QYU8y58kCp3pF6s90/edDKnMm9r84A5wbdKiAwYg=; b=nBvlXxEVW1I3IhlCtOqL5dXmy+yDvnCa+BTzHLw+NjTWVG0lP8V8PMaHxFMB9SpAqn fmfJNJdglj9CfY1XuM6j9rkU6D5Dc45ZP22Gbbtsc13aGW+rgaQXIo8OwFJPzMa7vWde +/D8rs8MiSyslCD/e0QoHitTjy19fcImcmhEVKJv8dtttd9hfUoCyZv2aNYdtMJiKXxZ wlR+rgWVJAG1c5qW2yPVjiBJ2/ldtKDYmrkIKn8D/cCI9i6pcRUwmJUMK/e+awv3UvM2 hHFwQaHfi5++aJdpC5iW0AmBRhCf3b6SL4l1y+fuUNn2PG9ehsEz3w93gzkMQgkc9Qob 9/gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="LFjN/upg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id w71-20020a63824a000000b0056603994af8si1052176pgd.666.2023.10.16.23.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 23:51:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="LFjN/upg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 9098E8042C11; Mon, 16 Oct 2023 23:51:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234403AbjJQGve (ORCPT + 99 others); Tue, 17 Oct 2023 02:51:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234486AbjJQGvc (ORCPT ); Tue, 17 Oct 2023 02:51:32 -0400 Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AD32B6 for ; Mon, 16 Oct 2023 23:51:30 -0700 (PDT) Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-419b53acc11so162611cf.0 for ; Mon, 16 Oct 2023 23:51:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1697525489; x=1698130289; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=oHCjcIwAgD8r2ZfWSRWE2jRRIUmP7obRVpW9zzIvXZY=; b=LFjN/upgI4MMKEjVksgSFfYLl4hiuJAmzv7UAJJhTpD8bMjNFxX83y8A39/wySXMU0 j2Fm/iw6EHqdpjS4czvzmVThq/PLULAPmRr8b6FZW1b6bXkQE4u0F6SUsgvCvd24GVhX uJ30oL9MoRY+ztlf3iJrv+tPhM+2g/5AHvI+Jhl5+u78pqEFU8FDunRbvFItETWQ/Si2 fufeBOfkDb51pLYE4URsib0FTYhYw7NXU+59TQovysbuLx4ceoDKoIGowtlSNXFNjcyg mSRoeI21PDxx25DGeZ46DdEEoA/PGKmqgEN3zN02LQui/ri+yn4qkL0E+0f73VU0BLnP yuGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697525489; x=1698130289; h=content-transfer-encoding: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=oHCjcIwAgD8r2ZfWSRWE2jRRIUmP7obRVpW9zzIvXZY=; b=l2/PYuI5G2Z93/9UalByJQcDdlboG3XECDwVKL+2vYTAgkmp1eB/3eu0h7FA3SoJ8w Dme+vaKq8r4pvuncljqHjgS4hUPvj+WwsM7ShGnW2pit6A2BV4xXl4Kro+eUwhJQv8vR OJAjLrGe9Q+124IYWLFa3m0mgcL/0C9UOcDlIpuhimzDATb59OBJ/R8AAX9yCNbjz1ky JE7oRt8d7c0AK7n8RL9uVrzT8oZ44iShjb4S4C3fKEK2CXjnf7pyK7UiGa0FqkMiwPpX JaKg7OEiSiGe+gz5ej16X8q6Q8jlJSvbPeoGYKIsbfiM0hPD9Cn8T1IVr9SsaO+vITA2 AbFw== X-Gm-Message-State: AOJu0YyLj5RrTjNOu66fuQOAw5WVUsT2ElMvjsOANhjHYTcWgYQf4dpT ebf4nN6jzrmhMWRHoI5DYFTI9eWgI+yh+AxM4fyiqElectRlsAJybu/9OQ== X-Received: by 2002:a05:622a:8119:b0:417:cd34:2a7b with SMTP id jx25-20020a05622a811900b00417cd342a7bmr111897qtb.3.1697525489453; Mon, 16 Oct 2023 23:51:29 -0700 (PDT) MIME-Version: 1.0 References: <20231016143828.647848-1-jeffxu@chromium.org> <20231016143828.647848-2-jeffxu@chromium.org> <2023101614-scarce-discount-d7ff@gregkh> In-Reply-To: <2023101614-scarce-discount-d7ff@gregkh> From: Jeff Xu Date: Mon, 16 Oct 2023 23:50:00 -0700 Message-ID: Subject: Re: [RFC PATCH v1 1/8] Add mseal syscall To: Greg KH Cc: jeffxu@chromium.org, akpm@linux-foundation.org, keescook@chromium.org, sroettger@google.com, jorgelo@chromium.org, groeck@chromium.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, jannh@google.com, surenb@google.com, alex.sierra@amd.com, apopple@nvidia.com, aneesh.kumar@linux.ibm.com, axelrasmussen@google.com, ben@decadent.org.uk, catalin.marinas@arm.com, david@redhat.com, dwmw@amazon.co.uk, ying.huang@intel.com, hughd@google.com, joey.gouly@arm.com, corbet@lwn.net, wangkefeng.wang@huawei.com, Liam.Howlett@oracle.com, torvalds@linux-foundation.org, lstoakes@gmail.com, willy@infradead.org, mawupeng1@huawei.com, linmiaohe@huawei.com, namit@vmware.com, peterx@redhat.com, peterz@infradead.org, ryan.roberts@arm.com, shr@devkernel.io, vbabka@suse.cz, xiujianfeng@huawei.com, yu.ma@intel.com, zhangpeng362@huawei.com, dave.hansen@intel.com, luto@kernel.org, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 16 Oct 2023 23:51:38 -0700 (PDT) On Mon, Oct 16, 2023 at 8:07=E2=80=AFAM Greg KH wrote: > > On Mon, Oct 16, 2023 at 02:38:20PM +0000, jeffxu@chromium.org wrote: > > +#ifdef CONFIG_MSEAL > > + /* > > + * bit masks for seal. > > + * need this since vm_flags is full. > > + */ > > + unsigned long vm_seals; /* seal flags, see mm.h. */ > > "unsigned long" and yet: > > > diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h > > index c0cb22cd607d..f574c7dbee76 100644 > > --- a/include/linux/syscalls.h > > +++ b/include/linux/syscalls.h > > @@ -802,6 +802,8 @@ asmlinkage long sys_process_mrelease(int pidfd, uns= igned int flags); > > asmlinkage long sys_remap_file_pages(unsigned long start, unsigned lon= g size, > > unsigned long prot, unsigned long pgoff, > > unsigned long flags); > > +asmlinkage long sys_mseal(unsigned long start, size_t len, unsigned in= t types, > > + unsigned int flags); > > "unsigned int"? > > Why the mis-match? > Thanks. Fixed in V2. > > --- a/include/uapi/linux/mman.h > > +++ b/include/uapi/linux/mman.h > > @@ -55,4 +55,10 @@ struct cachestat { > > __u64 nr_recently_evicted; > > }; > > > > +#define MM_SEAL_MSEAL 0x1 > > +#define MM_SEAL_MPROTECT 0x2 > > +#define MM_SEAL_MUNMAP 0x4 > > +#define MM_SEAL_MMAP 0x8 > > +#define MM_SEAL_MREMAP 0x10 > > I think we can use the BIT() macro in uapi .h files now, it is _BITUL(). > Might want to use it here too to make it obvious what is happening. > Sure. Will update in V2. > thanks, > > greg k-h