Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4674669ybz; Tue, 28 Apr 2020 16:11:06 -0700 (PDT) X-Google-Smtp-Source: APiQypLZqOQV+GX98qNeM+vJvQr3PdZgIntsEtofp5J2f+/A2O/8vzq2Vkv6L4RWLgngDNdAU0pT X-Received: by 2002:a17:907:4033:: with SMTP id nk3mr78440ejb.273.1588115466583; Tue, 28 Apr 2020 16:11:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588115466; cv=none; d=google.com; s=arc-20160816; b=xuFysbBtX0qNbYMEY8FNGRBkFKt/m/YED9USSRVa1NfhY41cTg/hiTDWltfzX+WKJA uBtv9gtGZYr+tjRWIlHXj3UJGu3qoWsCU8hFN6ZND5o4mbdwsA6wyMyCWYOlK5ZESbbK iw7RFm8Hv9WhoR6UXp9Y4Bcq1SwMK3+Xk9AGYPJg4dyuLSKKAzyxp+NHUd0ijzoZZpeS Lp0aIcJqvw2JLz01nJjTuJ4UWaMIDEPJvmDvcj+7Y7aLjmLBFUUWgF7A2PUG1G9H+u9N qfxgX+zgtsInAfGecpmDXG6Qu317o3EfJDhkKBKeqOkcZZHayndfQuKibtoLgtIZnOuq zgaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=c7gIZHf2Nb5me8fPcM+0PdqWtp5tOUxZuSE03m8gQIY=; b=OfHGjahREXxb4nIDQIccqjj75KyzH4vlHgayOlaUFcyQPgSAHx7irr/6+Jt7EGFih1 I5/evijgrVV9sd2IKAPzBJ25k12RDUb8+0GkM5v+K+nkkcmy3xVPo27RLIQseurZOLAT pbHuVuY+xty8BWxGIuNbqeSM0AXqX9C4LtCp/8T2k/vdlzjsM0wSaalstw4zPERPtbFH MAPSJj9XxQKTUwr3boNsMo07h+Qb9knQ4QjZ6FQn4krmMIyHKqeg4eFXMnev0qZWEvT8 k26o4N88Q4WQDQYI/k7+l+lZerXUQe4+Bz4CGcP7wG5f0rXfoSYNU2QgBqkw97RyLmPx Y7Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cEutBZJn; 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 n21si2785305ejc.113.2020.04.28.16.10.41; Tue, 28 Apr 2020 16:11:06 -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=cEutBZJn; 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 S1726550AbgD1XIX (ORCPT + 99 others); Tue, 28 Apr 2020 19:08:23 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:34859 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726044AbgD1XIW (ORCPT ); Tue, 28 Apr 2020 19:08:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588115301; 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=c7gIZHf2Nb5me8fPcM+0PdqWtp5tOUxZuSE03m8gQIY=; b=cEutBZJn1qKEviammIaLWvuz6DXm9UiubIvHzuS9YGgkSTHu0yeD3sMTKajx/1+sG5+R5c Yv4oblCIIL4FvmuohW3d8B6OiP1yOOLBtgiNjmGl/kle+55HchFM8Ii3mTq0prvrISF1K+ 7sco8OSwW4MCTFYjg+iBnNzF37pA0gs= 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-77-P6nrJuiCOhamUP79dYYBpg-1; Tue, 28 Apr 2020 19:08:19 -0400 X-MC-Unique: P6nrJuiCOhamUP79dYYBpg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8C730107ACF2; Tue, 28 Apr 2020 23:08:18 +0000 (UTC) Received: from treble (ovpn-112-209.rdu2.redhat.com [10.10.112.209]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E0D665D750; Tue, 28 Apr 2020 23:08:17 +0000 (UTC) Date: Tue, 28 Apr 2020 18:08:15 -0500 From: Josh Poimboeuf To: Peter Zijlstra Cc: Arnd Bergmann , the arch/x86 maintainers , Linux Kernel Mailing List , Kees Cook Subject: Re: Remaining randconfig objtool warnings, linux-next-20200428 Message-ID: <20200428230815.mychv6vgwgjnskjl@treble> References: <20200428161044.caamvx67t2z4t6vd@treble> <20200428203855.zapf6jhcp6mbft7i@treble> <20200428215554.GA16027@hirez.programming.kicks-ass.net> <20200428220353.uepo455bj76sym4k@treble> <20200428223327.GC16027@hirez.programming.kicks-ass.net> <20200428224838.k4ttccrtoug5otan@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200428224838.k4ttccrtoug5otan@treble> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 28, 2020 at 05:48:38PM -0500, Josh Poimboeuf wrote: > On Wed, Apr 29, 2020 at 12:33:27AM +0200, Peter Zijlstra wrote: > > On Tue, Apr 28, 2020 at 05:03:53PM -0500, Josh Poimboeuf wrote: > > > On Tue, Apr 28, 2020 at 11:55:54PM +0200, Peter Zijlstra wrote: > > > > > > binutils.git/gas/configure/tc-i386.c:i386_generate_nops > > > > > > > > When there's too many NOPs (as here) it generates a JMP across the NOPS. > > > > It makes some sort of sense, at some point executing NOPs is going to be > > > > more expensive than a branch.. But shees.. > > > > > > Urgh. Even if I tell it specifically to pad with NOPs, it still does > > > this "trick". I have no idea how to deal with this in objtool. > > > > This is horrible... but it _might_ just work. > > HAHA, nice. > > This seems to work: More sophisticated version: diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 3063aa9090f9..f9082673f84c 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -597,8 +597,22 @@ SYM_CODE_START_LOCAL(common_spurious) SYM_CODE_END(common_spurious) _ASM_NOKPROBE(common_spurious) +/* + * For .p2align NOP padding with shift >= 7, if the gap is big enough, the GNU + * assembler decides to insert a JMP in the padding, which makes objtool sad. + * Force it to NOPs only, by splitting it into smaller alignments if necessary. + */ +.macro P2ALIGN shift + tmp=6 + .rept \shift-6 + .p2align tmp + tmp=tmp+1 + .endr + .p2align \shift +.endm + /* common_interrupt is a hotpath. Align it */ - .p2align CONFIG_X86_L1_CACHE_SHIFT +P2ALIGN shift=CONFIG_X86_L1_CACHE_SHIFT SYM_CODE_START_LOCAL(common_interrupt) addq $-0x80, (%rsp) /* Adjust vector to [-256, -1] range */ call interrupt_entry