Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3414704pxy; Mon, 26 Apr 2021 00:51:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMk/e+mHLyYHmy4LVeBOETOpgXSFUsQTW0PbWolgHFJxnvjYAgjTjBUUkYNT5fNZmIDSvJ X-Received: by 2002:a17:906:134d:: with SMTP id x13mr17188335ejb.61.1619423507966; Mon, 26 Apr 2021 00:51:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619423507; cv=none; d=google.com; s=arc-20160816; b=sPYaDnphPkN0L733DU/bL9bfVd3OdhPtBc2bPW+JAP8z+nUDJLOLwzGgtzmZpikzaO dQ9jwTzQ4Uq3KcsA5kh7dlPEme4K/FGiftlvCowZanc7H3qbBu8n0ZbjVjQbPHDtKiJX JauxbZRbzfjP4M7AIu9N0kDWo8zQGU+OfcFiQPze2z+l6A7j1ogm56SP8doNEpNfwE/Z WWhdLnmiPlxD+SGmoHojejYEyTUJuDw5wJ6k3eRGTZm5ahfPUnvEWxdEejVJFc+czzoq NwSSM4Vd4vN8npSzWkWmlQHGRoWlOJMvUdfCiv774r2Un2knaE1mspbGlwQrDjV2lnHX BaLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=J6ZK9eYaz6daHPFTskI57pU0GNfzVX+SgSB7M2t9CtY=; b=TxhlM2QQKApMjWU2YUGg7sXvSlzooUdv9gwVdsjiZYD2mtWfx9I+qX6o72o09g0ukh sRAZfDI/dBm8j84ABzJOLgZZ0M3vFyLv40x/J7D78ADjFECoRnV6f/TUKPNTCVEdyXx5 szphTGRQnZWyAVqwnx/mF4OxqtHnV4f/C+CpYQBvth2X8JKSiajm0JCgMwRgamLIK8F/ +6LeBu8Zu/8FvtFfDvvluhTIQR+mus6X5AldaZQxBzwVbRI8O037PKaLkdNcmgU4pH61 b31CI03O8Or6HkNqRr+Pb0g9CkINKSTrA+oo9H4fvD+Tfm2l8NMCp1se/pYo5T9rJa8A PxEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DRsT5EWQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g10si3106561edu.601.2021.04.26.00.51.24; Mon, 26 Apr 2021 00:51:47 -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=@linuxfoundation.org header.s=korg header.b=DRsT5EWQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234037AbhDZHti (ORCPT + 99 others); Mon, 26 Apr 2021 03:49:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:56278 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232859AbhDZHkf (ORCPT ); Mon, 26 Apr 2021 03:40:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1865A611BF; Mon, 26 Apr 2021 07:38:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619422720; bh=C5hji4FUmPrWScW47HD+P0j3mRsXZ4Sl6LrAKw74j8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DRsT5EWQB+x4cJnPrqmjvjtyNkSd9uIHzkRkQXtZ4pBAX9zrKWzbLIq3/SwqEtDdf X9EcapRugzvcFHmTeEaQ7NfnHDLsXVTJjdPYLGIL1wA3fq+wuX3XUBe9MO+EJDSsbX dMSoDFbM7AslGUgDoba+QiOXPgKUgdOKo4dndtz8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sven Schnelle , Vasily Gorbik , Heiko Carstens , Sasha Levin Subject: [PATCH 5.4 14/20] s390/entry: save the caller of psw_idle Date: Mon, 26 Apr 2021 09:30:05 +0200 Message-Id: <20210426072817.152717905@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210426072816.686976183@linuxfoundation.org> References: <20210426072816.686976183@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vasily Gorbik [ Upstream commit a994eddb947ea9ebb7b14d9a1267001699f0a136 ] Currently psw_idle does not allocate a stack frame and does not save its r14 and r15 into the save area. Even though this is valid from call ABI point of view, because psw_idle does not make any calls explicitly, in reality psw_idle is an entry point for controlled transition into serving interrupts. So, in practice, psw_idle stack frame is analyzed during stack unwinding. Depending on build options that r14 slot in the save area of psw_idle might either contain a value saved by previous sibling call or complete garbage. [task 0000038000003c28] do_ext_irq+0xd6/0x160 [task 0000038000003c78] ext_int_handler+0xba/0xe8 [task *0000038000003dd8] psw_idle_exit+0x0/0x8 <-- pt_regs ([task 0000038000003dd8] 0x0) [task 0000038000003e10] default_idle_call+0x42/0x148 [task 0000038000003e30] do_idle+0xce/0x160 [task 0000038000003e70] cpu_startup_entry+0x36/0x40 [task 0000038000003ea0] arch_call_rest_init+0x76/0x80 So, to make a stacktrace nicer and actually point for the real caller of psw_idle in this frequently occurring case, make psw_idle save its r14. [task 0000038000003c28] do_ext_irq+0xd6/0x160 [task 0000038000003c78] ext_int_handler+0xba/0xe8 [task *0000038000003dd8] psw_idle_exit+0x0/0x6 <-- pt_regs ([task 0000038000003dd8] arch_cpu_idle+0x3c/0xd0) [task 0000038000003e10] default_idle_call+0x42/0x148 [task 0000038000003e30] do_idle+0xce/0x160 [task 0000038000003e70] cpu_startup_entry+0x36/0x40 [task 0000038000003ea0] arch_call_rest_init+0x76/0x80 Reviewed-by: Sven Schnelle Signed-off-by: Vasily Gorbik Signed-off-by: Heiko Carstens Signed-off-by: Sasha Levin --- arch/s390/kernel/entry.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index c544b7a11ebb..5cba1815b8f8 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S @@ -993,6 +993,7 @@ ENDPROC(ext_int_handler) * Load idle PSW. The second "half" of this function is in .Lcleanup_idle. */ ENTRY(psw_idle) + stg %r14,(__SF_GPRS+8*8)(%r15) stg %r3,__SF_EMPTY(%r15) larl %r1,.Lpsw_idle_lpsw+4 stg %r1,__SF_EMPTY+8(%r15) -- 2.30.2