Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6021124imu; Mon, 21 Jan 2019 01:38:18 -0800 (PST) X-Google-Smtp-Source: ALg8bN5fZczr4q8YFuWSFxE+SevcroeHWwI1rHIwYpaB3Kk7FOcJ3crtPBAeBH7F1x7ondCVwyX1 X-Received: by 2002:a17:902:d83:: with SMTP id 3mr28868771plv.43.1548063497989; Mon, 21 Jan 2019 01:38:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548063497; cv=none; d=google.com; s=arc-20160816; b=Zxk9lYMBzlQJK2FuqqocAx3Si9j0H0PxGLza2jQb9VVMBcK0PGbdZoCTJ7a9bWe/iU bFlpNT/kWcx0PidAqmS8fmZD1ID3BYiCj6M91l8tk/M+H3v+AbgtTI4Y0oYJzIKVeLTj LC9c4UQ2uIc1NzPNvvUBU6WnpJLpeXrKROw8Nd/h3jFJ/bHv+MC9ovGbMPU5dgsSd3O8 iF919qJUMhJgm5FwiNY6uwif96+kvsn/Boxug+jc6EG6YmZwjVkW6CrBVjjr2/yz3OGW bchZl1f4NZhmAN2dYg5wxqs1HcvhBZLniabPf6gKUhOPlNr4fZb5mZXnDXHhjVuGAGyu mKQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=fAmOInfY/0IXt7DFkOG91Lmwl8V9D4q8vKhMCXJg2RQ=; b=fmHzzRI1YRyQTRN+UqkyHu+kdeZAYKewFdKjIUBXeSEUX7TQfo9uWsHloJARxF3plN YpxlvC9aKglynAvByABeSdtB1mAu5YoZCWOaWk65QSO00Zo9iyRFndxHNKjKMBbuh6W3 C6xxMuzLK80dpMx/ofj2G0mgM6I8UuhMpv1Y28EoNFVrNLCeEPJduRRLkTOJ/GhK6+zA auKVj1jGO2bIARI8m3j8AuziIzUPUY7/QqFnuw0e4wuw1Q6r/6zGyA5yg1iy6NfxFl17 WCHbbjOouuPNpF64OMsqEbCOk1Th0hd+tkm0qx44zXuCgLKyVp8Zf8k8vcG5APtSq5TA QJ/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aaoze4rE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c17si12002970pgl.385.2019.01.21.01.38.02; Mon, 21 Jan 2019 01:38:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aaoze4rE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727623AbfAUJgi (ORCPT + 99 others); Mon, 21 Jan 2019 04:36:38 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:55460 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726133AbfAUJgh (ORCPT ); Mon, 21 Jan 2019 04:36:37 -0500 Received: by mail-it1-f194.google.com with SMTP id m62so15557566ith.5 for ; Mon, 21 Jan 2019 01:36:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fAmOInfY/0IXt7DFkOG91Lmwl8V9D4q8vKhMCXJg2RQ=; b=aaoze4rEPm3o+48Eud1o5nm7Ew/Y4Ekvnb9jzm3lrVxuPMazzx/Rgm1JjnroBQiBlI l9FUKS0nB46XwksRUMKdsf2EwLavhMTAlz0x1RhbYOo35A978GXLQDI+vlMjeERtdQre cJnF0r9gGXPYwy3UDVJW41LFxL6Dp0cBTcHEt+AACB21CNR/0I1pxOVFBM7cU2NBPhnR K9b69bsKS7NFrse6h5VeUpn8rHFROEY/5PzSXoVwYsCO6i3GjPzg5LmaO0axtlYcWM+E BOfU+/XLC3sLMz+7vnN6FaH1cx8IGb++2nE+8bbqCDRyStwsas7+WkUTSxw3pxi0Bryz md+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fAmOInfY/0IXt7DFkOG91Lmwl8V9D4q8vKhMCXJg2RQ=; b=Rc2oYntpfKnrdHTW41lxm5MjV4WEx6gyp0SJt8aGExlwy7jm1u4UcmddLw1CsTn64L J2JVH6vBq8NrsEw08NO6NIJ9P5zY64am6SmxEKxr14yyIfF+i0N17ZzfyPRhR+S0EF9r 5j+WFotSV9W7dMcjzJMYfjqOkGIp5Sy0RcDG2zGiyavjW1ZOfEXZ2nz5SDnhpPi1AFwK d3H2NlQJIEVxmnmu3PBUpUASl5gAQW1BZRG5QtKdc/87UxCfg+gEW9fxLaUuP7QkoIHM f/Ra5kHOAJdLz+JoIuUm/H7XhnV1Lur7+AIpIs9lQUf8qmrPt2aThgqBX7NibetsuxOZ BjWA== X-Gm-Message-State: AJcUukfgJhmSSwmm4upYCrko4jxJcy8howrR2+GG1g9f/LIfRbX/4Jyd UKzIlw4ngeJAHXoLPlhEdCz9dBK3wY3loA/Spylp4Q== X-Received: by 2002:a02:ac8c:: with SMTP id x12mr15539430jan.72.1548063396364; Mon, 21 Jan 2019 01:36:36 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Dmitry Vyukov Date: Mon, 21 Jan 2019 10:36:25 +0100 Message-ID: Subject: Re: [RESEND BUG REPORT] System hung! Due to ftrace or KASAN? To: Zenghui Yu Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "the arch/x86 maintainers" , Steven Rostedt , linux-trace-devel@vger.kernel.org, kasan-dev , "open list:KERNEL BUILD + fi..." , LKML , Andrey Konovalov , Andrey Ryabinin , Andrew Morton , Linus Torvalds , Christoph Lameter , Mark Rutland , Will Deacon Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 20, 2019 at 7:29 PM Zenghui Yu wrote: > > > > Hi, All! > > > > > > > > I compiled the latest kernel and installed it on my old laptop (Hardware name: > > > > Hewlett-Packard HP ProBook 440 G2/2247, BIOS M74 Ver. 01.02 06/17/2014). But > > > > when I tried to enable function tracer via debugfs, the system went _hung_! > > > > Compared with the last kernel compiling process, the only change I have made > > > > is that I enabled KASAN configuration this time. > > > > > > > > Reproducing this issue is simple as below: > > > > > > > > 0. `uname -a` shows: > > > > Linux ubuntuu 5.0.0-rc2+ #9 SMP Fri Jan 18 03:04:01 CST 2019 > > > > x86_64 x86_64 x86_64 GNU/Linux > > > > > > > > 1. `make menuconfig` to enable KASAN configuration: > > > > Kernel hacking ---> Memory Debugging ---> > > > > KASAN: runtime memory debugger > > > > > > > > compile, install, reboot, then `dmesg | grep kasan` shows: > > > > [ 0.342882] kasan: KernelAddressSanitizer initialized > > > > > > > > 2. enable function tracer > > > > `echo function > /sys/kernel/debug/tracing/current_tracer` > > > > (then my poor laptop was locked and didn't respond to me ...) > > > > > > > > What's more, enabling function graph tracer will suffer from the same problem. > > > > I have no idea about what wrong thing had happened inside kernel -- > > > > about ftrace, > > > > or about KASAN? So I report it to you and waiting for your solution! > > > > > > > > I have provided my *.config* file as attachment for those who're interested in > > > > this issue. But sorry for that I can't provide any useful call trace > > > > because the > > > > system went down so quickly. > > > > > > > > P.S. I'm a newcomer for KASAN. If any mis-configuration or > > > > mis-understand, please > > > > fix me up and let me know :). > > > > > > Hi Zenghui, > > > > > > I've tried to reproduce this, but kernel crashes during boot with this > > > config for me. > > > I am commit 2339e91d0e6609e17943a0ab3c3c8c4044760c05, the config is > > > basically yours but updated for newer compiler and with builtin > > > modules: > > > https://gist.githubusercontent.com/dvyukov/9af234617749aa4eada67ba8c2e4f46c/raw/d0e09ddf255962313a82bb552c3fc0d832fa6844/gistfile1.txt > > > > I've commented out the warning locally for now and can reproduce the > > hang. You need this commit, it fixes the hang: > > https://groups.google.com/forum/#!topic/kasan-dev/g8A8PLKCyoE > > Thanks Dmitry! I'll try to test this commit tomorrow. > > BTW, I have bisect-ed and tested for this issue today. Finally it turned out > that > bffa986c6f80e39d9903015fc7d0d99a66bbf559 is the first bad commit. > So I'm wondering if anywhere need to be fixed in commit bffa986c6f80 ("kasan: > move common generic and tag-based code to common.c"). Thanks for bisecting. I think we have understanding of what happens here and it's exactly this that needs to be fixed: https://groups.google.com/d/msg/kasan-dev/g8A8PLKCyoE/vXnirYEnCAAJ And this commit already fixes it. > > > TITLE: WARNING in note_page > > > MAINTAINERS: [dave.hansen@linux.intel.com luto@kernel.org > > > peterz@infradead.org tglx@linutronix.de mingo@redhat.com bp@alien8.de > > > hpa@zytor.com x86@kernel.org linux-kernel@vger.kernel.org] > > > > > > ------------[ cut here ]------------ > > > x86/mm: Found insecure W+X mapping at address native_usergs_sysret64+0x0/0x10 > > > WARNING: CPU: 3 PID: 1 at arch/x86/mm/dump_pagetables.c:263 note_wx > > > arch/x86/mm/dump_pagetables.c:262 [inline] > > > WARNING: CPU: 3 PID: 1 at arch/x86/mm/dump_pagetables.c:263 > > > note_page+0x800/0xaf0 arch/x86/mm/dump_pagetables.c:302 > > > Kernel panic - not syncing: panic_on_warn set ... > > > CPU: 3 PID: 1 Comm: swapper/0 Not tainted 5.0.0-rc2+ #16 > > > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014 > > > Call Trace: > > > __dump_stack lib/dump_stack.c:77 [inline] > > > dump_stack+0x7b/0xb5 lib/dump_stack.c:113 > > > panic+0x18e/0x351 kernel/panic.c:214 > > > __warn+0x13c/0x140 kernel/panic.c:571 > > > report_bug+0xd7/0x140 lib/bug.c:186 > > > fixup_bug.part.11+0x2d/0x60 arch/x86/kernel/traps.c:178 > > > fixup_bug arch/x86/include/asm/paravirt.h:776 [inline] > > > do_error_trap+0xb6/0xc0 arch/x86/kernel/traps.c:271 > > > do_invalid_op+0x3b/0x50 arch/x86/kernel/traps.c:290 > > > invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:973 > > > RIP: 0010:note_wx arch/x86/mm/dump_pagetables.c:262 [inline] > > > RIP: 0010:note_page+0x800/0xaf0 arch/x86/mm/dump_pagetables.c:302 > > > Code: 4d 32 00 4c 89 7b 28 48 c7 43 30 00 00 00 00 e9 46 fc ff ff 4c > > > 89 ee 48 c7 c7 a0 35 c5 ae c6 05 02 81 1e 02 01 e8 50 93 01 00 <0f> 0b > > > 48 8b 7d 90 e8 75 4c 32 00 48 8b 43 20 48 89 45 c8 e9 72 f9 > > > RSP: 0000:ffff88805d5c7d18 EFLAGS: 00010286 > > > RAX: 0000000000000000 RBX: ffff88805d5c7e58 RCX: ffffffffae7f11db > > > RDX: 0000000000000001 RSI: 0000000000000004 RDI: 0000000000000246 > > > RBP: ffff88805d5c7da0 R08: ffffed100bab8f5c R09: ffffed100bab8f5c > > > R10: 0000000000000002 R11: ffffed100bab8f5c R12: 0000000000000000 > > > R13: ffffffffae800000 R14: 0000000000000004 R15: 0000000000000000 > > > walk_pmd_level arch/x86/mm/dump_pagetables.c:428 [inline] > > > walk_pud_level arch/x86/mm/dump_pagetables.c:459 [inline] > > > walk_p4d_level arch/x86/mm/dump_pagetables.c:484 [inline] > > > ptdump_walk_pgd_level_core+0x566/0x6e0 arch/x86/mm/dump_pagetables.c:552 > > > ptdump_walk_user_pgd_level_checkwx+0x4e/0x50 arch/x86/mm/dump_pagetables.c:600 > > > pti_finalize+0x27/0xaf arch/x86/mm/pti.c:682 > > > kernel_init+0x3e/0x130 init/main.c:1066 > > > ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:352 > > > Kernel Offset: 0x2c800000 from 0xffffffff81000000 (relocation range: > > > 0xffffffff80000000-0xffffffffbfffffff) > > > Rebooting in 86400 seconds..