Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1707226pxb; Fri, 20 Nov 2020 17:19:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLaW5Lj8lqqZhx6Yntlrcfl3kXqAKbPoqKjSzRxmU6pnkHrIaDzEEoaPuyO3iDLt8MWr5C X-Received: by 2002:aa7:d5d7:: with SMTP id d23mr38529250eds.203.1605921588279; Fri, 20 Nov 2020 17:19:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605921588; cv=none; d=google.com; s=arc-20160816; b=cbxZGtqJTWEqgK/WSuD3FdpoufkvWlumYaY6k+HmnWL8AAAgFCLcKLgS+Jtv33xhdb Wa9kpr/f0aTjneZsbGTnvI2VAAuzLXswK1nO3+ykoRFomWsciS3meOmTjoPywRBjYSR1 rHR3ZpvyHTIw7rtneQ/O1xK6WXdbAHVyCBzr6mPusN+r4FwdsczeSIa2Yo3v/aTplikP juWCC+Kpovs9acMJz5TdlXXg3Z9WStjDh7cEOJuEGHVhIQ8DsETC67fxN1do2D2pDEsX N1ewCpnb+GWQmhmdCApC9SOg85gBdPJ1g6WpCauMOsTuvqN1UcRkQtrOuZlYrZzkNRH5 dr0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=hNPbwSq8l4B2UFQs+5TYEQCDL0cB2Zg3TMV5Lasbod4=; b=XxqhQpgvPVSiSr+lrkka/Thdy0Kb2cDmQ+9d5T9hzGF47AbYqO4rcdE7PNxsnIT6On rxSLvmL1EnaS5pPPI+pqe4ZXZIlLrL1WKgFlPIGjCElX3VTEVJtxIvZKIbuKnNPw5orx 8DWGyCFqLUqflij1WhghlU6qv5o/i9MVvq4AX86GPnbsmPHULtuiSdLPy+zMVdCYIKnb o36LC4TW/xRoMoFJrUwcA+awGBOagibH+mmf0ll10wFXc+DHG/f/vPrDVTFoz3JNFkVq wSo6YYYw0zq9gDaMZwIUdFNYps9bDgKLBeA+ZxlRFgqRWlqVEoWjeZSr8rpmLlJMfees CNhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ugfvqn2z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx4si2639544edb.505.2020.11.20.17.19.25; Fri, 20 Nov 2020 17:19:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ugfvqn2z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728588AbgKUBQ6 (ORCPT + 99 others); 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= 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