Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp1998156lfo; Sat, 28 May 2022 13:13:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0HOTQZcP1Wr0gdxszs3aMKEbxlwRHJiaTpdSgogIdQPCUWJ4UVktk2E3SUswXHDEUG8b0 X-Received: by 2002:a17:902:b10f:b0:161:f196:b4e with SMTP id q15-20020a170902b10f00b00161f1960b4emr43143013plr.134.1653768830294; Sat, 28 May 2022 13:13:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653768830; cv=none; d=google.com; s=arc-20160816; b=O7C3XztItviyvb9pVEDvT9j7Qa54fm7stzcA+f3tKH3yc4R40zA15r2KALxqGnZLrh 8Y2lMBLO7Mm+dW7IEewZVNcIWPNL7OowDUD4eKcxEujkmMXjAZ7Rrv/M7hEtvpmP8aIJ aWZ8kk/WFXdhdgeG/Jv+4ZKquVh5F3Qa/24eZ799zwW39zde5JA515hfO1PUDtGxtmYb olRT+rNZ+l5KGW/pU/z2ipHeBAhirxWkV5Ubydufa7bpzzOh3g7XgIciMerKGlouOXDw 81nYXdRqgO9nNU25xu2Vi6vrBUm+3iu4qlGFAWlcMi1AtJ7zG/S2QYjeuTwrPH9gpMmm EO/Q== 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=VCOHMX9jiRdAcjTcL4IDCmTODDnyqXkS7joAhw5r9+Q=; b=Aou0LymwGXGWgfvlIUnDR4PFIbEdEqLW0HZ9u+Yf9iUoXo/5p7ftoxiTzh/gYFK2CP UHyymeQRfWeZo3nG4b78BoWLpRLdQYv8sxl0nTH796VWjsqjm0UcLgdQfvo8RZbf0B5g Z5xSRY8KL3GxNhPk+Cu7r77OYNoGNMauL4C7C+4vezJ3nbuLp9M+LEfuH1nVMErKNYD4 yqLwsCLLi5VtlrEDnPn1+8pSiberhaWXIy2qNaQcVajYdOX7/khm9Y8gmDTlPu6YbCIy i6vM89NB3drCny6wbDA50GPHL9OTkH2E3tIa4kbpW9iQth2zlkTqTJUk+w/hQTRVlKKD p0ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=qaxsxjTm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y14-20020a655a0e000000b003aa810be6aasi10794473pgs.85.2022.05.28.13.13.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:13:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=qaxsxjTm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BB3E151320; Sat, 28 May 2022 12:26:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236531AbiE1OJ2 (ORCPT + 99 others); Sat, 28 May 2022 10:09:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236498AbiE1OJ0 (ORCPT ); Sat, 28 May 2022 10:09:26 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD9C3B22 for ; Sat, 28 May 2022 07:09:25 -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=VCOHMX9jiRdAcjTcL4IDCmTODDnyqXkS7joAhw5r9+Q=; b=qaxsxjTmzF3W7GA+wVwpzxNE/F v7XBccB/y8g0mD924I3gALXYR9sNIhmaN4ytd1qlDXcbkVQjJjzFCbac2ttdBWZMbvVPmI2GCsMOA nowrtUeYzwnzJPoiXq0K1j7Cmr3tot7gT8qjN5L7W5WXYMc+A26JFvIHsCnPnOz7jKGE8t+Ht0oz/ pvLzAe7S6D2RQivhYsOVg/MHo1x8rXHiljinMG6xEaMEvNaSb1eigHa3WmHFnzENs61RTojQFYek2 myM1WZ5+PrXr0stzMWLRUbifEfPQIvQfpdY0JDR70G3dY8TwoTyWgDbdDBSJrLhMRMxOYJ9vuSc8c FxbsDZJQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nux7x-002uRu-NR; Sat, 28 May 2022 14:09:13 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 5A968980DC1; Sat, 28 May 2022 16:09:13 +0200 (CEST) Date: Sat, 28 May 2022 16:09:13 +0200 From: Peter Zijlstra To: Josh Poimboeuf Cc: x86@kernel.org, jpoimboe@redhat.com, linux-kernel@vger.kernel.org, elver@google.com, jbaron@akamai.com, rostedt@goodmis.org, ardb@kernel.org, mark.rutland@arm.com Subject: Re: [PATCH 2/7] objtool: Extend UNWIND_HINT based ENDBR rules Message-ID: References: <20220526105252.440440893@infradead.org> <20220526105957.817269865@infradead.org> <20220526150549.vqvggcuqmw2baslp@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220526150549.vqvggcuqmw2baslp@treble> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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, May 26, 2022 at 08:05:49AM -0700, Josh Poimboeuf wrote: > On Thu, May 26, 2022 at 12:52:54PM +0200, Peter Zijlstra wrote: > > Extend the UNWIND hint driven rules for ENDBR placement. Currently > > objtool expects an ENDBR at any UNWINT_HINT_IRET_REGS that is at +0 of > > an STB_GLOBAL symbol, with the expectation that this is an exception > > entry point. > > > > Extend this to also expect ENDBR at UNWIND_HINT_EMPTY at +0 for > > STB_GLOBAL symbols, with the expectation that these are also machine > > entry points (SYSCALL et. al.). > > > > This guarantees all machine entry points are covered by objtool rules at > > the expense of a few additional false positives: > > > > vmlinux.o: warning: objtool: startup_64+0x0: UNWIND_HINT_EMPTY without ENDBR > > vmlinux.o: warning: objtool: start_cpu0+0x0: UNWIND_HINT_EMPTY without ENDBR > > > > Signed-off-by: Peter Zijlstra (Intel) > > I can't remember if this was my bright idea, but it feels kind of > arbitrary. Hopefully there won't be a lot of false positives. The existing UNWIND_HINT_IRET_REGS at +0 was your idea, I'm just trying to cover more. > Anyway, won't SYSCALL-type symbols typically be referenced elsewhere in > the kernel and thus be found by the regular IBT validation? They do indeed, and that's what we've been relying on. I just figured it would be more consistent to have rules covering all machine entry points. (also all the Xen entry points are EMPTY like). > Do you have any examples of where this warning would trigger if there > were a missing ENDBR? No. Anyway, I can drop these first two patches for now.