From patchwork Tue Oct 29 19:25:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 1186258 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 472hPZ0RFjz9sPK; Wed, 30 Oct 2019 06:25:22 +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 1iPX7G-00058C-N0; Tue, 29 Oct 2019 19:25:18 +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 1iPX7E-00057h-UO for kernel-team@lists.ubuntu.com; Tue, 29 Oct 2019 19:25:16 +0000 Received: from mail-yb1-f200.google.com ([209.85.219.200]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iPX7E-0004xZ-Mt for kernel-team@lists.ubuntu.com; Tue, 29 Oct 2019 19:25:16 +0000 Received: by mail-yb1-f200.google.com with SMTP id 202so3689ybe.13 for ; Tue, 29 Oct 2019 12:25:16 -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=jXMaQL5iNIGlam9ICYmMvj0hG591WFTRxF7AfslCU68=; b=kNAMbd6rYrZjDMbO1SxfzKPNd27rT3v2T4J1pzboTJYALZ5P8Rd+3Eb4/FZsToHjy+ aEBjPvNfdEAskDLNjH+b5xmPc4M690mogXVrle/V/YaW0eBX/lTC2Y4NDtVLfa1gdAHf a7TjrZKMFnG0rITeMOYkhgbmVr22zAxmiVTxliR5CdurC0XVoC/akeMFQw0zPnxrVidn oDJVSGUSqABrg2spnHvw3+DZdq6/t7EG7babbxbMWrc0mWJpXcnmVkxQY0/Eo/WQmO5g UkJjsmSnM7LWJ66q6BkcWm+XPhY5bM7Cobi43RjQbRxPZKw6h82dSd62UrE7eEdWnffT NRGw== X-Gm-Message-State: APjAAAVhqoa8c+hqEA3BTC6NKliqMgefdtctRrhVi3Jz6BBUJo6Y33v7 mog4A47LKVPzsYBtS2UHrB5Ef28K+K4yHRqXoopsZgIrJ0WR6hID6vmVx794fETy6uetrvvNTRa DRF/tNSelefgTXM30V/jWZQVPp8LRktgXx2nqDVvkuQ== X-Received: by 2002:a25:d604:: with SMTP id n4mr198823ybg.472.1572377115427; Tue, 29 Oct 2019 12:25:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWrioI1F/XNE6vLUTNzfxdsrTRoj2dgYqY4RCC0tbmsJ2SoSL7I9q/j4lNXXHolpmNu87DGQ== X-Received: by 2002:a25:d604:: with SMTP id n4mr198797ybg.472.1572377115022; Tue, 29 Oct 2019 12:25:15 -0700 (PDT) Received: from localhost ([2605:a601:ac3:9720:2475:ec91:ce84:3b35]) by smtp.gmail.com with ESMTPSA id b201sm6419710ywe.2.2019.10.29.12.25.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2019 12:25:14 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH v2][SRU][E/Unstable] UBUNTU: [Packaging] Leave unsigned modules unsigned after adding .gnu_debuglink Date: Tue, 29 Oct 2019 14:25:13 -0500 Message-Id: <20191029192513.21447-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 Acked-by: Khalid Elmously Acked-by: Sultan Alsawaf --- debian/rules.d/2-binary-arch.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk index 82e4d80e469f..050f867060cb 100644 --- a/debian/rules.d/2-binary-arch.mk +++ b/debian/rules.d/2-binary-arch.mk @@ -413,10 +413,12 @@ 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 \ + signer=$$(/sbin/modinfo -F signer "$$path_module"); \ $(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 && \ + [ -n "$$signer" ]; then \ $(builddir)/build-$*/scripts/sign-file $(MODHASHALGO) \ $(MODSECKEY) \ $(MODPUBKEY) \