Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1410728rwb; Fri, 28 Jul 2023 09:02:54 -0700 (PDT) X-Google-Smtp-Source: APBJJlG9mN+Doj5/hftBeUN0Nkjr+VmamUHU3GEBycXAC2wt0OMcFWM+KHw3uvZa7+Honz+Cc8do X-Received: by 2002:a2e:80ce:0:b0:2b6:de52:34f with SMTP id r14-20020a2e80ce000000b002b6de52034fmr2035673ljg.24.1690560174543; Fri, 28 Jul 2023 09:02:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690560174; cv=none; d=google.com; s=arc-20160816; b=TXfBiv2GPoLw3d7z5HN7uQxcFSCdL/mCgY/YvEPpBdwgBW2sJZFh9ipX6LHL7t7Ee3 uP+jMdxo6hbj+M/6+TZaxKjkd09/J8rJ4az4HCvB/h91USGUrzTEIPNaxUQuo4W8tbSb 1gpLR6S0MJJjac0Bg5gwbciehYfiYdodkPVZeKluG6TY+mPU7Ket2voHo605BzNPOJ+9 EtQYHfJR6r/4uonqw0bD29eETL9SfXsQuww5Lifa1hSdTTZQJ+/CQo2+Ma9OOS+5U+n1 DVSZaqDrE27RFXVp5G6XQ3RVFmauWi/SYubi4feeUfGnfL7gxcH28vttf4bqIBAiKWwe lFew== 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=mKbbS2x69AA4YcJ80Po3sbN43GvTzRqTYvI5Phy4cRk=; fh=UXeNxjAL33o8P1EhfLQkKOrZdmSFTOsfAlOnrRmNUdw=; b=s8nYq3/ncO8SqArZ96jezADu6a4G4IBAr2itdn6q04g/VCvk4zR52ox3EYoIgrLH80 2g3X/CRAF1/aKWjZG81MwmROTk6Ss5w8HMxvzBk0Gr7sugJLmZaqMrk4gn+drZfO743p FuxRwMPTMPZ3rbVxc2RvZ30JOwQfKqgsVQl8/aPqteXfWfaI2Ze3LfXvCvDC8IQt/z+i f9m62wcyXjl6ORTQn3lOdG1n852mWOIFiImqJisC25aZ07rZfxv2n/8EAFNt6a6UsIab yL9cGN95hUtDxQoLrNa/PNAdnwl4c2EtfihJ6AseFATEyxvkca3C8eGUSoJy0u7SsHmC JgLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p5Tu2hgT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f9-20020a170906138900b0099bca0c5445si3139158ejc.363.2023.07.28.09.02.18; Fri, 28 Jul 2023 09:02:54 -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=@kernel.org header.s=k20201202 header.b=p5Tu2hgT; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237288AbjG1PgL (ORCPT + 99 others); Fri, 28 Jul 2023 11:36:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229917AbjG1PgH (ORCPT ); Fri, 28 Jul 2023 11:36:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F03110FA; Fri, 28 Jul 2023 08:36:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 12E276218D; Fri, 28 Jul 2023 15:36:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F875C433D9; Fri, 28 Jul 2023 15:35:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690558565; bh=RiameAJyaqASlv6hb4c10KMAlN4/6+6/hqnDkYkEzPY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=p5Tu2hgT+a6gPKQMW1urJHIGxB0ZTZOTtxLFvSij1f/yjSQQyTa3zf0mqdYayXPmV iccIrLhwD4QgY1Nagc4saDTCQBBcQAV3RcD1m6I2F1ForGzrpqfl32G6a840/Taa7m jAW0KefOuBEpEOxh9v1oNKyA0vJvkBsDdk4UOR1d8fmxbhTXNBN479coNCzX9EKVkf g7e48OjBzRhIJ1ioN6rN2lAkY9uA3PrFeg93sId02DNN6tLC0glfzPl7gZYl7gg3Gu 4sC+6Du26Ly24TZAb5B0eOcNMIwGZbynuoLApCVvleEIQpqXqssPsuv7UECOCOrQMQ 03M7Kq16bokjw== Date: Fri, 28 Jul 2023 10:35:57 -0500 From: Josh Poimboeuf To: Valentin Schneider Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, x86@kernel.org, rcu@vger.kernel.org, linux-kselftest@vger.kernel.org, Josh Poimboeuf , Steven Rostedt , Masami Hiramatsu , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Paolo Bonzini , Wanpeng Li , Vitaly Kuznetsov , Andy Lutomirski , Peter Zijlstra , Frederic Weisbecker , "Paul E. McKenney" , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , Jason Baron , Kees Cook , Sami Tolvanen , Ard Biesheuvel , Nicholas Piggin , Juerg Haefliger , Nicolas Saenz Julienne , "Kirill A. Shutemov" , Nadav Amit , Dan Carpenter , Chuang Wang , Yang Jihong , Petr Mladek , "Jason A. Donenfeld" , Song Liu , Julian Pidancet , Tom Lendacky , Dionna Glaze , Thomas =?utf-8?Q?Wei=C3=9Fschuh?= , Juri Lelli , Daniel Bristot de Oliveira , Marcelo Tosatti , Yair Podemsky Subject: Re: [RFC PATCH v2 12/20] objtool: Warn about non __ro_after_init static key usage in .noinstr Message-ID: <20230728153557.frzmaayyy3auibx3@treble> References: <20230720163056.2564824-1-vschneid@redhat.com> <20230720163056.2564824-13-vschneid@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230720163056.2564824-13-vschneid@redhat.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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, Jul 20, 2023 at 05:30:48PM +0100, Valentin Schneider wrote: > +static int validate_static_key(struct instruction *insn, struct insn_state *state) > +{ > + if (state->noinstr && state->instr <= 0) { > + if ((strcmp(insn->key_sym->sec->name, ".data..ro_after_init"))) { > + WARN_INSN(insn, > + "Non __ro_after_init static key \"%s\" in .noinstr section", For consistency with other warnings, this should start with a lowercase "n" and the string literal should be on the same line as the WARN_INSN, like WARN_INSN(insn, "non __ro_after_init static key \"%s\" in .noinstr section", ... > diff --git a/tools/objtool/special.c b/tools/objtool/special.c > index 91b1950f5bd8a..1f76cfd815bf3 100644 > --- a/tools/objtool/special.c > +++ b/tools/objtool/special.c > @@ -127,6 +127,9 @@ static int get_alt_entry(struct elf *elf, const struct special_entry *entry, > return -1; > } > alt->key_addend = reloc_addend(key_reloc); > + > + reloc_to_sec_off(key_reloc, &sec, &offset); > + alt->key_sym = find_symbol_by_offset(sec, offset & ~2); Bits 0 and 1 can both store data, should be ~3? -- Josh