From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [PATCH v5 13/25] mm: Introduce arch_validate_flags() Date: Wed, 24 Jun 2020 11:37:46 -0700 Message-ID: <20200624113746.589b6af7779f39eee846ea74@linux-foundation.org> References: <20200624175244.25837-1-catalin.marinas@arm.com> <20200624175244.25837-14-catalin.marinas@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from mail.kernel.org ([198.145.29.99]:46288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405914AbgFXShr (ORCPT ); Wed, 24 Jun 2020 14:37:47 -0400 In-Reply-To: <20200624175244.25837-14-catalin.marinas@arm.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Catalin Marinas Cc: linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, Will Deacon , Dave P Martin , Vincenzo Frascino , Szabolcs Nagy , Kevin Brodsky , Andrey Konovalov , Peter Collingbourne On Wed, 24 Jun 2020 18:52:32 +0100 Catalin Marinas wrote: > Similarly to arch_validate_prot() called from do_mprotect_pkey(), an > architecture may need to sanity-check the new vm_flags. > > Define a dummy function always returning true. In addition to > do_mprotect_pkey(), also invoke it from mmap_region() prior to updating > vma->vm_page_prot to allow the architecture code to veto potentially > inconsistent vm_flags. > > ... > > --- a/include/linux/mman.h > +++ b/include/linux/mman.h > @@ -103,6 +103,19 @@ static inline bool arch_validate_prot(unsigned long prot, unsigned long addr) > #define arch_validate_prot arch_validate_prot > #endif > > +#ifndef arch_validate_flags > +/* > + * This is called from mmap() and mprotect() with the updated vma->vm_flags. > + * > + * Returns true if the VM_* flags are valid. > + */ > +static inline bool arch_validate_flags(unsigned long flags) > +{ > + return true; > +} > +#define arch_validate_flags arch_validate_flags > +#endif Again, please let's nail down where the arch should define this. Otherwise, Acked-by: Andrew Morton From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E614CC433E0 for ; Wed, 24 Jun 2020 18:39:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BDFA920767 for ; Wed, 24 Jun 2020 18:39:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vPg80LR2"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="H8wIYR6m" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BDFA920767 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To:Message-Id: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nk2EW8LXgxoG0dDP3sDT15RS9/I0Jq8b6lpJKY0MhpI=; b=vPg80LR2qVRvN0mDSm+4ahNyt UEeiGvs+3w+BFEC+C4UexmLvJIonlthf7Xv0OKzRbCk0A3UH/ZgSYKVbE3tkuNHYq3m1e5gUxReYV 3zQb5W9yv/R4nHk5Fae/PBUybXshmX2gUJQSx6Ys1hrWp+Q/P+i+9iewchwigFcshf4lI0YgHx3pC xj0uDn/kBbFsZBb/4d6Q5bRBIttcahb1FvW8495w2110lohnC86c+ibXLtXdXZw62Fn92ailQ8niY ZB/Tgbi63R+Vz/hdQiFUFlOFiOyUqIF1xjnGrUGZX89vA8fOv89B8xDTKd2UvJrA/NaE1JOMwllET S/kAy/ypw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1joAHO-0007Pd-WD; Wed, 24 Jun 2020 18:37:51 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1joAHL-0007OM-W1 for linux-arm-kernel@lists.infradead.org; Wed, 24 Jun 2020 18:37:48 +0000 Received: from X1 (nat-ab2241.sltdut.senawave.net [162.218.216.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F204C20724; Wed, 24 Jun 2020 18:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593023867; bh=N33U5QaNc/HrhztgGmlLrw0Lcvv3sVffeuhLVRirZ5M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=H8wIYR6mKQWXAtMhWWdVubpavMoyGBwOsJpZO1R4v/xzEueX9mj0ObtigPlPv+kyh vTuKYFXjEZXz+HYP0Vu7VnF0JZnAB9gHZGRLo4S9EEgyCb56fsHuP0vmG3DSiBQBkB kJas+9InzzomFGeVndN82lMzixZN6KP3tYTzsi94= Date: Wed, 24 Jun 2020 11:37:46 -0700 From: Andrew Morton To: Catalin Marinas Subject: Re: [PATCH v5 13/25] mm: Introduce arch_validate_flags() Message-Id: <20200624113746.589b6af7779f39eee846ea74@linux-foundation.org> In-Reply-To: <20200624175244.25837-14-catalin.marinas@arm.com> References: <20200624175244.25837-1-catalin.marinas@arm.com> <20200624175244.25837-14-catalin.marinas@arm.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Szabolcs Nagy , Andrey Konovalov , Kevin Brodsky , Peter Collingbourne , linux-mm@kvack.org, Vincenzo Frascino , Will Deacon , Dave P Martin , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, 24 Jun 2020 18:52:32 +0100 Catalin Marinas wrote: > Similarly to arch_validate_prot() called from do_mprotect_pkey(), an > architecture may need to sanity-check the new vm_flags. > > Define a dummy function always returning true. In addition to > do_mprotect_pkey(), also invoke it from mmap_region() prior to updating > vma->vm_page_prot to allow the architecture code to veto potentially > inconsistent vm_flags. > > ... > > --- a/include/linux/mman.h > +++ b/include/linux/mman.h > @@ -103,6 +103,19 @@ static inline bool arch_validate_prot(unsigned long prot, unsigned long addr) > #define arch_validate_prot arch_validate_prot > #endif > > +#ifndef arch_validate_flags > +/* > + * This is called from mmap() and mprotect() with the updated vma->vm_flags. > + * > + * Returns true if the VM_* flags are valid. > + */ > +static inline bool arch_validate_flags(unsigned long flags) > +{ > + return true; > +} > +#define arch_validate_flags arch_validate_flags > +#endif Again, please let's nail down where the arch should define this. Otherwise, Acked-by: Andrew Morton _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel