Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1172355pxb; Thu, 16 Sep 2021 01:05:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1fvA/FTM4mg35m9+cCpZhz2UD2vmuIg2DS3N7KzTani6XV5/pAmUeMaEHCV9dQSUZv7TL X-Received: by 2002:a92:ad12:: with SMTP id w18mr2987448ilh.181.1631779511904; Thu, 16 Sep 2021 01:05:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631779511; cv=none; d=google.com; s=arc-20160816; b=J3c4TK47KNKcPAHndyl9i3tzoAAxH/G0MHxSZoC3Y/HBcR2TARpw30dmLiKB9JQ+6M DpcphiIl7K/Fm7le+1YD5tftgtrskaozmsp3YzKzZIV6vKuUQgbAPjNEOhY4y4rVQQVc T6JckdLBqTreUkKQy7/hAXP27F5YGnnsawpW9hN+Ltb+qe91RPick50yr4ALktTjmMXA HnjcIulGJhK+hGffDw8+8UbOO7dKs7zxLPGeieeWc0rNI1i/ND5MfJ08XKcVVfJo+Y4T LDCYMpjXb55uvV7OBLEGNn2zqTKgUEnel1eHPTY8PJkESQHLPW2XfZyRI1+hC3WKMiPH 4hhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fpa9ttX7CF1WZpIhVuTpbNvQaQpZawGIXndIWrx5+jI=; b=BSBROKbQDx57dKgB+RXVF3K4HoYj8KFMJUPGLVXn+FZHZtfdwg2vuiHVWlQnfrg8LN TD+dAc2zQhSySHqc0rY5ry+3fCPjoCuEcLoeyNyvX46RRg+oiSkWxrrk13xi9xwnQlwh LYdrCC7/C19HHMvMsVCuEsu52W5xO6JZfFf++zFYECI39WH9D4GvaDp0Vy8fpaQL8dIo 3wa/XkFq7RkV49eezxNgNB1gD185+SHHTfiFIAGB4/G4PmeVWK6LJALCaITyoe0c33AL VU+ap+rF9fllhbjaI9AQRPmgExWUvgqYsFUflseFmnvb+aNIyB9ZacnrgHchuB7FsS16 wEkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=da246jrz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b3si1887672iot.102.2021.09.16.01.05.00; Thu, 16 Sep 2021 01:05:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=da246jrz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235054AbhIPIFV (ORCPT + 99 others); Thu, 16 Sep 2021 04:05:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234982AbhIPIFF (ORCPT ); Thu, 16 Sep 2021 04:05:05 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D206EC061764; Thu, 16 Sep 2021 01:03:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=fpa9ttX7CF1WZpIhVuTpbNvQaQpZawGIXndIWrx5+jI=; b=da246jrz6odDZwWz+BVZfJ4yVr kc2G1ZX29712svPo5vvsUWoJLZigW9CJuhX7+ms5NojlbOnq5+ioReV+ThkFGQoEUiN8dZYakN3vq ZuVIm6a4pv0BeeUNgMThsJE09igsaVqzNbXmskExLG2bsRAkirGVP1oF6sJvmjGjvKpGIb5fjIfhI HaJSE0EjAA7uNnvtbzAGlwnzOrZe+OSSytjVBZ3a5tXmk0HWZtLSfWQ4v582RlMKNMghoht4bUQW7 0zj9WYRHhfc/6QWWSkx4HGKz4qVGhI5WpcmoaiV4S/vaoxJMyd2z8D+p8/LLITI15kT2+WfIfO0i7 WEQgbzqQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mQmMZ-003bgn-QM; Thu, 16 Sep 2021 08:03:20 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5C822300093; Thu, 16 Sep 2021 10:03:19 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4348E2CD48C44; Thu, 16 Sep 2021 10:03:19 +0200 (CEST) Date: Thu, 16 Sep 2021 10:03:19 +0200 From: Peter Zijlstra To: =?utf-8?B?546L6LSH?= Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , "open list:PERFORMANCE EVENTS SUBSYSTEM" , "open list:PERFORMANCE EVENTS SUBSYSTEM" , "open list:BPF (Safe dynamic programs and tools)" , "open list:BPF (Safe dynamic programs and tools)" , jroedel@suse.de, x86@kernel.org Subject: Re: [PATCH] x86/dumpstack/64: Add guard pages to stack_info Message-ID: References: <20210910153839.GH4323@worktop.programming.kicks-ass.net> <3fb7c51f-696b-da70-1965-1dda9910cb14@linux.alibaba.com> <3f26f7a2-0a09-056a-3a7a-4795b6723b60@linux.alibaba.com> <76de02b7-4d87-4a3a-e4d4-048829749887@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 16, 2021 at 10:00:15AM +0200, Peter Zijlstra wrote: > On Thu, Sep 16, 2021 at 11:47:49AM +0800, 王贇 wrote: > > > I did some debug and found the issue, we are missing: > > > > @@ -122,7 +137,10 @@ static __always_inline bool in_exception_stack(unsigned long *stack, struct stac > > info->type = ep->type; > > info->begin = (unsigned long *)begin; > > info->end = (unsigned long *)end; > > - info->next_sp = (unsigned long *)regs->sp; > > + > > + if (!(ep->type & STACK_TYPE_GUARD)) > > + info->next_sp = (unsigned long *)regs->sp; > > + > > return true; > > } > > > > as the guard page are not working as real stack I guess? > > Correct, but I thought I put if (type & GUARD) terminators in all paths > that ended up caring about ->next_sp. Clearly I seem to have missed one > :/ > > Let me try and figure out where that happens. Oh, I'm an idiot... yes it tries to read regs the stack, but clearly that won't work for the guard page.