Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932111AbdCMXEX (ORCPT ); Mon, 13 Mar 2017 19:04:23 -0400 Received: from terminus.zytor.com ([65.50.211.136]:55272 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753459AbdCMXEP (ORCPT ); Mon, 13 Mar 2017 19:04:15 -0400 Date: Mon, 13 Mar 2017 16:03:59 -0700 From: tip-bot for Andrey Ryabinin Message-ID: Cc: linux-kernel@vger.kernel.org, aryabinin@virtuozzo.com, dvyukov@google.com, glider@google.com, hpa@zytor.com, tglx@linutronix.de, mingo@kernel.org, akpm@linux-foundation.org, fengguang.wu@intel.com Reply-To: hpa@zytor.com, tglx@linutronix.de, glider@google.com, dvyukov@google.com, aryabinin@virtuozzo.com, linux-kernel@vger.kernel.org, fengguang.wu@intel.com, akpm@linux-foundation.org, mingo@kernel.org In-Reply-To: <20170313163337.1704-1-aryabinin@virtuozzo.com> References: <20170313163337.1704-1-aryabinin@virtuozzo.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/kasan: Fix boot with KASAN=y and PROFILE_ANNOTATED_BRANCHES=y Git-Commit-ID: be3606ff739d1c1be36389f8737c577ad87e1f57 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 Content-Length: 2105 Lines: 56 Commit-ID: be3606ff739d1c1be36389f8737c577ad87e1f57 Gitweb: http://git.kernel.org/tip/be3606ff739d1c1be36389f8737c577ad87e1f57 Author: Andrey Ryabinin AuthorDate: Mon, 13 Mar 2017 19:33:37 +0300 Committer: Thomas Gleixner CommitDate: Tue, 14 Mar 2017 00:00:55 +0100 x86/kasan: Fix boot with KASAN=y and PROFILE_ANNOTATED_BRANCHES=y The kernel doesn't boot with both PROFILE_ANNOTATED_BRANCHES=y and KASAN=y options selected. With branch profiling enabled we end up calling ftrace_likely_update() before kasan_early_init(). ftrace_likely_update() is built with KASAN instrumentation, so calling it before kasan has been initialized leads to crash. Use DISABLE_BRANCH_PROFILING define to make sure that we don't call ftrace_likely_update() from early code before kasan_early_init(). Fixes: ef7f0d6a6ca8 ("x86_64: add KASan support") Reported-by: Fengguang Wu Signed-off-by: Andrey Ryabinin Cc: kasan-dev@googlegroups.com Cc: Alexander Potapenko Cc: stable@vger.kernel.org Cc: Andrew Morton Cc: lkp@01.org Cc: Dmitry Vyukov Link: http://lkml.kernel.org/r/20170313163337.1704-1-aryabinin@virtuozzo.com Signed-off-by: Thomas Gleixner --- arch/x86/kernel/head64.c | 1 + arch/x86/mm/kasan_init_64.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index 54a2372..b5785c1 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -4,6 +4,7 @@ * Copyright (C) 2000 Andrea Arcangeli SuSE */ +#define DISABLE_BRANCH_PROFILING #include #include #include diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c index 8d63d7a..4c90cfd 100644 --- a/arch/x86/mm/kasan_init_64.c +++ b/arch/x86/mm/kasan_init_64.c @@ -1,3 +1,4 @@ +#define DISABLE_BRANCH_PROFILING #define pr_fmt(fmt) "kasan: " fmt #include #include