Re: [PATCH v2 6/7] sections: Add new is_kernel() and is_kernel_text()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 28 Jul 2021 16:13:19 +0800
Kefeng Wang <wangkefeng.wang@xxxxxxxxxx> wrote:

> @@ -64,8 +64,7 @@ const struct exception_table_entry *search_exception_tables(unsigned long addr)
>  
>  int notrace core_kernel_text(unsigned long addr)
>  {
> -	if (addr >= (unsigned long)_stext &&
> -	    addr < (unsigned long)_etext)
> +	if (is_kernel_text(addr))

Perhaps this was a bug, and these functions should be checking the gate
area as well, as that is part of kernel text.

-- Steve


>  		return 1;
>  
>  	if (system_state < SYSTEM_RUNNING &&
> diff --git a/mm/kasan/report.c b/mm/kasan/report.c
> index 884a950c7026..88f5b0c058b7 100644
> --- a/mm/kasan/report.c
> +++ b/mm/kasan/report.c
> @@ -235,7 +235,7 @@ static void describe_object(struct kmem_cache *cache, void *object,
>  
>  static inline bool kernel_or_module_addr(const void *addr)
>  {
> -	if (addr >= (void *)_stext && addr < (void *)_end)
> +	if (is_kernel((unsigned long)addr))
>  		return true;
>  	if (is_module_address((unsigned long)addr))
>  		return true;
> -- 



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux