Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756582AbbHZI0z (ORCPT ); Wed, 26 Aug 2015 04:26:55 -0400 Received: from e28smtp09.in.ibm.com ([122.248.162.9]:44895 "EHLO e28smtp09.in.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756313AbbHZI0v (ORCPT ); Wed, 26 Aug 2015 04:26:51 -0400 X-Helo: d28dlp02.in.ibm.com X-MailFrom: aneesh.kumar@linux.vnet.ibm.com X-RcptTo: linux-kernel@vger.kernel.org From: "Aneesh Kumar K.V" To: benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au, ryabinin.a.a@gmail.com Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, "Aneesh Kumar K.V" Subject: [PATCH V2 06/10] kasan: Allow arch to overrride kasan shadow offsets Date: Wed, 26 Aug 2015 13:56:14 +0530 Message-Id: <1440577578-15813-7-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1440577578-15813-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> References: <1440577578-15813-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15082608-0033-0000-0000-000007792ADE Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1829 Lines: 56 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 --- 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 #include +#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/