Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1213663 > unrolled thread

[PATCH V2 02/10] kasan: MODULE_VADDR is not available on all archs

Started by"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
First post2015-08-26 10:30 +0200
Last post2015-08-30 14:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH V2 02/10] kasan: MODULE_VADDR is not available on all archs "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> - 2015-08-26 10:30 +0200
    Re: [PATCH V2 02/10] kasan: MODULE_VADDR is not available on all archs Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2015-08-26 19:10 +0200
      Re: [PATCH V2 02/10] kasan: MODULE_VADDR is not available on all archs "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> - 2015-08-30 14:40 +0200

#1213663 — [PATCH V2 02/10] kasan: MODULE_VADDR is not available on all archs

From"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Date2015-08-26 10:30 +0200
Subject[PATCH V2 02/10] kasan: MODULE_VADDR is not available on all archs
Message-ID<q1EfN-gF-35@gated-at.bofh.it>
Conditionalize the check using #ifdef

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 mm/kasan/report.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/mm/kasan/report.c b/mm/kasan/report.c
index e07c94fbd0ac..71ce7548d914 100644
--- a/mm/kasan/report.c
+++ b/mm/kasan/report.c
@@ -85,9 +85,14 @@ static void print_error_description(struct kasan_access_info *info)
 
 static inline bool kernel_or_module_addr(const void *addr)
 {
-	return (addr >= (void *)_stext && addr < (void *)_end)
-		|| (addr >= (void *)MODULES_VADDR
-			&& addr < (void *)MODULES_END);
+	if (addr >= (void *)_stext && addr < (void *)_end)
+		return true;
+#if defined(CONFIG_MODULES) && defined(MODULES_VADDR)
+	if (addr >= (void *)MODULES_VADDR
+			&& addr < (void *)MODULES_END)
+		return true;
+#endif
+	return false;
 }
 
 static inline bool init_task_stack_addr(const void *addr)
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1214051

FromAndrey Ryabinin <ryabinin.a.a@gmail.com>
Date2015-08-26 19:10 +0200
Message-ID<q1Mn1-3z4-33@gated-at.bofh.it>
In reply to#1213663
2015-08-26 11:26 GMT+03:00 Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>:
> Conditionalize the check using #ifdef
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>  mm/kasan/report.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/mm/kasan/report.c b/mm/kasan/report.c
> index e07c94fbd0ac..71ce7548d914 100644
> --- a/mm/kasan/report.c
> +++ b/mm/kasan/report.c
> @@ -85,9 +85,14 @@ static void print_error_description(struct kasan_access_info *info)
>
>  static inline bool kernel_or_module_addr(const void *addr)
>  {
> -       return (addr >= (void *)_stext && addr < (void *)_end)
> -               || (addr >= (void *)MODULES_VADDR
> -                       && addr < (void *)MODULES_END);
> +       if (addr >= (void *)_stext && addr < (void *)_end)
> +               return true;
> +#if defined(CONFIG_MODULES) && defined(MODULES_VADDR)
> +       if (addr >= (void *)MODULES_VADDR
> +                       && addr < (void *)MODULES_END)
> +               return true;
> +#endif

I don't think that this is correct change.
On ppc64 modules are in VMALLOC, so you should check for this.
Yes, we don't handle VMALLOC now, but we will at some point.

So I think we should use is_module_address() here.
It will be slower, but we don't care about performance in error reporting route.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1215915

From"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Date2015-08-30 14:40 +0200
Message-ID<q3a3U-EP-15@gated-at.bofh.it>
In reply to#1214051
Andrey Ryabinin <ryabinin.a.a@gmail.com> writes:

> 2015-08-26 11:26 GMT+03:00 Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>:
>> Conditionalize the check using #ifdef
>>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>> ---
>>  mm/kasan/report.c | 11 ++++++++---
>>  1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/mm/kasan/report.c b/mm/kasan/report.c
>> index e07c94fbd0ac..71ce7548d914 100644
>> --- a/mm/kasan/report.c
>> +++ b/mm/kasan/report.c
>> @@ -85,9 +85,14 @@ static void print_error_description(struct kasan_access_info *info)
>>
>>  static inline bool kernel_or_module_addr(const void *addr)
>>  {
>> -       return (addr >= (void *)_stext && addr < (void *)_end)
>> -               || (addr >= (void *)MODULES_VADDR
>> -                       && addr < (void *)MODULES_END);
>> +       if (addr >= (void *)_stext && addr < (void *)_end)
>> +               return true;
>> +#if defined(CONFIG_MODULES) && defined(MODULES_VADDR)
>> +       if (addr >= (void *)MODULES_VADDR
>> +                       && addr < (void *)MODULES_END)
>> +               return true;
>> +#endif
>
> I don't think that this is correct change.
> On ppc64 modules are in VMALLOC, so you should check for this.
> Yes, we don't handle VMALLOC now, but we will at some point.
>
> So I think we should use is_module_address() here.
> It will be slower, but we don't care about performance in error reporting route.

Will fix in the next update.

-aneesh

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web