Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2214946pxb; Fri, 17 Sep 2021 05:05:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz12ZKdCi4s9sbPRqzmsguMnxz8luB+zinNZSLBWTjbR2mm2dFPaCnwcwhOiZiJzLarnPK2 X-Received: by 2002:a6b:ce17:: with SMTP id p23mr8392377iob.90.1631880310483; Fri, 17 Sep 2021 05:05:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631880310; cv=none; d=google.com; s=arc-20160816; b=rFiqIkfbR7FtcKl4emjA3K666JqPzSuGmOvNnyeVU6xHipZ49f3rdCKvKTKzJh6vWV tysSmHKZs9CKr/YV63oZ4Mt+PyqkYJDzbSdGhCKaKqlj2jIMw9bkbwAMsrc7T1iktylR /ljH9mi9T5MqfAV9snvid5qTcyaYFNYc0VPpYi/KhWjQzYNwAO2d0WujaXpZzfBl+sZ+ 0giMMqTc0XlIxkcX2nLXpXi88Ug7bIHzblpo8fIIkWrVECsGgKNWA912GOvWufqg865w rVoEmklg7tmhDHaM2kBnzZbwvntzVZqDqvcZaD6vDSvbWNWeo/uHn3BzwbKRsSkxi0jl 6jUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=YjUVKW7RN7hmomD1dlwNeRgrfxLlTcAQAdEH58HExp4=; b=LqwBG2UOB9V726ucpKhfFkJT+9MDU62n0ObbBkGFtLKVBFJ6Dk2cA5HvNeaiLGHlJf FBDsUbaf+xPdd/snRO10+3O1pVt2eRkU02FvZURNR5LTj/ngUi4FWXmpE34v6yWZPDH8 q8W7pAS42IsXDSrJVm1CCiooEXfcaCfG/uiNcQyOwu7fF+y8OJFMBfvK+fre7OqVO0EO gSCAhRf4qGc3tNBbRDuC4s+bUzfTgD3lLU0YNuhtpI7xhVEjo3z3uulQTDJy3C27chDN esh2BfhU4d4sdkO6nit6c/acI0rlv2Ts0cgOVnJKdlFU1qpZZK4G9jcJ7PCcWU7ptFia CYtw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x22si5891194iow.31.2021.09.17.05.04.53; Fri, 17 Sep 2021 05:05:10 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243320AbhIQDDp (ORCPT + 99 others); Thu, 16 Sep 2021 23:03:45 -0400 Received: from out4436.biz.mail.alibaba.com ([47.88.44.36]:62115 "EHLO out4436.biz.mail.alibaba.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231556AbhIQDDn (ORCPT ); Thu, 16 Sep 2021 23:03:43 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=alimailimapcm10staff010182156082;MF=yun.wang@linux.alibaba.com;NM=1;PH=DS;RN=22;SR=0;TI=SMTPD_---0UodiUsp_1631847727; Received: from testdeMacBook-Pro.local(mailfrom:yun.wang@linux.alibaba.com fp:SMTPD_---0UodiUsp_1631847727) by smtp.aliyun-inc.com(127.0.0.1); Fri, 17 Sep 2021 11:02:08 +0800 Subject: Re: [PATCH] x86/dumpstack/64: Add guard pages to stack_info To: Peter Zijlstra 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, Josh Poimboeuf 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> From: =?UTF-8?B?546L6LSH?= Message-ID: Date: Fri, 17 Sep 2021 11:02:07 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/9/16 下午6:02, Peter Zijlstra wrote: [snip] > > +static __always_inline bool in_stack_guard(void *addr, void *begin, void *end) > +{ > +#ifdef CONFIG_VMAP_STACK > + if (addr > (begin - PAGE_SIZE)) > + return true; After fix this logical as: addr >= (begin - PAGE_SIZE) && addr < begin it's working. Regards, Michael Wang > +#endif > + return false; > +} [snip] > > #ifdef CONFIG_X86_ESPFIX64 > @@ -455,9 +456,11 @@ DEFINE_IDTENTRY_DF(exc_double_fault) > * stack even if the actual trigger for the double fault was > * something else. > */ > - if ((unsigned long)task_stack_page(tsk) - 1 - address < PAGE_SIZE) { > - handle_stack_overflow("kernel stack overflow (double-fault)", > - regs, address); > + if (get_stack_info_noinstr((void *)address, current, &info) && > + info.type & STACK_TYPE_GUARD) { > + const char *name = stack_type_name(info.type & ~STACK_TYPE_GUARD); > + pr_emerg("BUG: %s stack guard hit at %p (stack is %p..%p)\n", > + name, (void *)address, info.begin, info.end); > } > #endif > > @@ -708,7 +711,9 @@ asmlinkage __visible noinstr struct pt_regs *vc_switch_off_ist(struct pt_regs *r > sp = regs->sp; > stack = (unsigned long *)sp; > > - if (!get_stack_info_noinstr(stack, current, &info) || info.type == STACK_TYPE_ENTRY || > + if (!get_stack_info_noinstr(stack, current, &info) || > + info.type & STACK_TYPE_GUARD || > + info.type == STACK_TYPE_ENTRY || > info.type >= STACK_TYPE_EXCEPTION_LAST) > sp = __this_cpu_ist_top_va(VC2); > >