Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp70212iob; Mon, 2 May 2022 13:20:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/Rd/7H6wGsqiH8lB6RCwJPvBVRIpVIc9NbVYDAUsNnRvKXClxCJ2hXtqeMdUs6LEDr972 X-Received: by 2002:a2e:4949:0:b0:24f:2784:877a with SMTP id b9-20020a2e4949000000b0024f2784877amr8242860ljd.529.1651522820467; Mon, 02 May 2022 13:20:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651522820; cv=none; d=google.com; s=arc-20160816; b=05YL6/EoCLc7EyIAqpafs5QBQKCgOYqubxxcBhEbLmlCNQmQkXkdGeIhRCCFQtarZC uxBI0b4CuZsIWXu/jBNzsN6TVwTFpZN0k6Ky776YijFw1vTLXLIzeRVu+bz8a2s0UT8k g2g3blOqMMOna9M6155GBmTQIH2R0wFkH99lQ/+otLZtu/SHIP6k3/bNVH+F7M4cDpot n/iQZ4SC73vqZRQROYXOntGBmwA8wKU7i9M7vyBtd/OnMxXEo8ZyMc2rzkAhVVdtLSdl kg9rg+fHwJ+4LC3dpKgmqSs0j0Y/jtf2jZkgaGXWT+tLM94wNVQhPkcPGOzLebHuNBA+ a3Og== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=EdwU7zphlaqSH4Kaj3FCs5OTnA493vLfU5D6iYHz2BU=; b=xH2MwU3ukxdcqeVoPaWLgaj4lHyI8nAl9rDynCrFZPX8F2xaU5xJhYn/fckPR19z1K UpTZvJzAx1yDh6nwKLxqy4q6J3ffL4C8cUVI0ie7zBaRNuxHQUuYYt1P1zIuolP28VBs fGqvmqO8XKzaxFs/PwMDN57eeVmWdqT1kner5UG0umxNH1Y2ZCr2e/c3zRf4Ewv9g/ag oZY2+sxhOCU6JkZcT1LryWLftv9RaT8u3hBJmLJkVvLtSiTlNyAvGAzYmbyK33NUqkB5 PIcTxkSPFrcK/Yp951VjB//JJ4GB6/BtkktNHLXH3cTVmZ/dRopFPHthiqJZRfyWDW2T IPHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=KY0tl3qY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020ac25bcb000000b0047226ff1a6dsi13360289lfn.482.2022.05.02.13.19.52; Mon, 02 May 2022 13:20:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=KY0tl3qY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381918AbiD3Kxh (ORCPT + 99 others); Sat, 30 Apr 2022 06:53:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380278AbiD3Kxd (ORCPT ); Sat, 30 Apr 2022 06:53:33 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0F126308 for ; Sat, 30 Apr 2022 03:50:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:MIME-Version:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=EdwU7zphlaqSH4Kaj3FCs5OTnA493vLfU5D6iYHz2BU=; b=KY0tl3qYFGMbWI8thn7qu5kgmw 6plHoqFMPaMwppYzTVopOCK8lK2tC6bYZlIfzcIcRxUaZLHkBgtcudLRaRnjvP7tLHiBOHdSjMCVH /vVl6G0iwciXCsfouRIbBLzoDa57aSk/bzzUznB05fqrNTgcH5o9UGX/4H32L1RomKxAdzjQGAmAE F9fh8adPOEJwZi4LQhAUbKTCOtsmCe5/vGPWNKsg8FADGKQtI6ROlDc/eoGqjz6DGOdAPWCnsaUh4 utsyIFfHIZKyeSaA3/o333+7e2UnfCGBXyMAe/pFVV/pSyZYuL6lEtIyzBzKN5WzwE7SMeHONLibZ k/+85sBA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkkfs-009tdQ-Bk; Sat, 30 Apr 2022 10:50:04 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 76B57300473; Sat, 30 Apr 2022 12:50:02 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 481752028EFE6; Sat, 30 Apr 2022 12:50:02 +0200 (CEST) Date: Sat, 30 Apr 2022 12:50:02 +0200 From: Peter Zijlstra To: Josh Poimboeuf Cc: x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] objtool: Fix SLS checks Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix the SLS validation; not having a next instruction is also a fail when the next instruction should be INSN_TRAP. Signed-off-by: Peter Zijlstra (Intel) --- tools/objtool/check.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 3f6785415894..3354101ffe34 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -3380,7 +3380,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, case INSN_RETURN: if (sls && !insn->retpoline_safe && - next_insn && next_insn->type != INSN_TRAP) { + (!next_insn || (next_insn && next_insn->type != INSN_TRAP))) { WARN_FUNC("missing int3 after ret", insn->sec, insn->offset); } @@ -3428,7 +3428,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, case INSN_JUMP_DYNAMIC: if (sls && !insn->retpoline_safe && - next_insn && next_insn->type != INSN_TRAP) { + (!next_insn || (next_insn && next_insn->type != INSN_TRAP))) { WARN_FUNC("missing int3 after indirect jump", insn->sec, insn->offset); }