Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp570264rdd; Tue, 9 Jan 2024 12:37:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHeeam93uh6G4DUF+xp5Pda7XLa1q/M4rIbAyUT0pTnYcgAkUqrneKZH0aezqJRdnPCssyA X-Received: by 2002:a05:6a20:2586:b0:199:d02a:9565 with SMTP id k6-20020a056a20258600b00199d02a9565mr108019pzd.19.1704832626333; Tue, 09 Jan 2024 12:37:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704832626; cv=none; d=google.com; s=arc-20160816; b=hV3lRcHzbKeq87u3vZ6gVNssx2uQtiAqtdqiKA+TSlAj/gbEtFhu90tmDM0dC1NSq5 Z7LznEFUdYPtVAaLkZtutpDGRBpUD4Yckhv6GriWeZ3Xyh45xIYQAUAyuNC+L+gx3lQO 882L4pNfDUaeYvI51eZ4zo/nx2g5hB1S3Y3dNRNVW8JkqBcvccQYcgW/zs/b3oxwVnJZ M+sZr7vRF6bveRqYrQ+uPt3oFly4myBbls3SXYrklhjSqrxx2a3WlJaB5ydhiH6NmZCa V+AOqG8QS3jL8ZIktLE1ijxC1TY7rvRdBVu3fo//3pzkdmlARjDr7S11CXx97PytG+Dt 23Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=b2HomVXY7FzMXkiwOxrMKlwOQEHDYNZAL5sKCtuBtfk=; fh=3sbwPm8k1ix+KhzkK0Bn84hvtQ2WcJRqNAhmO39dOPA=; b=FBs2fhKqTB1dqeg+NXvi+ZJtsPUBUcngPW1Ak3tc2Z3ogG8iUybn0tOLNwNUPiK9I7 JKXzbPqdX/fv6Lgh37gESrqgvy3fLikiuw/r0yX7XA70xbU3qIt5g2E4tz624N5c0+0k 57KcN9h4ynUoZhwgZ88HjKtzLEmi3AXiEMBXYAERlAYRl2w7eStb8P2766ynDGPKhhug kjbEU734O8ZA7DZeStOhxDinae2QxzOuQF6D4MdVBvl8ExZ46t0CR0T2xaoG9nwM6LyI m6Z6JxsQpANCKLC/EJO+KbbHfIQbLfeNoG5STBZ1AcLd10ptqjLDWs4lf0fmvJkHOFkP wHFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Ceez6eWN; spf=pass (google.com: domain of linux-kernel+bounces-21394-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21394-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h17-20020aa79f51000000b006d9bf644e53si2010376pfr.353.2024.01.09.12.37.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 12:37:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21394-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=@infradead.org header.s=casper.20170209 header.b=Ceez6eWN; spf=pass (google.com: domain of linux-kernel+bounces-21394-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21394-linux.lists.archive=gmail.com@vger.kernel.org" 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 5A77F286BC8 for ; Tue, 9 Jan 2024 20:37:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D52D3D983; Tue, 9 Jan 2024 20:37:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Ceez6eWN" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 E90CA3A8E3; Tue, 9 Jan 2024 20:36:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=b2HomVXY7FzMXkiwOxrMKlwOQEHDYNZAL5sKCtuBtfk=; b=Ceez6eWNOAP75GYM7O6sxoxLMK sEyjYspnASHzv4goTZkwM3Azj9T0S7OArOGxOU0BOxqwe41T54sximqesBg7tYZ2EljvmUQbzuqfs HtwprQ1pepzRo3YWq4OU0ZII2MeOfSxGvO9mWRXg+B1f4bGSCsXK93nokeodRy1CNMbURutmgvIXr 0KZ+RyDs4RA8S5DouFLHfXW22t6qXMqJWoS2/KlDbl+InFqT8xmW7WSXCHnEoq+Zz7ODVYHdpWcbX 4+8Ux7WmXEdCstEG7wBE3mnDIhmtbpiK7ct9wzwe/d/z5PliZNsv5D0yOj0TOzGJyppNW3vNYrnVF herDEtbw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rNIq7-00AIGa-4i; Tue, 09 Jan 2024 20:36:47 +0000 Date: Tue, 9 Jan 2024 20:36:47 +0000 From: Matthew Wilcox To: jeffxu@chromium.org Cc: akpm@linux-foundation.org, keescook@chromium.org, jannh@google.com, sroettger@google.com, gregkh@linuxfoundation.org, torvalds@linux-foundation.org, usama.anjum@collabora.com, jeffxu@google.com, jorgelo@chromium.org, groeck@chromium.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, pedro.falcato@gmail.com, dave.hansen@intel.com, linux-hardening@vger.kernel.org, deraadt@openbsd.org Subject: Re: [RFC PATCH v5 2/4] mseal: add mseal syscall Message-ID: References: <20240109154547.1839886-1-jeffxu@chromium.org> <20240109154547.1839886-3-jeffxu@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240109154547.1839886-3-jeffxu@chromium.org> On Tue, Jan 09, 2024 at 03:45:40PM +0000, jeffxu@chromium.org wrote: > +extern bool can_modify_mm(struct mm_struct *mm, unsigned long start, > + unsigned long end); > +extern bool can_modify_mm_madv(struct mm_struct *mm, unsigned long start, > + unsigned long end, int behavior); unnecessary use of extern. > +static inline unsigned long get_mmap_seals(unsigned long prot, > + unsigned long flags) needs more than one tab indent so it doesn't look like part of the body. > +{ > + unsigned long vm_seals; > + > + if (prot & PROT_SEAL) > + vm_seals = VM_SEALED | VM_SEALABLE; > + else > + vm_seals = (flags & MAP_SEALABLE) ? VM_SEALABLE:0; need spaces around the : > +++ b/include/uapi/asm-generic/mman-common.h > @@ -17,6 +17,11 @@ > #define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */ > #define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */ > > +/* > + * The PROT_SEAL defines memory sealing in the prot argument of mmap(). > + */ > +#define PROT_SEAL _BITUL(26) /* 0x04000000 */ why not follow the existing style? > +static inline void set_vma_sealed(struct vm_area_struct *vma) > +{ > + vma->__vm_flags |= VM_SEALED; > +} uhh ... vm_flags_set() ?