Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2905931rwl; Thu, 13 Apr 2023 12:35:38 -0700 (PDT) X-Google-Smtp-Source: AKy350a70FRpf6MOJ48+dthg2WItNGI7YzvDFybkfQsvbzBt299dfH4LL+cZ5yynFmbhj6GrnOrK X-Received: by 2002:a05:6a20:8f1f:b0:e9:14e9:46ee with SMTP id b31-20020a056a208f1f00b000e914e946eemr7300788pzk.28.1681414538651; Thu, 13 Apr 2023 12:35:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681414538; cv=none; d=google.com; s=arc-20160816; b=gzOhT9BF339vj02TVBNujtuV9fjuK5k9CHTsroKMNRB8zYEmM1EdXgoWdNKQ/Xm/uO kk9B8WYcEa6HLNqwiZIZ3KkU2UJHYOmRP0R4b/Y0lhP8ysRtBMu0oi3ByIT92yNeNyov 9B4Hi31hMnxSd8EL01nTh5+cliJVbzSKG1na2QJiJFlUBRbvMYAaWeeTewkKAyVFxTfl gU7XobCJS0sf2N6MRUtbblyV7whKj3J8UkihNeqsxburjhzfTTU0FUzvM19yY6WZBDkf LZg3jOesvIs5x+7TyWhbOCXCP/EaA3vdWaEQZW9ra47PH0Y17X2i1JpwmU7XpsgH+ZVY Ia4g== 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=IHc6XnCkNX2Kn8L3W9jTWAcrwTarHbGJNtz2K6OiM0A=; b=WVW1Io9mY8RY13DoPsxteOdQdFNuOVp3mb6jycK0vnhVTl13ujNfAg6P+ccjzj1fH/ Er4UVyKTt7fcup8j3WjIhbrV9NBbU9O0FO8VW9VctLWNLpFZWYIaIDFFJ3BAXIkcVF5L giVO69D05SvfQUvjA7YmmdZuvt7YhiGdT7eJzc8RlrSaaRbwBbwhEymC8hFdJ7R+h+5c DaVBDMvnVL4nUrEO3RL0p3QtNB45CRvqKcz4moALLLY96ju0ESt5OUgytFh6nUt9rH+0 JW83B40R8phaw7n28a+0iq0qrHSGkMT6lrvsXQdzJS1lV8aIfABM7ZpJ59WzQlvCyUv5 tH3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=O9Qlz2F5; 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 201-20020a6300d2000000b004fb850691adsi2646816pga.718.2023.04.13.12.35.26; Thu, 13 Apr 2023 12:35:38 -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=casper.20170209 header.b=O9Qlz2F5; 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 S229638AbjDMTY6 (ORCPT + 99 others); Thu, 13 Apr 2023 15:24:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbjDMTY5 (ORCPT ); Thu, 13 Apr 2023 15:24:57 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56EFF6A62 for ; Thu, 13 Apr 2023 12:24:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=IHc6XnCkNX2Kn8L3W9jTWAcrwTarHbGJNtz2K6OiM0A=; b=O9Qlz2F5rPuvsV4ey3fsUUchnh dJ1p9DcMrOOSfg3USY7OMeXQSEE0owsygytdTlgtPdhlUui8IdTkV2vlaq8As+w9zjaKR7fUzkP/v vpd5ZmsIJNO5r7FSeeYm5LQpMo6oVYx6+bnAUKijlG6rJaWvtcFGNeGF14bdj7JcyiZ9RPvoHRt4W v3vrAlbiy9OwGBY25DdaDIdmvPdxStkA3zajmNh1Kn6pNolAusGxQJKSPyAk6FYQSmjPiLbr5/8N3 9rJaxN1B/Of9P2V8bTdJVDD4I7bAz3CH702ajBAyMHCMl0f5wPfrd2HiAeiohKkzeukj1FZt+ZXhN 8b0U1tfw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pn2Yt-0085Bu-F1; Thu, 13 Apr 2023 19:24:51 +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 1343A3001E4; Thu, 13 Apr 2023 21:24:50 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E08F924C37001; Thu, 13 Apr 2023 21:24:49 +0200 (CEST) Date: Thu, 13 Apr 2023 21:24:49 +0200 From: Peter Zijlstra To: Josh Poimboeuf Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Miroslav Benes Subject: Re: [PATCH 3/3] objtool: Generate ORC data for __pfx code Message-ID: <20230413192449.GQ4253@hirez.programming.kicks-ass.net> References: <20230413112426.GM4253@hirez.programming.kicks-ass.net> <20230413152933.cxhmocvbdlucvizx@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230413152933.cxhmocvbdlucvizx@treble> 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,URIBL_BLOCKED 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 On Thu, Apr 13, 2023 at 08:29:33AM -0700, Josh Poimboeuf wrote: > On Thu, Apr 13, 2023 at 01:24:26PM +0200, Peter Zijlstra wrote: > > > + if (!insn->cfi) { > > > + /* > > > + * This can happen if stack validation isn't enabled or the > > > + * function is annotated with STACK_FRAME_NON_STANDARD. > > > + */ > > > + return 0; > > > + } > > > + > > > + /* Propagate insn->cfi to the prefix code */ > > > + cfi = cfi_hash_find_or_add(insn->cfi); > > > + for (; prev != insn; prev = next_insn_same_sec(file, prev)) > > > + prev->cfi = cfi; > > > + > > > return 0; > > > } > > > > FWIW, this makes the whole thing hard rely on the prefix being single > > byte NOPs -- which they are, but perhaps we should assert this? > > Couldn't they be any stack-invariant instructions? Hmm, I was thikning that since we don't know the size of the instructions being written, we need CFI for all offsets. But perhaps, since we do a left-match on IP, only one entry at the __pfx+0 location would work?