From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, HK_RANDOM_FROM,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81895C2D0E4 for ; Sat, 21 Nov 2020 01:17:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 321E520729 for ; Sat, 21 Nov 2020 01:17:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ugfvqn2z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728676AbgKUBQ6 (ORCPT ); Fri, 20 Nov 2020 20:16:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727149AbgKUBQ5 (ORCPT ); Fri, 20 Nov 2020 20:16:57 -0500 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C118DC061A04 for ; Fri, 20 Nov 2020 17:16:57 -0800 (PST) Received: by mail-pg1-x549.google.com with SMTP id i7so2912180pgn.22 for ; Fri, 20 Nov 2020 17:16:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=hNPbwSq8l4B2UFQs+5TYEQCDL0cB2Zg3TMV5Lasbod4=; b=ugfvqn2ziXMzvGawN7KL27+OWEt83woAWs7sJai0MGAKigxomh1Up4fooJoxprkDAh mShdIhH4fAQZSL9ubMIhwV4BTeq4+Db65UpUEkd2Xght9vecx6EllCOjcZXrzsnvV88+ rk6RWGH+THTcGg42K1XEuAyygYeGx7cf6WERxHOyU5QUXnFbUayZZJFbF7e+86zm7Qty P4z+TH/hiCWNHofAnGSsacLmDu6eXhrNv1ujy/hpON5Db80hN3HcpPh7B/avb9cAEJiu dKfsi1UKEbLchErzVmReH8Ioy7QL4SEoxFKrH3pj5/yIP4XIks2TFhCuoOdEDO0xw2L/ 7/zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=hNPbwSq8l4B2UFQs+5TYEQCDL0cB2Zg3TMV5Lasbod4=; b=fbxteWxzQSr6BFnV5L47ThOSRJyflMStHkOJBFbrRT4ioeLiYxwOcVetynC937KswK 2sqhjxD21tKb0g4bKnjmexZI8tlNChtm5PFBmbQ4YhmZS4mbA5mforhX0eyEJAxDTPRx UXjkqTZ9QOp3GaXclwhaIjS+zCn8FreVuzAfxEbZmNjiVq39T2rgaxDCJ7LanhEDWZCb 5Puz6EOOK/zPOKaUHT5Mb2gwAEuiVW8bwQbkmdKSwCFIY3wyVXh/legaeof+g2rJbjWk TgWJ28MyC79NklyPnAyI+IoZm2F71QZ51p5e9e5tYHV+LxOwHp/5HQkDD2vIg43csZh8 pBtw== X-Gm-Message-State: AOAM533qwy/19tFwc/lJdvg/q7fppK5jay61Vp18lkYGjfXqPftesK7p CwFhvo2Ci6kcmYZVhKJ3Vlhhg+V4AY/K1T/4cag= X-Google-Smtp-Source: ABdhPJzkJlf/kKDwYCtYSLwy2coqGM5AAc+mxbuI6SxkFbdDHIUB4pJvsC4Q3wNlW5EhRQlCSv0oTEKFh6piUihEdQY= Sender: "willmcvicker via sendgmr" X-Received: from willmcvicker.c.googlers.com ([fda3:e722:ac3:10:24:72f4:c0a8:2dd0]) (user=willmcvicker job=sendgmr) by 2002:a17:90b:e04:: with SMTP id ge4mr1353298pjb.0.1605921416735; Fri, 20 Nov 2020 17:16:56 -0800 (PST) Date: Sat, 21 Nov 2020 01:16:49 +0000 Message-Id: <20201121011652.2006613-1-willmcvicker@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH v1 0/2] Add support to capture external module's SCM version From: Will McVicker To: Jessica Yu , Masahiro Yamada , Michal Marek Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, kernel-team@google.com, Will McVicker Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These two patches add module support to capture an external module's SCM version as a MODULE_INFO() attribute. This allows users to identity the SCM version of a given kernel module by using the modinfo tool or on the device via sysfs: cat /sys/module//scmversion It's important to note that the sysfs node is necessary in order to get the SCM version of modules that were loaded from the ramdisk in first stage init. I have updated scripts/setlocalversion to support this for git, mercurial, and subversion. Here is the example output I used to test these patches with a simple module versioned with git, hg, and svn: $ modinfo simple_module.ko | egrep 'scmversion|vermagic' scmversion: gbf35fd9b6412 vermagic: 5.10.0-rc4-00110-gd83461f36865 SMP mod_unload $ modinfo simple_module.ko | egrep 'scmversion|vermagic' scmversion: hge5037af323b9 vermagic: 5.10.0-rc4-00110-gd83461f36865 SMP mod_unload $ modinfo simple_module.ko | egrep 'scmversion|vermagic' scmversion: svn1 vermagic: 5.10.0-rc4-00110-gd83461f36865 SMP mod_unload Will McVicker (2): scripts/setlocalversion: allow running in a subdir modules: add scmversion field include/linux/module.h | 1 + kernel/module.c | 20 ++++++++++++++++++++ scripts/Makefile.modpost | 19 +++++++++++++++++-- scripts/mod/modpost.c | 28 +++++++++++++++++++++++++++- scripts/setlocalversion | 5 ++--- 5 files changed, 67 insertions(+), 6 deletions(-) -- 2.29.2.454.gaff20da3a2-goog