Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2446636yba; Sun, 7 Apr 2019 19:24:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfZpdrH4RWKz0PiWHNlDk+NKSPhRuoN1+LMnb3Hd5+P4sStGIu+UCd4Tra5OjDbPN2BzB8 X-Received: by 2002:a62:f24e:: with SMTP id y14mr26473711pfl.209.1554690278890; Sun, 07 Apr 2019 19:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554690278; cv=none; d=google.com; s=arc-20160816; b=voYRhA7HsnN8GZlKzLDb0Vrml4MAwKX+YoFi3lDXc+ge3uLy15A3bcbmnIA3g6YShf RVC7/NRpFUpR67+3606peHU0xR43F21oT6Wb9CjPvBqrE9Q0TlOwFeZcQk8+YTvLez1d okg+2p+/gYEQGW8Y4o8ioqW88JQ7qe+ZkzMYhmoVaSfoPaUKrudMy2k6k6TYZQi8Usbm NQXJ+Dhci5VtY1H1TP7TOeNcXB+/ltIRqLulMq93ZMC8XaWjYviHp6KyDdMzSjbjT4K7 noznIXMACxRvoysupef4OQdwQb8/sZPmhKxphSKe3zi9FfUYcLN4UtE5SSHFN1vXKQ1O CPdQ== 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=TUbaBXtpCmSrjuTK6IUjzL3dTrQfTmRtSA9j6+faIVQ=; b=r34Ix0CRfE63kjHvrAb0cCVcNZWWrO2Qhd1rvq6pG94OlF4lQarOC7WajdsSd1o8Ci kfLY54WMLOr4Pt0c8lHUEWHgXo2LeE+SkeyBH45Jc1TXjvLMSTxegvEY3rymt423zuql vk+e13pvGA0XI+B2lW4WYinPYptxfU689pdzr9KgvqFvtaD1Brk0lDVBEO/RyZVk6cQ2 +2zd2OgsaBVetEd8/I64sYW/xLvdxC3Q/xfWSxoEziUV0TfNafD7tJ74UnX37khbMoh8 MQbbkQzMYD+2ZRWWge9h6KQW5M5v26O0mi/uEOfchKzGMIU3NJ6q9DYQswGwMTDvaq9e M1+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1v0QDght; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8si26735829plb.282.2019.04.07.19.24.23; Sun, 07 Apr 2019 19:24:38 -0700 (PDT) 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=@kernel.org header.s=default header.b=1v0QDght; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726531AbfDHCXt (ORCPT + 99 others); Sun, 7 Apr 2019 22:23:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:45242 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726492AbfDHCXs (ORCPT ); Sun, 7 Apr 2019 22:23:48 -0400 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C88AF208E3 for ; Mon, 8 Apr 2019 02:23:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554690228; bh=lrCw0iUUmcs2Ad2V6P14jHAscsgzliMMc40BRmRKkcU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=1v0QDghtyT39gjJhJHL0Xj+SDtwpSWO5S5XDa6Bqz2ck825+z92XJfmaYfXsC7C8n 4mI6jzHOsDlzh9+CPKPjtH8pWwoHilvnn4faVo7Mr/OQWjXP35uQrrSff60VyyExyu Oe38qKSH3PKPbFk5q4qES4rfpzhFdyy0IT+LqcD4= Received: by mail-wm1-f45.google.com with SMTP id a184so12425420wma.2 for ; Sun, 07 Apr 2019 19:23:47 -0700 (PDT) X-Gm-Message-State: APjAAAWlOSgYSJ45xJjzzsfrGnmAiGPR9nOO5Xmc6ILV62ELIRJF36Bj quMUK1sVpl9GXwKjqql+JH/mWHCq79mE2Fk5OhDhNA== X-Received: by 2002:a1c:4e19:: with SMTP id g25mr16352574wmh.9.1554690226392; Sun, 07 Apr 2019 19:23:46 -0700 (PDT) MIME-Version: 1.0 References: <20190405150658.237064784@linutronix.de> <20190405150930.967389183@linutronix.de> In-Reply-To: From: Andy Lutomirski Date: Sun, 7 Apr 2019 19:23:34 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch V2 28/29] x86/irq/64: Remap the IRQ stack with guard pages To: Thomas Gleixner Cc: Andy Lutomirski , LKML , X86 ML , Josh Poimboeuf , Sean Christopherson 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, Apr 7, 2019 at 3:44 PM Thomas Gleixner wrote: > > On Sat, 6 Apr 2019, Andy Lutomirski wrote: > > On Fri, Apr 5, 2019 at 8:11 AM Thomas Gleixner wrote: > > > > > > From: Andy Lutomirski > > > > > > The IRQ stack lives in percpu space, so an IRQ handler that overflows it > > > will overwrite other data structures. > > > > > > Use vmap() to remap the IRQ stack so that it will have the usual guard > > > pages that vmap/vmalloc allocations have. With this the kernel will panic > > > immediately on an IRQ stack overflow. > > > > The 0day bot noticed that this dies with DEBUG_PAGEALLOC on. This is > > because the store_stackinfo() function is utter garbage and this patch > > correctly detects just how broken it is. The attached patch "fixes" > > it. (It also contains a reliability improvement that should probably > > get folded in, but is otherwise unrelated.) > > > > A real fix would remove the generic kstack_end() function entirely > > along with __HAVE_ARCH_KSTACK_END and would optionally replace > > store_stackinfo() with something useful. Josh, do we have a generic > > API to do a little stack walk like this? Otherwise, I don't think it > > would be the end of the world to just remove the offending code. > > Actually we have: save_stack_trace() > Like I did here: https://git.kernel.org/pub/scm/linux/kernel/git/luto/linux.git/log/?h=WIP.x86/stackguards (Link is bad right now but will hopefully be okay when you read it. I'm still fiddling with the other patches in there -- I'd like to kill kstack_end() entirely.