From patchwork Mon Nov 15 13:48:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 12692578 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6CD4C433F5 for ; Mon, 15 Nov 2021 13:38:40 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 72D8360EB9 for ; Mon, 15 Nov 2021 13:38:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 72D8360EB9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=xJKRCaw6zRuyMxsglaDgEqUj0ZYbaCQ973rp4fJgtAc=; b=2n/pnJsfYCMhA6 oNgz/GNFqtMb71GzU89vyyuNucFhPeJTCxPhaj+oleq/cvfx7YowMescYvI6YkJZJhkVFgQHhYLQ0 tS1HVV70ixDy6o02OP0rPpaAdALHjm0BYDAXVK26kT9i34waiE5sDwzcJm1/yvRzgEG5ADCdV0UND TPR9YpfLhAG5NdOSxMtyzj3D9Qb5mXJUUBC5W/ItvMP0m/n0bacHylMO+40l6P+UhK1ZqNDp6SAyS ppxcJzDJjrL9vaBcxgnx2Glvf1qeDad2T+TaoPmNdCfOC+5owNL5vPm4mBB7OEnHSTee3qimsgR3C ggfc4RByOB3MBNiw72+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmcAy-00FghB-4W; Mon, 15 Nov 2021 13:37:36 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmcAj-00Fgdg-8Q for linux-arm-kernel@lists.infradead.org; Mon, 15 Nov 2021 13:37:23 +0000 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Ht9Cz2HdRzZd2w; Mon, 15 Nov 2021 21:34:55 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 15 Nov 2021 21:37:16 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 15 Nov 2021 21:37:15 +0800 From: Kefeng Wang To: , , CC: , , , Kefeng Wang Subject: [PATCH Resend v2 0/3] ARM: Support KFENCE feature Date: Mon, 15 Nov 2021 21:48:45 +0800 Message-ID: <20211115134848.171098-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211115_053721_540629_A1E76E8D X-CRM114-Status: UNSURE ( 9.65 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This patchset supports Kfence feature, tested the kfence_test on ARM QEMU with or without ARM_LPAE and all passed. V2 Resend: - adjust is_write_fault() position in patch2 not patch3, sugguested Alexander - Add ACKed from Marco - rebased on v5.16-rc1 V2: - drop patch4 in v1, which is used a new way to skip kfence test see commit c40c6e593bf9 ("kfence: test: fail fast if disabled at boot") - fix some issue about NO MMU - drop useless set_memory_valid() under no mmu - fix implicit declaration of function ‘is_write_fault’ if no mmu - make KFENCE depends on !XIP_KERNEL, no tested with xip v1: https://lore.kernel.org/linux-arm-kernel/20210825092116.149975-1-wangkefeng.wang@huawei.com/ Kefeng Wang (3): ARM: mm: Provide set_memory_valid() ARM: mm: Provide is_write_fault() ARM: Support KFENCE for ARM arch/arm/Kconfig | 1 + arch/arm/include/asm/kfence.h | 53 +++++++++++++++++++++++++++++++ arch/arm/include/asm/set_memory.h | 1 + arch/arm/mm/fault.c | 16 ++++++++-- arch/arm/mm/pageattr.c | 42 ++++++++++++++++++------ 5 files changed, 100 insertions(+), 13 deletions(-) create mode 100644 arch/arm/include/asm/kfence.h