[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210626073439.150586-3-wangkefeng.wang@huawei.com>
Date: Sat, 26 Jun 2021 15:34:32 +0800
From: Kefeng Wang <wangkefeng.wang@...wei.com>
To: Arnd Bergmann <arnd@...db.de>, <linux-arch@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
CC: Kefeng Wang <wangkefeng.wang@...wei.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Petr Mladek <pmladek@...e.com>
Subject: [PATCH 2/9] kallsyms: Fix address-checks for kernel related range
The is_kernel_inittext/is_kernel_text/is_kernel function should not
include the end address(the labels _einittext, _etext and _end) when
check the address range.
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Cc: Petr Mladek <pmladek@...e.com>
Fixes: 04b8eb7a4ccd ("symbol lookup: introduce dereference_symbol_descriptor()")
Signed-off-by: Kefeng Wang <wangkefeng.wang@...wei.com>
---
include/linux/kallsyms.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index d773732cc8eb..c44c26977805 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -26,21 +26,21 @@ struct module;
static inline int is_kernel_inittext(unsigned long addr)
{
if (addr >= (unsigned long)_sinittext
- && addr <= (unsigned long)_einittext)
+ && addr < (unsigned long)_einittext)
return 1;
return 0;
}
static inline int is_kernel_text(unsigned long addr)
{
- if ((addr >= (unsigned long)_stext && addr <= (unsigned long)_etext))
+ if ((addr >= (unsigned long)_stext && addr < (unsigned long)_etext))
return 1;
return in_gate_area_no_mm(addr);
}
static inline int is_kernel(unsigned long addr)
{
- if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end)
+ if (addr >= (unsigned long)_stext && addr < (unsigned long)_end)
return 1;
return in_gate_area_no_mm(addr);
}
--
2.26.2
Powered by blists - more mailing lists