From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751629AbdGZMOw (ORCPT ); Wed, 26 Jul 2017 08:14:52 -0400 Received: from terminus.zytor.com ([65.50.211.136]:49405 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751451AbdGZMOv (ORCPT ); Wed, 26 Jul 2017 08:14:51 -0400 Date: Wed, 26 Jul 2017 05:10:11 -0700 From: tip-bot for Dmitry Vyukov Message-ID: Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org, torvalds@linux-foundation.org, akpm@linux-foundation.org, aryabinin@virtuozzo.com, mark.rutland@arm.com, dvyukov@google.com, peterz@infradead.org Reply-To: linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@kernel.org, hpa@zytor.com, mark.rutland@arm.com, aryabinin@virtuozzo.com, peterz@infradead.org, dvyukov@google.com, torvalds@linux-foundation.org, akpm@linux-foundation.org In-Reply-To: <33e5ec275c1ee89299245b2ebbccd63709c6021f.1498140838.git.dvyukov@google.com> References: <33e5ec275c1ee89299245b2ebbccd63709c6021f.1498140838.git.dvyukov@google.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/core] kasan: Allow kasan_check_read/write() to accept pointers to volatiles Git-Commit-ID: f06e8c584fa0d05312c11ea66194f3d2efb93c21 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: f06e8c584fa0d05312c11ea66194f3d2efb93c21 Gitweb: http://git.kernel.org/tip/f06e8c584fa0d05312c11ea66194f3d2efb93c21 Author: Dmitry Vyukov AuthorDate: Thu, 22 Jun 2017 16:14:17 +0200 Committer: Ingo Molnar CommitDate: Wed, 26 Jul 2017 13:08:54 +0200 kasan: Allow kasan_check_read/write() to accept pointers to volatiles Currently kasan_check_read/write() accept 'const void*', make them accept 'const volatile void*'. This is required for instrumentation of atomic operations and there is just no reason to not allow that. Signed-off-by: Dmitry Vyukov Reviewed-by: Andrey Ryabinin Acked-by: Mark Rutland Cc: Andrew Morton Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: kasan-dev@googlegroups.com Cc: linux-mm@kvack.org Cc: will.deacon@arm.com Link: http://lkml.kernel.org/r/33e5ec275c1ee89299245b2ebbccd63709c6021f.1498140838.git.dvyukov@google.com Signed-off-by: Ingo Molnar --- include/linux/kasan-checks.h | 10 ++++++---- mm/kasan/kasan.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/linux/kasan-checks.h b/include/linux/kasan-checks.h index b7f8ace..41960fe 100644 --- a/include/linux/kasan-checks.h +++ b/include/linux/kasan-checks.h @@ -2,11 +2,13 @@ #define _LINUX_KASAN_CHECKS_H #ifdef CONFIG_KASAN -void kasan_check_read(const void *p, unsigned int size); -void kasan_check_write(const void *p, unsigned int size); +void kasan_check_read(const volatile void *p, unsigned int size); +void kasan_check_write(const volatile void *p, unsigned int size); #else -static inline void kasan_check_read(const void *p, unsigned int size) { } -static inline void kasan_check_write(const void *p, unsigned int size) { } +static inline void kasan_check_read(const volatile void *p, unsigned int size) +{ } +static inline void kasan_check_write(const volatile void *p, unsigned int size) +{ } #endif #endif diff --git a/mm/kasan/kasan.c b/mm/kasan/kasan.c index ca11bc4..6f319fb 100644 --- a/mm/kasan/kasan.c +++ b/mm/kasan/kasan.c @@ -267,13 +267,13 @@ static void check_memory_region(unsigned long addr, check_memory_region_inline(addr, size, write, ret_ip); } -void kasan_check_read(const void *p, unsigned int size) +void kasan_check_read(const volatile void *p, unsigned int size) { check_memory_region((unsigned long)p, size, false, _RET_IP_); } EXPORT_SYMBOL(kasan_check_read); -void kasan_check_write(const void *p, unsigned int size) +void kasan_check_write(const volatile void *p, unsigned int size) { check_memory_region((unsigned long)p, size, true, _RET_IP_); }