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.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,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 C626FC4363A for ; Fri, 23 Oct 2020 17:38:17 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3E7A922201 for ; Fri, 23 Oct 2020 17:38:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="zQCb3qvV"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="Z3Q8f+9R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3E7A922201 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=NBc+Oz7QU2KGuppy2vh5cFgK+ICophMLuNzvm8sKQO0=; b=zQCb3qvVvhY4LZg5NbkOyLVuk kEkeP/1Mtm/LCY9yYwFlCfgSBITy5EHuqitHVc1hiZNnqG6jrfJ2gaoowISwjVBoYFOtKmg7rhNvx IpL/H5ZlqZxlBQLQcVcngaeSWsIPXYOxEiYkaVNZSy9rF7P0j+NvzMIf022Nh671ecNowh+BaPgEH ctD5lpU42wecwOv8GcCE4016nNOeZIAyhqQkP82HkUPsTgI1+Hb9d4Gbxjtnn2h3f8kxzfRAWD9jl SrfNlBXaFbTc4WLcur4UrhFr9CZ/LvXCnXFrmdcl/yza0R/S9PuasLixUl/Rtnz0S/+RKE5G/WLDW ELz1f4q3g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kW0zQ-0007CF-6I; Fri, 23 Oct 2020 17:36:32 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kW0zN-0007B9-Bl for linux-arm-kernel@lists.infradead.org; Fri, 23 Oct 2020 17:36:30 +0000 Received: by mail-pf1-x441.google.com with SMTP id f19so1873336pfj.11 for ; Fri, 23 Oct 2020 10:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=v3oHNxup2Z/X3RcAQV9SdzT2AuZvE2TJPMlTRy4UVdg=; b=Z3Q8f+9RLq4ubmLePTMZVaggismFpKyU9D+I+6AiCOk4KvSVUOSNNZHXKxoPBh7GWY RClqHZm+Nfyudz9TEQyjxZMXOurxVJZX4mhjPfYxWkNyr/cAAEGYBbDAp5v2k6CMHKfq MxenOHLvWzjF6pubORCn8kVCK413lsXyOSsLbJ1trk61ipxsduiT0ok47wFrcNPbCcVG iiwP2bcnvlcv3dbrI1o9h1196320FtFTcf/aywJkmezF05US8O7ooXg0u/bJ/hMpDIr5 +3GbzQLq4yHFL0EImfjvXUY3X7MZpkijg/UDpo6v1eWZb+7VchisG+G2qcBvKiNl6iKu Zb3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=v3oHNxup2Z/X3RcAQV9SdzT2AuZvE2TJPMlTRy4UVdg=; b=aE3Flsc1vD2iSgW2n8vJHku3zUuF7Nxg4X+eB3nZ23wvSHmSV/LIto9MFaXsXtA3jN cSZjlYAFzJxu7adFxeB4mS4SxPs2xxbn+DR43PbL75EWas5reeJLmH1b0PVBl8/rBx14 UKbRc38QAHNaFkdxCr2eD2NNUjO0KRlgQUIKNUCapRjPHuMk7EkkVRLLG5gZ3bHTTn8l 1dWun+9E0C4t9pjT2gYCmVVXHYRSd72rqDa3ckCalN6pspoM5rCazo8deQjJJqipIdN7 yKAcKlcB/U+wRLejUH5+H9/x0SyfIUkNfpn56z+WIv0RX17hlVfweNm0V7BulZaxZARN 1AUQ== X-Gm-Message-State: AOAM530QQyA1Gd3QXrGOl/XypqKmuzSejEyzT3574u2XDsIxz3WfRsPg PL7egIPfkXcctoxJGki2hutrvQ== X-Google-Smtp-Source: ABdhPJy9hwXaRUl3z4AovIgAs9ZJu1Si99KmTZKm04vtb887MHqVl15EEMpST1nCdQo3PBn3pgvq6Q== X-Received: by 2002:a63:370f:: with SMTP id e15mr3039898pga.124.1603474584438; Fri, 23 Oct 2020 10:36:24 -0700 (PDT) Received: from google.com ([2620:15c:201:2:f693:9fff:fef4:1b6d]) by smtp.gmail.com with ESMTPSA id m3sm2611808pfk.23.2020.10.23.10.36.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Oct 2020 10:36:23 -0700 (PDT) Date: Fri, 23 Oct 2020 10:36:17 -0700 From: Sami Tolvanen To: Peter Zijlstra Subject: Re: [PATCH v6 22/25] x86/asm: annotate indirect jumps Message-ID: <20201023173617.GA3021099@google.com> References: <20201013003203.4168817-1-samitolvanen@google.com> <20201013003203.4168817-23-samitolvanen@google.com> <20201015102216.GB2611@hirez.programming.kicks-ass.net> <20201015203942.f3kwcohcwwa6lagd@treble> <20201020185217.ilg6w5l7ujau2246@treble> <20201021085606.GZ2628@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201023_133629_424852_36B821BC X-CRM114-Status: GOOD ( 16.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch , Kees Cook , "Paul E. McKenney" , Jann Horn , linux-pci@vger.kernel.org, Greg Kroah-Hartman , Masahiro Yamada , the arch/x86 maintainers , Nick Desaulniers , kernel list , Steven Rostedt , linux-kbuild , clang-built-linux , Josh Poimboeuf , Kernel Hardening , Will Deacon , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Oct 21, 2020 at 05:22:59PM -0700, Sami Tolvanen wrote: > There are a couple of differences, like the first "undefined stack > state" warning pointing to set_bringup_idt_handler.constprop.0() > instead of __switch_to_asm(). I tried running this with --backtrace, > but objtool segfaults at the first .entry.text warning: Looks like it segfaults when calling BT_FUNC() for an instruction that doesn't have a section (?). Applying this patch allows objtool to finish with --backtrace: diff --git a/tools/objtool/check.c b/tools/objtool/check.c index c216dd4d662c..618b0c4f2890 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -2604,7 +2604,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, ret = validate_branch(file, func, insn->jump_dest, state); if (ret) { - if (backtrace) + if (backtrace && insn->sec) BT_FUNC("(branch)", insn); return ret; } Running objtool -barfld on an allyesconfig+LTO vmlinux.o prints out the following, ignoring the crypto warnings for now: __switch_to_asm()+0x0: undefined stack state xen_hypercall_set_trap_table()+0x0: <=== (sym) .entry.text+0xffd: sibling call from callable instruction with modified stack frame .entry.text+0xfcb: (branch) .entry.text+0xfb5: (alt) .entry.text+0xfb0: (alt) .entry.text+0xf78: (branch) .entry.text+0x9c: (branch) xen_syscall_target()+0x15: (branch) xen_syscall_target()+0x0: <=== (sym) .entry.text+0x1754: unsupported instruction in callable function .entry.text+0x171d: (branch) .entry.text+0x1707: (alt) .entry.text+0x1701: (alt) xen_syscall32_target()+0x15: (branch) xen_syscall32_target()+0x0: <=== (sym) .entry.text+0x1634: redundant CLD do_suspend_lowlevel()+0x116: sibling call from callable instruction with modified stack frame do_suspend_lowlevel()+0x9a: (branch) do_suspend_lowlevel()+0x0: <=== (sym) ... [skipping crypto stack pointer alignment warnings] ... __x86_retpoline_rdi()+0x10: return with modified stack frame __x86_retpoline_rdi()+0x0: (branch) .altinstr_replacement+0x13d: (branch) .text+0xaf4c7: (alt) .text+0xb03b0: (branch) .text+0xaf482: (branch) crc_pcl()+0x10: (branch) crc_pcl()+0x0: <=== (sym) __x86_retpoline_rdi()+0x0: stack state mismatch: cfa1=7+32 cfa2=7+8 .altinstr_replacement+0x20b: (branch) __x86_indirect_thunk_rdi()+0x0: (alt) __x86_indirect_thunk_rdi()+0x0: <=== (sym) .head.text+0xfb: unsupported instruction in callable function .head.text+0x207: (branch) sev_es_play_dead()+0xff: (branch) sev_es_play_dead()+0xd2: (branch) sev_es_play_dead()+0xa8: (alt) sev_es_play_dead()+0x144: (branch) sev_es_play_dead()+0x10b: (branch) sev_es_play_dead()+0x1f: (branch) sev_es_play_dead()+0x0: <=== (sym) __x86_retpoline_rdi()+0x0: stack state mismatch: cfa1=7+32 cfa2=-1+0 .altinstr_replacement+0x107: (branch) .text+0x2885: (alt) .text+0x2860: <=== (hint) .entry.text+0x48: stack state mismatch: cfa1=7-8 cfa2=-1+0 .altinstr_replacement+0xffffffffffffffff: (branch) .entry.text+0x21: (alt) .entry.text+0x1c: (alt) .entry.text+0x10: <=== (hint) .entry.text+0x15fd: stack state mismatch: cfa1=7-8 cfa2=-1+0 .altinstr_replacement+0xffffffffffffffff: (branch) .entry.text+0x15dc: (alt) .entry.text+0x15d7: (alt) .entry.text+0x15d0: <=== (hint) .entry.text+0x168c: stack state mismatch: cfa1=7-8 cfa2=-1+0 .altinstr_replacement+0xffffffffffffffff: (branch) .entry.text+0x166b: (alt) .entry.text+0x1666: (alt) .entry.text+0x1660: <=== (hint) Sami _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel