From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933165AbbDQQLT (ORCPT ); Fri, 17 Apr 2015 12:11:19 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:13140 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933040AbbDQQLO (ORCPT ); Fri, 17 Apr 2015 12:11:14 -0400 X-AuditID: cbfec7f5-f794b6d000001495-0e-553130a4c479 From: Andrey Ryabinin To: linux-kernel@vger.kernel.org Cc: Joe Perches , Sasha Levin , Steven Rostedt , Jonathan Corbet , linux-doc@vger.kernel.org, Andrew Morton , Andrey Ryabinin Subject: [PATCH v2] kasan: Show gcc version requirements in Kconfig and Documentation Date: Fri, 17 Apr 2015 19:10:57 +0300 Message-id: <1429287057-31164-1-git-send-email-a.ryabinin@samsung.com> X-Mailer: git-send-email 2.3.5 In-reply-to: <1429263462.2850.87.camel@perches.com> References: <1429263462.2850.87.camel@perches.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrELMWRmVeSWpSXmKPExsVy+t/xK7pLDAxDDboPi1ps+/WIzWLO+jVs Fk8OtDNazL7/mMViYdsSFovLu+awWezreMBksfjIbWYHDo+WfbfYPU7M+M3isbhvMqvHx6e3 WDy+rLrG7NG3ZRWjx+dNcgHsUVw2Kak5mWWpRfp2CVwZk18sYCvoEq84vuocUwPjJaEuRk4O CQETicenZjFC2GISF+6tZ+ti5OIQEljKKPGk+Qk7hNPEJNH5ZTEbSBWbgJ7Ev1nbwWwRAQWJ zb3PWEGKmAVamSR2LWhiBkkIC4RLTL+/jAnEZhFQldj5cBLQJA4OXgE3iZ5lORDb5CSufr0M FuYUMJaYt90GJCwkYCSx5Hc/4wRG3gWMDKsYRVNLkwuKk9JzjfSKE3OLS/PS9ZLzczcxQkLu 6w7GpcesDjEKcDAq8fBuCDQIFWJNLCuuzD3EKMHBrCTCy7ENKMSbklhZlVqUH19UmpNafIhR moNFSZx35q73IUIC6YklqdmpqQWpRTBZJg5OqQbGeUvPu9zUjdNb8znk5ROXbZO8l9xuy5Bu 8FOKzC3R6O+YvPn1SS/Jn9f40o7rpx61+NkskBGkrnPSUOvxq6cNh/j/nvU6/+LI445XZdVR P89qtW7fpvJM4MFyy8rApD2vRfbe+PRH4RBTlN/U3tW1kUtenoiYrGio/Sy6+FPPet2MfZrJ J41blFiKMxINtZiLihMBJTBjLjUCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joe Perches The documentation shows a need for gcc > 4.9.2, but it's really >=. The Kconfig entries don't show require versions so add them. Correct a latter/later typo too. Also mention that gcc 5 required to catch out of bounds accesses to global and stack variables. Signed-off-by: Joe Perches Signed-off-by: Andrey Ryabinin --- Documentation/kasan.txt | 8 +++++--- lib/Kconfig.kasan | 8 ++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Documentation/kasan.txt b/Documentation/kasan.txt index 092fc10..4692241 100644 --- a/Documentation/kasan.txt +++ b/Documentation/kasan.txt @@ -9,7 +9,9 @@ a fast and comprehensive solution for finding use-after-free and out-of-bounds bugs. KASan uses compile-time instrumentation for checking every memory access, -therefore you will need a certain version of GCC > 4.9.2 +therefore you will need a gcc version of 4.9.2 or later. KASan could detect out +of bounds accesses to stack or global variables, but only if gcc 5.0 or later was +used to built the kernel. Currently KASan is supported only for x86_64 architecture and requires that the kernel be built with the SLUB allocator. @@ -23,8 +25,8 @@ To enable KASAN configure kernel with: and choose between CONFIG_KASAN_OUTLINE and CONFIG_KASAN_INLINE. Outline/inline is compiler instrumentation types. The former produces smaller binary the -latter is 1.1 - 2 times faster. Inline instrumentation requires GCC 5.0 or -latter. +latter is 1.1 - 2 times faster. Inline instrumentation requires a gcc version +of 5.0 or later. Currently KASAN works only with the SLUB memory allocator. For better bug detection and nicer report, enable CONFIG_STACKTRACE and put diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan index 4fecaedc..777eda7 100644 --- a/lib/Kconfig.kasan +++ b/lib/Kconfig.kasan @@ -10,8 +10,11 @@ config KASAN help Enables kernel address sanitizer - runtime memory debugger, designed to find out-of-bounds accesses and use-after-free bugs. - This is strictly debugging feature. It consumes about 1/8 - of available memory and brings about ~x3 performance slowdown. + This is strictly a debugging feature and it requires a gcc version + of 4.9.2 or later. Detection of out of bounds accesses to stack or + global variables requires gcc 5.0 or later. + This feature consumes about 1/8 of available memory and brings about + ~x3 performance slowdown. For better error detection enable CONFIG_STACKTRACE, and add slub_debug=U to boot cmdline. @@ -40,6 +43,7 @@ config KASAN_INLINE memory accesses. This is faster than outline (in some workloads it gives about x2 boost over outline instrumentation), but make kernel's .text size much bigger. + This requires a gcc version of 5.0 or later. endchoice -- 2.3.5