From patchwork Tue Oct 29 13:15:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 1186109 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 472XBx38S3z9sPc; Wed, 30 Oct 2019 00:15:37 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1iPRLP-0006EM-4V; Tue, 29 Oct 2019 13:15:31 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iPRLN-0006Dq-DO for kernel-team@lists.ubuntu.com; Tue, 29 Oct 2019 13:15:29 +0000 Received: from mail-yb1-f199.google.com ([209.85.219.199]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iPRLN-0001R8-20 for kernel-team@lists.ubuntu.com; Tue, 29 Oct 2019 13:15:29 +0000 Received: by mail-yb1-f199.google.com with SMTP id p66so10579928yba.0 for ; Tue, 29 Oct 2019 06:15:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=+ebp6W7yRQxNG7oCM4odOVSP7t/uENAHd0AFJs3B26k=; b=ikZ9UESGDY/f96MdPuF1pvc9YNrBkXLwkGifYxwmsh8wem62+RzxEN5z1zDu6pSsI+ 4wO01o/f3BpX4RxfAe58XqMS1OyE3BhVOKsNFE4hmq3CX9Zs/kWnr3PSUqANuFViY2c1 hGPhteUb/6BnapoJDQJyJCwyfxOElSBbf216LisUdB6c1DguXHYA6LHatpAXk6mMG2aa JdikqSsqDQOSe8QDzt8wKvb64G3QWxacaCVjrbzk2nAceCeQ8Z14iymAmuILJ/+qIncH 8SBFk4RbvBAQww57JUPwhv1OjBjHADOv4Sbdsy10AA1Ouw0/2W5ZODLoAoStpx1HAhK8 A9Zg== X-Gm-Message-State: APjAAAXm7+STPxYPQ38jR8SL9UDvLxJ6lEsjVlRXGN82K4z0Y83dqnU8 jdUSiF8EQUiev5IGRhUxS1FdVdzi28r1d/FbAyQshvLtTB6W1Q4Wy+mncXptujzwu+O2ZqI1do0 M7lMTUGsSto+CWdcH8v/E1Z2aFL2mE5VnIul1b4MvPQ== X-Received: by 2002:a25:d70f:: with SMTP id o15mr19881935ybg.43.1572354927808; Tue, 29 Oct 2019 06:15:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAOj/84/1SpKTHGJc7l+/9g+HZGCUr6o4Omn2qijW2Dr6T4xkfuxmz9b2IYG8rvLkTr5C+BA== X-Received: by 2002:a25:d70f:: with SMTP id o15mr19881888ybg.43.1572354927315; Tue, 29 Oct 2019 06:15:27 -0700 (PDT) Received: from localhost ([2605:a601:ac3:9720:f461:b9b9:429:65bd]) by smtp.gmail.com with ESMTPSA id l76sm7694981ywl.24.2019.10.29.06.15.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2019 06:15:26 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH][SRU][E/Unstable] UBUNTU: [Packaging] Leave unsigned modules unsigned after adding .gnu_debuglink Date: Tue, 29 Oct 2019 08:15:25 -0500 Message-Id: <20191029131525.30878-1-seth.forshee@canonical.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1850234 When adding .gnu_debuglink sections to modules we sign modules without regard to whether or not they were signed previously. As a result modules from staging which should not have been signed are ending up with signature. Change this to check for a module signature before modifying the binary, then sign the result only if the original module was signed. Signed-off-by: Seth Forshee --- debian/rules.d/2-binary-arch.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk index 82e4d80e469f..2aea5e857f79 100644 --- a/debian/rules.d/2-binary-arch.mk +++ b/debian/rules.d/2-binary-arch.mk @@ -413,10 +413,14 @@ ifneq ($(skipdbg),true) -name '*.ko' | while read path_module ; do \ module="/lib/modules/$${path_module#*/lib/modules/}"; \ if [[ -f "$(dbgpkgdir)/usr/lib/debug/$$module" ]] ; then \ + while IFS= read -r -d '' signature < <(tail -c 28 "$$path_module"); do \ + break; \ + done; \ $(CROSS_COMPILE)objcopy \ --add-gnu-debuglink=$(dbgpkgdir)/usr/lib/debug/$$module \ $$path_module; \ - if grep -q CONFIG_MODULE_SIG=y $(builddir)/build-$*/.config; then \ + if grep -q CONFIG_MODULE_SIG=y $(builddir)/build-$*/.config && \ + [ "$$signature" = $$'~Module signature appended~\n' ]; then \ $(builddir)/build-$*/scripts/sign-file $(MODHASHALGO) \ $(MODSECKEY) \ $(MODPUBKEY) \