Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp41041pxb; Thu, 30 Sep 2021 00:12:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKJVps2a3vJN3peUDY4Y5P4PxgjBmuLkT51orkv8i2cmwoBbIijBjguAPDlPnYttpd+RQc X-Received: by 2002:a17:906:645:: with SMTP id t5mr4846770ejb.163.1632985925592; Thu, 30 Sep 2021 00:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632985925; cv=none; d=google.com; s=arc-20160816; b=ZdbFkcULpP9dS9r1RyNaV6K8MgEgO0qC9+e62eXZo3kNK3yrw77md7hfUGhgHfVwPB 4IW0Su5rZlyThC5+4tA+sEWC1zMnU7jmOllNIEXmVoSoweS2r4V0s/+pB+NCbG3SvX9i PvryNhxiGA65H3uwoYQzEtbpswq9GqrHEauN4m8u43PDUh/x1XzOg9Ape2WSX57AtWuC wOjs2hd4s6Nuj5gUbXupxaM4YHTGSpm8tPQoVhctCzAnnD3YqLxL6ae7ELKdXKKAYdTG F1zY5JCxD6YBiAuwDvS7S8wsHg4BFQvRBqN+eh6VW5zxmjTKRG0Dl2Y6xsX0DHfE3nt/ /TEg== 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; bh=v5IfhCvnIrwqG/TERcCWiJbVPx3LC/SvAZqDe/ZLOzU=; b=dHXmKC43DuEi49V8wuHs9+moauCLHwgUVXkcZhhpKGwXJl6iMG4nsOm34FTMC8fOfQ LnL70V7KgdU7vn/fWed6f7MpMBJeTx58Edghrc2RZ+iqIN+px1Gg4H4Lp9Z7x1uFm6z8 vKAtj7Y16l3bhmDVZErMQy/2io1zbrbTGp708g/r+k7U0jhn5QIC/BPQ5Ty817Y73r+y KVMpnJZqxCvXPbyLcON1VzfoHwNZ2hQNeVxteX3KmGzizw7SLOTZa6c8Z0x6H7U2Ucv3 I7if+TwJmJW+uP0Ico+f31og6mKTk+jqh7C4gW0bWb2VpZmNQBI1+JGGizv6U/eyzqrW OpBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 7si2436175ejd.0.2021.09.30.00.11.39; Thu, 30 Sep 2021 00:12:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348534AbhI3HLF (ORCPT + 99 others); Thu, 30 Sep 2021 03:11:05 -0400 Received: from szxga08-in.huawei.com ([45.249.212.255]:24158 "EHLO szxga08-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348516AbhI3HK5 (ORCPT ); Thu, 30 Sep 2021 03:10:57 -0400 Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4HKkpd19fvz1DHJf; Thu, 30 Sep 2021 15:07:53 +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.8; Thu, 30 Sep 2021 15:09:13 +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.8; Thu, 30 Sep 2021 15:09:12 +0800 From: Kefeng Wang To: , , , , , , , , , CC: , , , , , Christophe Leroy , Kefeng Wang Subject: [PATCH v4 00/11] sections: Unify kernel sections range check and use Date: Thu, 30 Sep 2021 15:11:32 +0800 Message-ID: <20210930071143.63410-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are three head files(kallsyms.h, kernel.h and sections.h) which include the kernel sections range check, let's make some cleanup and unify them. 1. cleanup arch specific text/data check and fix address boundary check in kallsyms.h 2. make all the basic/core kernel range check function into sections.h 3. update all the callers, and use the helper in sections.h to simplify the code After this series, we have 5 APIs about kernel sections range check in sections.h * is_kernel_rodata() --- already in sections.h * is_kernel_core_data() --- come from core_kernel_data() in kernel.h * is_kernel_inittext() --- come from kernel.h and kallsyms.h * __is_kernel_text() --- add new internal helper * __is_kernel() --- add new internal helper Note: For the last two helpers, people should not use directly, consider to use corresponding function in kallsyms.h. v4: - Use core_kernel_text() in powerpc sugguested Christophe Leroy, build test only - Use is_kernel_text() in alpha and microblaze, build test only on next-20210929 v3: https://lore.kernel.org/linux-arch/20210926072048.190336-1-wangkefeng.wang@huawei.com/ - Add Steven's RB to patch2 - Introduce two internal helper, then use is_kernel_text() in core_kernel_text() and is_kernel() in kernel_or_module_addr() suggested by Steven v2: https://lore.kernel.org/linux-arch/20210728081320.20394-1-wangkefeng.wang@huawei.com/ - add ACK/RW to patch2, and drop inappropriate fix tag - keep 'core' to check kernel data, suggestted by Steven Rostedt , rename is_kernel_data() to is_kernel_core_data() - drop patch8 which is merged - drop patch9 which is resend independently v1: https://lore.kernel.org/linux-arch/20210626073439.150586-1-wangkefeng.wang@huawei.com Kefeng Wang (11): kallsyms: Remove arch specific text and data check kallsyms: Fix address-checks for kernel related range sections: Move and rename core_kernel_data() to is_kernel_core_data() sections: Move is_kernel_inittext() into sections.h x86: mm: Rename __is_kernel_text() to is_x86_32_kernel_text() sections: Provide internal __is_kernel() and __is_kernel_text() helper mm: kasan: Use is_kernel() helper extable: Use is_kernel_text() helper powerpc/mm: Use core_kernel_text() helper microblaze: Use is_kernel_text() helper alpha: Use is_kernel_text() helper arch/alpha/kernel/traps.c | 4 +- arch/microblaze/mm/pgtable.c | 3 +- arch/powerpc/mm/pgtable_32.c | 7 +--- arch/x86/kernel/unwind_orc.c | 2 +- arch/x86/mm/init_32.c | 14 +++---- include/asm-generic/sections.h | 75 ++++++++++++++++++++++++++-------- include/linux/kallsyms.h | 13 +----- include/linux/kernel.h | 2 - kernel/extable.c | 33 ++------------- kernel/locking/lockdep.c | 3 -- kernel/trace/ftrace.c | 2 +- mm/kasan/report.c | 2 +- net/sysctl_net.c | 2 +- 13 files changed, 78 insertions(+), 84 deletions(-) -- 2.26.2