From patchwork Thu Jan 19 10:02:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13107648 Return-Path: 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 85F5DC004D4 for ; Thu, 19 Jan 2023 10:02:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 17EFC6B0074; Thu, 19 Jan 2023 05:02:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 130836B0078; Thu, 19 Jan 2023 05:02:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01DAA6B007B; Thu, 19 Jan 2023 05:02:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E96566B0074 for ; Thu, 19 Jan 2023 05:02:41 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B323F140CCD for ; Thu, 19 Jan 2023 10:02:41 +0000 (UTC) X-FDA: 80371109322.06.DB9EC0C Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf04.hostedemail.com (Postfix) with ESMTP id 2444140016 for ; Thu, 19 Jan 2023 10:02:39 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=cHu2DsLK; dmarc=none; spf=none (imf04.hostedemail.com: domain of BATV+d6c99cb0ec1a2cfa7d20+7088+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+d6c99cb0ec1a2cfa7d20+7088+infradead.org+hch@bombadil.srs.infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674122560; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=QK+F13Jz0ZfHS1BGxHd277aqAwbql//Xt13P525IYcU=; b=0RS08BYcMHoVqbSwaWkKnNTtAUDbYGfPxeNu+y0zRuX937V7SiTj49UjjO1YFVgGZmGPfj JbA+vsYkD+SIvaOS5gZfsVbiPyL2SBOX0HGm7bTHB8X+MutqS4s6l+6IAONvAespoImW87 Q5GgONzolsXEBsEvWcJNBsnoe0DFUOg= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=cHu2DsLK; dmarc=none; spf=none (imf04.hostedemail.com: domain of BATV+d6c99cb0ec1a2cfa7d20+7088+infradead.org+hch@bombadil.srs.infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=BATV+d6c99cb0ec1a2cfa7d20+7088+infradead.org+hch@bombadil.srs.infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674122560; a=rsa-sha256; cv=none; b=A369wvBqPE3/xre3uCF76x5fXI5OT/Tlh1Ehu+prnJNAzKkcnEhxlglOrYAxcL3QgiQqtg gLOdI1g0mTKiZUk+01IkP8NvCl/3g09WLwJboVcGQcz+Bo4IPxbVUhQvOpId1yck87zqzJ Ysj3wVLYLGwfQz9NYd7vMF7jexE7WJ4= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=QK+F13Jz0ZfHS1BGxHd277aqAwbql//Xt13P525IYcU=; b=cHu2DsLK5r+czKvoPPihZH+pwk ycSoqlnJlzu1B8RFcXOYfnq7ieAxyQU2ExI58cv4GhBFSpiJHJEdWZsqxxQ/f+z53/+18TGsierra 1aH5jZCvXfXECBs5sN8MImor2InNV1ljGLhfmSQVG1lmjHbfcHfRIRCHMcBkbQEyuMnM4J5AVssoJ WG8D/7Dl4He8nyFzMglwcEPKjSSLpvC+CrrlKlwqz2NaIvdwPDAyyE2GeMnsMkd10nw6vF8kFuzHO y1vhX3eS+2A088niNo1hgb/Cp6wgKes3zH5MdKr7SQlLKOrjI2lWxqz5sBPpkWcU1EZXt+d/ZCWc1 5iWGSljw==; Received: from 089144197172.atnat0006.highway.a1.net ([89.144.197.172] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIRkj-004LWG-6v; Thu, 19 Jan 2023 10:02:38 +0000 From: Christoph Hellwig To: Andrew Morton , Uladzislau Rezki Cc: linux-mm@kvack.org Subject: [PATCH 01/10] vmalloc: reject vmap with VM_FLUSH_RESET_PERMS Date: Thu, 19 Jan 2023 11:02:17 +0100 Message-Id: <20230119100226.789506-2-hch@lst.de> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119100226.789506-1-hch@lst.de> References: <20230119100226.789506-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Rspamd-Queue-Id: 2444140016 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: 3maakfnthzsfu45hjetrrw94ih9q5eo5 X-HE-Tag: 1674122559-791992 X-HE-Meta: U2FsdGVkX19pnyMqCu09AKX4YPCCg9VHM4pHKRdLQZ6TRyenbv5QjPHVow3fC14N0kwtumgZOoHTCpmA/kYUbP5Zbd0uWpv7Gn94wgRBmOzK9SkzxHm2x6I0tyvkyUEFHcfg/cFXU7FGxVJHfg5zeLQ69RqRZ6dMegxqTSeAS33Wi7PDjYX4lxVAW5eijw5T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 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: VM_FLUSH_RESET_PERMS is just for use with vmalloc as it is tied to freeing the underlying pages. Signed-off-by: Christoph Hellwig Reviewed-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 0781c5a8e0e73d..6957d15d526e46 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -2883,6 +2883,9 @@ void *vmap(struct page **pages, unsigned int count, might_sleep(); + if (WARN_ON_ONCE(flags & VM_FLUSH_RESET_PERMS)) + return NULL; + /* * Your top guard is someone else's bottom guard. Not having a top * guard compromises someone else's mappings too.