Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2715356rwd; Fri, 9 Jun 2023 16:03:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5NHqKo+voY5OIvfBNypYYA0MEZsD3CmuDUVG4lmwWAlQ+D9wIkZN+a7P4o03moFuWUT3Yu X-Received: by 2002:a17:902:8544:b0:1b3:7def:3754 with SMTP id d4-20020a170902854400b001b37def3754mr198882plo.28.1686351798051; Fri, 09 Jun 2023 16:03:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686351798; cv=none; d=google.com; s=arc-20160816; b=drSX8rVyQ1JA9RBiLHy4jHQ8NYkJKSKvdIN8vTGxjkPO2bxy4vc5gO9Avhri3v3X24 /3uR2Rs1ImCYBLfU7gJJRLbPdsqW5pJxR3JAPNGOGA8sRRABzYrPdJXDxVoH0pfgqIeB C+dz+5lRw72zUtiIs/WWCIRzKUJY9uBxEHmS+JscqREOdGAchX4HbPZHlCmWB3S8EfKf dbTxcGIdVY1yhyGG9VpEyAgym+Rsmj1sHH/wHW/OvVAkqAniyvMEnzqQA7jR8VlLTzBf qXzHKx+p4NdgixzsomGrj9MqjfX1QM3mqRW32RmdkfyuF/nZQDMqfnTjuajqpChb6cjz nGjg== 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=hy2ErQNcHM+6iidumVwiivdTcYCbB0jYxgkEZrVE44w=; b=z7X6RJOn7txnojUfuXizQc+rzOL6eFF7ydS4tBqmNA9yyvFXpTJcIQBBZwesTyQqNy swVtUS/MJgHotRYLVi9Sp/pgzAzI7xvjnYUw5eRMnMsgbBscarMu9kHxkf7Q5w35Xv5N JY0SsQJUeWA8l88GcR1jHYHrDne0DmrJalfMVzqMGZoQZ042aazsF0WjIVsYyJajX4dj 2f/Y4h/hAWgcMG65C8t4q9m36Y+Uly0cfmZ3Mj/lDSav82iqEr633fXhvjMlIJQuH1d3 SJOB9apoLHPB2ZAS6+tuK4639F3dajlBHbvBxR/wdkgw2wdmFtp41oq3R8sUeRdjmeHB WdvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bsQ8UmEq; 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 a3-20020a170902b58300b001a6f0eab385si3416699pls.55.2023.06.09.16.03.03; Fri, 09 Jun 2023 16:03:18 -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=bsQ8UmEq; 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 S231675AbjFIWsI (ORCPT + 99 others); Fri, 9 Jun 2023 18:48:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbjFIWsH (ORCPT ); Fri, 9 Jun 2023 18:48: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 5F16E1BD; Fri, 9 Jun 2023 15:48:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E962665C7C; Fri, 9 Jun 2023 22:48:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2831AC433D2; Fri, 9 Jun 2023 22:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686350885; bh=9YSajLIiu//vD45TQak0tIUptjVcaYp5b5akN0t5Ftw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bsQ8UmEqEv/TW1Aao/M294bQzvIgC+L2N/QeRe1S6b5XT152Kjon97fUQk5wzPM6Q 8dyKZrJ1fEHzxSbZmGkyAJsv/IZg4nj5rorjfFeYYAuzLfAcLbCv25rnxuzKq3p8iW K1PLhtzxEyA0xpDQx+inY0UyEE5u8c90fSTZJN8rJBEEbKr5jWtYwzRW1Td2kCqA1U rRzuaAnAAnNH2JoPjGsYVm5myFrpR1T0EWbOgGlag3XPmQPbWKRytqsJbJZDe2xsHp 5Z4n6Xs6VYe99SOb9m6+lDkPTsSi1IHOfpJMulQecn0NuSH2Q7GmJxih0TFZwkWOny KO8q8DhK9O7GQ== Date: Fri, 9 Jun 2023 15:48:03 -0700 From: Josh Poimboeuf To: Omar Sandoval Cc: Peter Zijlstra , linux-kernel@vger.kernel.org, linux-debuggers@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH] x86/unwind/orc: add ELF section with ORC version number Message-ID: <20230609224803.275vqw345utsusah@treble> References: <5b70bc58ef70aab0a821111cd3201eeced8bab95.1686263379.git.osandov@osandov.com> <20230609220430.agw2rtswmjbquzom@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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 Fri, Jun 09, 2023 at 03:24:38PM -0700, Omar Sandoval wrote: > > Though, instead of > > using an incrementing version, Peter had the idea to hash the struct, > > like: > > > > awk '/^struct orc_entry {$/ { p=1 } p { print } /^}/ { p=0 }' arch/x86/include/asm/orc_types.h | sha1sum > > > > That way we don't have to remember to bump the version number, and it > > would be more resilient to partial backports in distros. > > > > Would something like that work for you? > > Any sort of unique identifier works for me. One thing that the proposed > hash wouldn't catch is if ORC_REG_* or ORC_TYPE_* are ever renumbered > (i.e., the meanings of existing values change). It also wouldn't catch > if something about the .orc_unwind_ip section changed. But assuming > changes like that would be much rarer, it could be handled manually by > bumping a "salt" for the hash. E.g., by adding 'BEGIN { print }' > to the awk script: > > awk 'BEGIN { print 1 } /^struct orc_entry {$/ { p=1 } p { print } /^}/ { p=0 }' arch/x86/include/asm/orc_types.h | sha1sum > > I'll defer to you guys whether it's easier to remember to bump a version > everytime or only in those rare cases. I think I'd prefer only bumping it in the rare cases, because we're going to end up forgetting either way ;-) To catch REG/TYPE changes, we could forego awk and just hash the whole file, the only downside being that it might introduce unnecessary changes if we change a comment or something. But the file changes rarely enough. Or we could tweak the awk to also print ORC_{REG,TYPE}_* pretty easily. -- Josh