Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp180177pxy; Tue, 20 Apr 2021 16:01:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDqNuz2MAkbkwtYerrp6mDKMFc+DTHeCJQl6uMgRFxtU8q2NyU58MXddXreujVVd5ooqK3 X-Received: by 2002:a17:906:80d1:: with SMTP id a17mr30291047ejx.55.1618959680019; Tue, 20 Apr 2021 16:01:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618959680; cv=none; d=google.com; s=arc-20160816; b=qbVJbOPz3rZJGEUv01dALj5Ict5DFyKh78/Ztdlq9w+V7D0AajrhWdXVLhnOFHajdO VJ9mbRUibA2oIAl2NJo+h7Ls5FLyij4gUN0NdGqfgRmmXtZEWqWBEWda6nCuGNMd7LKK W6F/my2rXSfA5BAf2QtNJ+wIYsPuFBaEi2v85gn7oXIk+kgAwu6DpvYxKieY1yx3WGAz lgHradNgqzaDSaC5J1nEbtJbmFsbhWe8p+KN+oNDbMZluWJwWho3wz35Jsk7MrOVnrTQ PM0YoGaxQfpMTiSsiKaNBGEMirGZohhoYiyd1x46S+YBR6NX0WrvNnNdOloOzzO5xKdO ogOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LnQ53sg5fwiQMRw1Pm3HtTObLBLrjcyC95xl1vP82O8=; b=mDZtYrZRk8ogyFArdRsuG5hVAOBin2JYiAblToejfvjGl5lNq+VbFDPkJtYimuAJMc jZNPaLRBHhcz2xAKs/SXH+qIdceKHKHAcSIfYusmBzV8QVQVf580yosVafdBnDYwGZQF IqOCVPARFtTD31bM1pTcvBZLtc0U63Ljmd6V176u6mCIDHvLTU+NqlvLr44iN5tFsu6s iq0bujnhOiMnjvWs1wgnNZH68T3RIqaS4+B3JIWnHLF4H1D/3PTSZyEhQPNUK4r8oFeG SpFaCLnuSxwzWZJgdTQc8rBvvK+B1x9oS96J8uXHzMge5Ew0krWwB0DTqWSbZcvPge/S YSKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aGuxYAxw; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i14si154370eje.519.2021.04.20.16.00.33; Tue, 20 Apr 2021 16:01:20 -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=@redhat.com header.s=mimecast20190719 header.b=aGuxYAxw; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234309AbhDTW5f (ORCPT + 99 others); Tue, 20 Apr 2021 18:57:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:55236 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233992AbhDTW5f (ORCPT ); Tue, 20 Apr 2021 18:57:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618959422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LnQ53sg5fwiQMRw1Pm3HtTObLBLrjcyC95xl1vP82O8=; b=aGuxYAxwyFdRQr/7z05TfwnPSVMa/gQpPXEBOi+OG34+veqdissTFaZ5wzkNRXZ2DsFtbA rVOkCIqaP0TrYbpnJ78VG1n9wPsV67j9RMV68cBLLNBCR5nMoOLCIrLuY4l/eP7HMrK7j5 Y59qmwNIiozoSV+uSvExGxCySNX5P8Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-477-vzBdi_YsOOSuKZd02ektjw-1; Tue, 20 Apr 2021 18:56:21 -0400 X-MC-Unique: vzBdi_YsOOSuKZd02ektjw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A72E80D6A8; Tue, 20 Apr 2021 22:55:54 +0000 (UTC) Received: from treble (ovpn-114-107.rdu2.redhat.com [10.10.114.107]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DBF9D5D9C0; Tue, 20 Apr 2021 22:55:52 +0000 (UTC) Date: Tue, 20 Apr 2021 17:55:50 -0500 From: Josh Poimboeuf To: Sami Tolvanen Cc: X86 ML , Kees Cook , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , Sedat Dilek , linux-hardening@vger.kernel.org, LKML , clang-built-linux Subject: Re: [PATCH 01/15] objtool: Find a destination for jumps beyond the section end Message-ID: <20210420225550.szbmrpwv6awd7tp5@treble> References: <20210416203844.3803177-1-samitolvanen@google.com> <20210416203844.3803177-2-samitolvanen@google.com> <20210420181412.3g5dsyhggxnvif7k@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 20, 2021 at 01:25:43PM -0700, Sami Tolvanen wrote: > On Tue, Apr 20, 2021 at 11:14 AM Josh Poimboeuf wrote: > > > > On Fri, Apr 16, 2021 at 01:38:30PM -0700, Sami Tolvanen wrote: > > > With -ffunction-sections, Clang can generate a jump beyond the end of > > > a section when the section ends in an unreachable instruction. > > > > Why? Can you show an example? > > Here's the warning I'm seeing when building allyesconfig + CFI: > > vmlinux.o: warning: objtool: > rockchip_spi_transfer_one.f088382d97b74759d70e27e891fe8f1c()+0x149: > can't find jump dest instruction at > .text.rockchip_spi_transfer_one.f088382d97b74759d70e27e891fe8f1c+0x7dc > > $ objdump -d -r -j > .text.rockchip_spi_transfer_one.f088382d97b74759d70e27e891fe8f1c > vmlinux.o > 0000000000000000 : > ... > 149: 0f 85 8d 06 00 00 jne 7dc <.compoundliteral.4> > ... > 7d7: e8 00 00 00 00 callq 7dc <.compoundliteral.4> > 7d8: R_X86_64_PLT32 __stack_chk_fail-0x4 Instead of silencing the warning by faking the jump destination, I'd rather improve the warning to something like "warning: rockchip_spi_transfer_one() falls through to the next function" which is what we normally do in this type of situation. It may be caused by UB, or a compiler bug, but either way we should figure out the root cause. -- Josh