From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86D7FC433E2 for ; Tue, 15 Sep 2020 08:43:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 44FFB20771 for ; Tue, 15 Sep 2020 08:43:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="EzwBj3zY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726393AbgIOInX (ORCPT ); Tue, 15 Sep 2020 04:43:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726122AbgIOInU (ORCPT ); Tue, 15 Sep 2020 04:43:20 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3292C06174A for ; Tue, 15 Sep 2020 01:43:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=gPWjjj+GEm0phhGhPA/UBCYH87qq+66qidJCKcgCVto=; b=EzwBj3zYLSed25LzNLifTiZlQz Xgcfdh+BlMYrhowWaE6nZoBNO28uuQLlns8hCIbcC+JB9UEmGcTxtNmHdQpUdVsAyeHqOSu5KQgvk Ji6imwJ7/7gkmEkoHvBMTO5hOAmTnWWPXdhRa2b06X0CBZ8WzytHEjhEaWA2We5fbYUyn1C/kD6WF lvoB/yV8cQqYRT3GzMY9XYjrxqqlwbYc4zP/S1tueZo/7/upQfMz9QGH/kGAqgeOE5fYsvdv1G5SD UMzK6AWPWhQXj2fRr4bENYAKp6viBeydOpsr+PY/9ydLC2KalJIsHFCqvxOM/4GCGjOYrKxYsEGeN xaXzGISQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kI6YL-0007MC-Nd; Tue, 15 Sep 2020 08:43:05 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 7CFFB3019CE; Tue, 15 Sep 2020 10:43:04 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6DAFC2C639FCF; Tue, 15 Sep 2020 10:43:04 +0200 (CEST) Date: Tue, 15 Sep 2020 10:43:04 +0200 From: peterz@infradead.org To: Josh Poimboeuf Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Andy Lutomirski , Borislav Petkov , Naresh Kamboju , Logan Gunthorpe Subject: Re: [PATCH] x86/unwind/fp: Fix FP unwinding in ret_from_fork Message-ID: <20200915084304.GU1362448@hirez.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 14, 2020 at 12:04:22PM -0500, Josh Poimboeuf wrote: > There have been some reports of "bad bp value" warnings printed by the > frame pointer unwinder: > > WARNING: kernel stack regs at 000000005bac7112 in sh:1014 has bad 'bp' value 0000000000000000 > > This warning happens when unwinding from an interrupt in > ret_from_fork(). If entry code gets interrupted, the state of the frame > pointer (rbp) may be undefined, which can confuse the unwinder, > resulting in warnings like the above. > > There's an in_entry_code() check which normally silences such warnings > for entry code. But in this case, ret_from_fork() is getting > interrupted. It recently got moved out of .entry.text, so the > in_entry_code() check no longer works. > > We could move it back into .entry.text, but that would break the noinstr > validation because of the call to schedule_tail(). > > Instead, initialize each new task's RBP to point to the task's entry > regs via an encoded frame pointer. That will allow the unwinder to > reach the end of the stack gracefully. > > Fixes: b9f6976bfb94 ("x86/entry/64: Move non entry code into .text section") > Reported-by: Naresh Kamboju > Reported-by: Logan Gunthorpe > Signed-off-by: Josh Poimboeuf Acked-by: Peter Zijlstra (Intel)