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=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham 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 026D2C433E0 for ; Mon, 22 Feb 2021 11:09:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEF6C64E57 for ; Mon, 22 Feb 2021 11:09:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230240AbhBVLJc (ORCPT ); Mon, 22 Feb 2021 06:09:32 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:44728 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230107AbhBVLJ2 (ORCPT ); Mon, 22 Feb 2021 06:09:28 -0500 Date: Mon, 22 Feb 2021 11:08:43 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1613992124; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vGYk97LA2FGj1bgwAWWW2y9GerV7pLeKiaQaK840PvY=; b=4Unh9fHa1SGCHtDHK9blkTGXFku5Wz+qXFxtrL/WNIyBSWZaF/23L4tLis711BEnqIDzJ1 3pjIUe04c5ahdANl2KAk9oqF4tXyoeolhCFS7dfDvstiZff/CedQnIgeE0lhAZoz2vMoHI AjCNoNclj8r/Rsu7Mv+tYE6wLVyPuwG7zwBurfhP7fVojiHXniB/e6RKEWrkBGwrhSke2o SksUJZM3629WLYNGKfJgnjSZz9P+LYPsh1EBM3lUV10+OUkYtlQHjVcQHLTYDLYJe/CwO3 ynAXGtYiuUDOZn0KguwkGNcOPsZUk/jaj45wbOFBjD8z1ZSPqpe3nzK0V8ugIg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1613992124; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vGYk97LA2FGj1bgwAWWW2y9GerV7pLeKiaQaK840PvY=; b=+e3HkqrRMsW8xLp5uiZ0KKnzVLERwB9q9T0G0rmvipRiuDno4BOBW5y8LpO7PGhVjyvt1B E4YIDfcuBxMrI6AQ== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: objtool/core] objtool: Fix stack-swizzle for FRAME_POINTER=y Cc: kernel test robot , "Peter Zijlstra (Intel)" , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: MIME-Version: 1.0 Message-ID: <161399212333.20312.15799180882369631665.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the objtool/core branch of tip: Commit-ID: 23e34c5988088b8bb4c55905973ca76114cb33ee Gitweb: https://git.kernel.org/tip/23e34c5988088b8bb4c55905973ca76114cb33ee Author: Peter Zijlstra AuthorDate: Thu, 18 Feb 2021 17:14:10 +01:00 Committer: Peter Zijlstra CommitterDate: Mon, 22 Feb 2021 12:05:18 +01:00 objtool: Fix stack-swizzle for FRAME_POINTER=y When objtool encounters the stack-swizzle: mov %rsp, (%[tos]) mov %[tos], %rsp ... pop %rsp Inside a FRAME_POINTER=y build, things go a little screwy because clearly we're not adjusting the cfa->base. This then results in the pop %rsp not being detected as a restore of cfa->base so it will turn into a regular POP and offset the stack, resulting in: kernel/softirq.o: warning: objtool: do_softirq()+0xdb: return with modified stack frame Therefore, have "mov %[tos], %rsp" act like a PUSH (it sorta is anyway) to balance the things out. We're not too concerned with the actual stack_size for frame-pointer builds, since we don't generate ORC data for them anyway. Fixes: aafeb14e9da2 ("objtool: Support stack-swizzle") Reported-by: kernel test robot Signed-off-by: Peter Zijlstra (Intel) Acked-by: Josh Poimboeuf Link: https://lkml.kernel.org/r/YC6UC+rc9KKmQrkd@hirez.programming.kicks-ass.net --- tools/objtool/check.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 62cd211..d7f1496 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -1983,6 +1983,20 @@ static int update_cfi_state(struct instruction *insn, struct cfi_state *cfi, } } + else if (op->dest.reg == CFI_SP && + cfi->vals[op->src.reg].base == CFI_SP_INDIRECT && + cfi->vals[op->src.reg].offset == cfa->offset) { + + /* + * The same stack swizzle case 2) as above. But + * because we can't change cfa->base, case 3) + * will become a regular POP. Pretend we're a + * PUSH so things don't go unbalanced. + */ + cfi->stack_size += 8; + } + + break; case OP_SRC_ADD: