Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5320533rdb; Wed, 13 Dec 2023 05:40:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1tikJ0i4TFG3DmdoyE5Yrre+rh2uzYWwv62qjCK//dQDoeLZ8IzSPM/E1VXMnNkqRQJ9k X-Received: by 2002:a17:90a:8a15:b0:28a:d768:831d with SMTP id w21-20020a17090a8a1500b0028ad768831dmr784904pjn.26.1702474857449; Wed, 13 Dec 2023 05:40:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702474857; cv=none; d=google.com; s=arc-20160816; b=MahXxQPnRTJIjf0slCEcUZNNv4LzFl2EIZuO4/TGHymo6pMUuIiCpBH2kKcv5JyoIE 7NY9Jg1vpBGNFTKZSAxEin4yGiRWuFvaEYeB2gWn+zKFdiamaNPO4paR3eWQQRA4iKeY Eg1n3GUEGclZCRPVqXCMaTald8H7HD4ryR3Gf11ke7L/cONTlI6qK+v+Wo7VW6H055pD khjCNmON47jLau4iyBCVF4x8Yl2B4csA5uud4o0kkiJJ7qwAO+IlcDjm++DLGfSXACHi PE2olkG+YhFrLdaysxuvm4xxOwGBw5Us4px9kVbY6XIPpmonk190Fz0SQiYRVPev7fUd yf3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=AqI6GpSVQ+KOsq7aMEboneAXW3QEiN4V6nA9DvKqtyg=; fh=RgqxsqY9ZqOlmURAWdfBjrEjJW7RWbnj6JWJVJqXgtM=; b=QMqdtIDZOAqorsunl/BOgSpil9ILoWB60l+MVdkoJlRsm9XdetNJb8uCZw1ae+0IYu cJTxOXh6rutNf7M8fzWXX2YcR7VRFx4NmV0WSZJbxKzM+TBE2rP1nKTKrTT1n2b6TkFG 3nuWblDgXvafOpJ0bE/I3euW1ZgjLOoE+Vkg2+aaib34Ea5zkZp/fQ17PhGkoZy0CA+n 7cEZj5ozO7bSNS71vGItyNrLUKTSK5HbppRH0v3lUaAirjpLyah2q/ATMVolkwiJD87e vsxg2hKJCk36auXHIwEQukrEwWvEV/ACGdbRW+N4Yw99d5QigK9H3Dwdx0km01NJagJm b1dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=Qqm7aIQY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id e14-20020a17090a684e00b00286db70cc7csi9494845pjm.70.2023.12.13.05.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 05:40:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=Qqm7aIQY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id EB9F180B8F08; Wed, 13 Dec 2023 05:40:49 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233700AbjLMNkc (ORCPT + 99 others); Wed, 13 Dec 2023 08:40:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233449AbjLMNka (ORCPT ); Wed, 13 Dec 2023 08:40:30 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4362C95 for ; Wed, 13 Dec 2023 05:40:36 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-3333074512bso4265440f8f.1 for ; Wed, 13 Dec 2023 05:40:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1702474835; x=1703079635; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=AqI6GpSVQ+KOsq7aMEboneAXW3QEiN4V6nA9DvKqtyg=; b=Qqm7aIQYkZ5UKTONyYMCb6AA0xtqlk/9n8YEkH+J8B1JjrfiWbFZ3ZPXIT7lgZY/2u roT6y019g6pY0NNqEzP7cc4R+8GuknGideKciMWlbNIObnV2DKT6ZY/OPoRI1fDgt2f4 Dlm9jpnRDBcFb3upHqydwBmGIrrLQEWdq6YHhssNq3CLJ8NnTN7s1b7yWDYKSBnQQi0T muyIVO6KqaD2Mmb3iOETE8EIalVuJeVtEzrue7TksA+dwqVCN1lyA6pXGnUV2vroL4kg RfKvuLNJP3tvoWidVX3rom54MkRc1sjN4UowE8cXFSCR2CW8lvlNKH+sz16hu4YRwfT7 P+kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702474835; x=1703079635; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AqI6GpSVQ+KOsq7aMEboneAXW3QEiN4V6nA9DvKqtyg=; b=mXJp0gyLhkF+3MqKpLjeV10X9iT5mt7xQ5kUpxwNIdnPoZtCtuojzoIpXHYb1YG7io YRaKuEUafXZGNcgLcBBvk44IM+LkNvkZ/57HpHPDZZFK9f9/+pdz9QuDhPhLRradfv+c CDiympTImy31pL29Dbfcs1VkGV6JgWmpxyE+13eGtmJPlHSEBkETr5vaCxRZz+JL+ajD C95PW+iqOpWyjLaB/U+L1RzRGY1ljbeULWqyJ2Q/d1LIfa0mB1oABLLp64vXdwIqWPVR 8+kr1kkJqgLyzXX0LW7loD6Ph6czy7eOgKdeiCauzty4EiFM5G/zqmSuRb45B8DNZgvs pEDw== X-Gm-Message-State: AOJu0YxPVgxSPQXacrGX2QsgP1gycYw0SQyd4lWMRw31EadZzFL1JQvx dMb/Z3OF127PSW5jiy4PNu2bqw== X-Received: by 2002:a05:600c:2a41:b0:40b:5e56:7b67 with SMTP id x1-20020a05600c2a4100b0040b5e567b67mr4163912wme.176.1702474834584; Wed, 13 Dec 2023 05:40:34 -0800 (PST) Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id b16-20020a05600c4e1000b0040c310abc4bsm20892540wmq.43.2023.12.13.05.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 05:40:34 -0800 (PST) From: Alexandre Ghiti To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Vincent Chen , Zong Li , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Alexandre Ghiti Subject: [PATCH -fixes 0/2] Fix WX mappings in the linear mapping after module unloading Date: Wed, 13 Dec 2023 14:40:25 +0100 Message-Id: <20231213134027.155327-1-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Wed, 13 Dec 2023 05:40:50 -0800 (PST) I fell onto a bunch of WX mappings in the linear mapping after a module gets unloaded, this is because our module_alloc() does not set the VM_FLUSH_RESET_PERMS flag (patch 1) and that set_direct_map_default_noflush() must clean the X bit (patch 2). Note that the Fixes tags are correct but patch 2 will fail to apply since a change in this function just landed in 6.7. Alexandre Ghiti (2): riscv: Fix module_alloc() that did not reset the linear mapping permissions riscv: Fix set_direct_map_default_noflush() to reset _PAGE_EXEC arch/riscv/kernel/module.c | 3 ++- arch/riscv/mm/pageattr.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) -- 2.39.2