Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1213661 > unrolled thread
| Started by | "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> |
|---|---|
| First post | 2015-08-26 10:30 +0200 |
| Last post | 2015-08-27 11:50 +0200 |
| Articles | 2 — 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.
[PATCH V2 06/10] kasan: Allow arch to overrride kasan shadow offsets "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> - 2015-08-26 10:30 +0200
Re: [PATCH V2 06/10] kasan: Allow arch to overrride kasan shadow offsets Andrey Ryabinin <ryabinin.a.a@gmail.com> - 2015-08-27 11:50 +0200
| From | "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> |
|---|---|
| Date | 2015-08-26 10:30 +0200 |
| Subject | [PATCH V2 06/10] kasan: Allow arch to overrride kasan shadow offsets |
| Message-ID | <q1EfM-gF-17@gated-at.bofh.it> |
Some archs may want to provide kasan shadow memory as a constant
offset from the address. Such arch even though cannot use inline kasan
support, they can work with outofline kasan support.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
include/linux/kasan.h | 3 +++
mm/kasan/kasan.h | 3 +++
2 files changed, 6 insertions(+)
diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index 5486d777b706..e458ca64cdaf 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -15,11 +15,14 @@ struct vm_struct;
#include <asm/kasan.h>
#include <linux/sched.h>
+#ifndef kasan_mem_to_shadow
static inline void *kasan_mem_to_shadow(const void *addr)
{
return (void *)((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT)
+ KASAN_SHADOW_OFFSET;
}
+#define kasan_mem_to_shadow kasan_mem_to_shadow
+#endif
/* Enable reporting bugs after kasan_disable_current() */
static inline void kasan_enable_current(void)
diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
index deb547d5a916..c0686f2b1224 100644
--- a/mm/kasan/kasan.h
+++ b/mm/kasan/kasan.h
@@ -57,11 +57,14 @@ struct kasan_global {
void kasan_report_error(struct kasan_access_info *info);
void kasan_report_user_access(struct kasan_access_info *info);
+#ifndef kasan_shadow_to_mem
static inline const void *kasan_shadow_to_mem(const void *shadow_addr)
{
return (void *)(((unsigned long)shadow_addr - KASAN_SHADOW_OFFSET)
<< KASAN_SHADOW_SCALE_SHIFT);
}
+#define kasan_shadow_to_mem kasan_shadow_to_mem
+#endif
static inline bool kasan_report_enabled(void)
{
--
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]
| From | Andrey Ryabinin <ryabinin.a.a@gmail.com> |
|---|---|
| Date | 2015-08-27 11:50 +0200 |
| Message-ID | <q21YK-Gn-7@gated-at.bofh.it> |
| In reply to | #1213661 |
2015-08-26 11:26 GMT+03:00 Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>:
> Some archs may want to provide kasan shadow memory as a constant
> offset from the address. Such arch even though cannot use inline kasan
> support, they can work with outofline kasan support.
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
> include/linux/kasan.h | 3 +++
> mm/kasan/kasan.h | 3 +++
> 2 files changed, 6 insertions(+)
>
> diff --git a/include/linux/kasan.h b/include/linux/kasan.h
> index 5486d777b706..e458ca64cdaf 100644
> --- a/include/linux/kasan.h
> +++ b/include/linux/kasan.h
> @@ -15,11 +15,14 @@ struct vm_struct;
> #include <asm/kasan.h>
> #include <linux/sched.h>
>
> +#ifndef kasan_mem_to_shadow
> static inline void *kasan_mem_to_shadow(const void *addr)
> {
> return (void *)((unsigned long)addr >> KASAN_SHADOW_SCALE_SHIFT)
> + KASAN_SHADOW_OFFSET;
> }
> +#define kasan_mem_to_shadow kasan_mem_to_shadow
Again, why we need this define here? I think it should be safe to remove it.
> +#endif
>
> /* Enable reporting bugs after kasan_disable_current() */
> static inline void kasan_enable_current(void)
> diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
> index deb547d5a916..c0686f2b1224 100644
> --- a/mm/kasan/kasan.h
> +++ b/mm/kasan/kasan.h
> @@ -57,11 +57,14 @@ struct kasan_global {
> void kasan_report_error(struct kasan_access_info *info);
> void kasan_report_user_access(struct kasan_access_info *info);
>
> +#ifndef kasan_shadow_to_mem
> static inline const void *kasan_shadow_to_mem(const void *shadow_addr)
> {
> return (void *)(((unsigned long)shadow_addr - KASAN_SHADOW_OFFSET)
> << KASAN_SHADOW_SCALE_SHIFT);
> }
> +#define kasan_shadow_to_mem kasan_shadow_to_mem
ditto
> +#endif
>
> static inline bool kasan_report_enabled(void)
> {
> --
> 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] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web