Received: by 10.192.165.148 with SMTP id m20csp4963761imm; Tue, 1 May 2018 06:59:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpknBMIXWKM/GJUa4waX9dM+I/TPyRSs1G1Xb9705i3wQpqF6SU+72ihougF/9LCzvgk4Gf X-Received: by 2002:a17:902:7b97:: with SMTP id w23-v6mr8902283pll.116.1525183165459; Tue, 01 May 2018 06:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525183165; cv=none; d=google.com; s=arc-20160816; b=gYuClslc2rFW7Xw9qRPrXncesJgBSlUtFdzRm2pwlflzkrE5EEa+Rmo7E7iat8dy2l /iaFcCJ2rSuDjCmByc+wyDWy9S8oI/7WTSDgQ8N2l9z/3rbFH5y4xM7bw8Al16iUjDCs ADEzcrVVpxQ40DDnDgipAcd8tqX5xvdqgvHGAgUdCivj8wT/3R/qmZvrOQwNBiWv6qNl xFZEuCOCI+RuNz0aD//X8a6SfIwguu2ojQCm52UDeuyuGHtV1K80FkN5QewVc9s2LUwv fbBhqteKTe4Tiov9VRodkJM0bqkv3QvGIZFu5LwtLuafwI6qfQWvITaMCW2dPfelrClM 2jNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=k3Bkqqz629GELMZajCeNUgwaTDoUSe946u+u5EqV5F0=; b=y0uF+LcQ+X5/37dPG5JLWNTsA716tgsYKK7dbyyqRLEhERvY26ChQXlystn6pz+WDe 2xZyrn9fk3ts+EYmLeoPnT8l+l5zez0tfme/mrxA6JWYrQvzT1AHI+sihCCYCjDiGfTJ nDg3sCYTXCcd6qsQp1rkRDLg5n9REuD6K+rEVZroXnidK9wA04Of5b/Vvwn1HdA5h/tr dXq+xfsZm7Jkt81aEqgfc9oYOW88lg1Nk5/ApoEZ5z+TQ/MS7qC6MdUsh1cPoSUrEfG4 z90WEcKx7GcKAmECjweUhxfq/WoiK304sPG4zv7krHb/zNRcIGcvBMgyy/NS0Vw8S6xI uRDw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x22si9473561pfe.318.2018.05.01.06.59.11; Tue, 01 May 2018 06:59:25 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755438AbeEAN6z (ORCPT + 99 others); Tue, 1 May 2018 09:58:55 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52842 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755259AbeEAN6v (ORCPT ); Tue, 1 May 2018 09:58:51 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 286E5FA466; Tue, 1 May 2018 13:58:51 +0000 (UTC) Received: from treble (ovpn-123-232.rdu2.redhat.com [10.10.123.232]) by smtp.corp.redhat.com (Postfix) with SMTP id C13E7111DCFE; Tue, 1 May 2018 13:58:50 +0000 (UTC) Date: Tue, 1 May 2018 08:58:50 -0500 From: Josh Poimboeuf To: Vince Weaver Cc: Peter Zijlstra , Ingo Molnar , linux-kernel@vger.kernel.org, Arnaldo Carvalho de Melo , Thomas Gleixner , Andy Lutomirski Subject: Re: perf: fuzzer causes stack going in wrong direction warnings Message-ID: <20180501135850.enx4waqd5d7yowlj@treble> References: <20180109151253.GK6176@hirez.programming.kicks-ass.net> <20180109153341.GL6176@hirez.programming.kicks-ass.net> <20180109160551.GK3040@hirez.programming.kicks-ass.net> <20180109170716.bqmexpmywwr4bwuv@treble> <20180111052538.2qhj6oxnc24xumhk@treble> <20180111192112.d35nkotzklicd27c@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 01 May 2018 13:58:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Tue, 01 May 2018 13:58:51 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jpoimboe@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 01, 2018 at 09:29:38AM -0400, Vince Weaver wrote: > Hello > > I reported this back in January, but I think it got lost since everyone > was busy with other more pressing matters. > > But in any case, the perf_fuzzer still can trigger these type of messages > and just wanted to see if they were a cause for concern, or just noise. > > [66620.496076] WARNING: can't dereference registers at 0000000051f78a40 for ip interrupt_entry+0xba/0xc0 > [66620.506117] WARNING: stack recursion on stack type 4 > [67126.898984] WARNING: stack going in the wrong direction? ip=native_sched_clock+0xd/0x90 > [67148.214712] WARNING: can't dereference iret registers at 00000000c8f3c864 for ip error_exit+0x20/0x20 Sorry, it did fall off my radar thanks to Spectre/Meltdown. I just started looking at some similar reports, so your timing is perfect. I suspect these warnings are similar to issues I saw before with the FP unwinder, where it's trying to read the stack of a running task while the task is simultaneously writing to the stack. So basically it's probably just noise, but we should try to get rid of the warnings because the unwinder is expected to get lost in such a case. Can you try the following patch? diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c index 563e28d14f2c..5eb796865b5b 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c @@ -137,7 +137,9 @@ int get_stack_info(unsigned long *stack, struct task_struct *task, */ if (visit_mask) { if (*visit_mask & (1UL << info->type)) { - printk_deferred_once(KERN_WARNING "WARNING: stack recursion on stack type %d\n", info->type); + if (task == current) + printk_deferred_once(KERN_WARNING "WARNING: stack recursion on stack type %d\n", + info->type); goto unknown; } *visit_mask |= 1UL << info->type; diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c index feb28fee6cea..570435c52ca0 100644 --- a/arch/x86/kernel/unwind_orc.c +++ b/arch/x86/kernel/unwind_orc.c @@ -7,7 +7,14 @@ #include #define orc_warn(fmt, ...) \ - printk_deferred_once(KERN_WARNING pr_fmt("WARNING: " fmt), ##__VA_ARGS__) + printk_deferred_once(KERN_WARNING "WARNING: " fmt, ##__VA_ARGS__) + +#define orc_warn_current(fmt, ...) \ +({ \ + if (state->task == current) \ + printk_deferred_once(KERN_WARNING "WARNING: " fmt, \ + ##__VA_ARGS__); \ +}) extern int __start_orc_unwind_ip[]; extern int __stop_orc_unwind_ip[]; @@ -400,8 +407,8 @@ bool unwind_next_frame(struct unwind_state *state) case ORC_REG_R10: if (!state->regs || !state->full_regs) { - orc_warn("missing regs for base reg R10 at ip %pB\n", - (void *)state->ip); + orc_warn_current("missing regs for base reg R10 at ip %pB\n", + (void *)state->ip); goto done; } sp = state->regs->r10; @@ -409,8 +416,8 @@ bool unwind_next_frame(struct unwind_state *state) case ORC_REG_R13: if (!state->regs || !state->full_regs) { - orc_warn("missing regs for base reg R13 at ip %pB\n", - (void *)state->ip); + orc_warn_current("missing regs for base reg R13 at ip %pB\n", + (void *)state->ip); goto done; } sp = state->regs->r13; @@ -418,8 +425,8 @@ bool unwind_next_frame(struct unwind_state *state) case ORC_REG_DI: if (!state->regs || !state->full_regs) { - orc_warn("missing regs for base reg DI at ip %pB\n", - (void *)state->ip); + orc_warn_current("missing regs for base reg DI at ip %pB\n", + (void *)state->ip); goto done; } sp = state->regs->di; @@ -427,8 +434,8 @@ bool unwind_next_frame(struct unwind_state *state) case ORC_REG_DX: if (!state->regs || !state->full_regs) { - orc_warn("missing regs for base reg DX at ip %pB\n", - (void *)state->ip); + orc_warn_current("missing regs for base reg DX at ip %pB\n", + (void *)state->ip); goto done; } sp = state->regs->dx; @@ -463,8 +470,8 @@ bool unwind_next_frame(struct unwind_state *state) case ORC_TYPE_REGS: if (!deref_stack_regs(state, sp, &state->ip, &state->sp)) { - orc_warn("can't dereference registers at %p for ip %pB\n", - (void *)sp, (void *)orig_ip); + orc_warn_current("can't dereference registers at %p for ip %pB\n", + (void *)sp, (void *)orig_ip); goto done; } @@ -475,8 +482,8 @@ bool unwind_next_frame(struct unwind_state *state) case ORC_TYPE_REGS_IRET: if (!deref_stack_iret_regs(state, sp, &state->ip, &state->sp)) { - orc_warn("can't dereference iret registers at %p for ip %pB\n", - (void *)sp, (void *)orig_ip); + orc_warn_current("can't dereference iret registers at %p for ip %pB\n", + (void *)sp, (void *)orig_ip); goto done; } @@ -518,8 +525,8 @@ bool unwind_next_frame(struct unwind_state *state) if (state->stack_info.type == prev_type && on_stack(&state->stack_info, (void *)state->sp, sizeof(long)) && state->sp <= prev_sp) { - orc_warn("stack going in the wrong direction? ip=%pB\n", - (void *)orig_ip); + orc_warn_current("stack going in the wrong direction? ip=%pB\n", + (void *)orig_ip); goto done; }