Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3497855pxf; Mon, 5 Apr 2021 13:50:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdX71mWmq7T+ogKlCEfhglMntmFK4K+SZdJOIjWpQtt01vFNZLehW+v+7YYy1yqmeF3JKj X-Received: by 2002:a02:cd33:: with SMTP id h19mr25215281jaq.88.1617655821643; Mon, 05 Apr 2021 13:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617655821; cv=none; d=google.com; s=arc-20160816; b=Rgc5/c/vWc1rxKdFXhLBPQpuq0qXwJLKj0Y4+AYFZLhpMBLZv7ztV6RfXmIUpmHJSS NxGJsz5Qzy4oJ1UwT6NVTi/OgpRN/syozbRBglVhelkJ9rT+8k+2fe/ie4ZKHG2IPkbC PoC/7AaiVFmX6leSUFZekQZOi6FaVTu/0HefWocarZvpSYjfIhX7+8Xj2WLZxqjVpTbt r/jJ8UsJAm5d7plEIFc+cMKsJyAM2aDhiVKMGQtAX3M3adj6mfBHTtJxDcqxgKdKmmlG Jn4mVho0429dzcbdK4fEK9yspzn4TD+IjlAVwqrwfsxYEoX6elFAZZwK92NnHnIES6aL C4PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-filter; bh=mMNrihUfqpn9gK/HAAu33ogfGFRpkqnzIWvQ27e/voA=; b=nqYeyMQzYo5Kdnrs+f1JshfmbTZ5Jqyb4ZMcPmqQ08l5CcWXXbtbkQAfIcUYhOfHzD NNm10us7Q/QfoAyz02T/8iBJzuVGSObyZOsRg1tpNCT5qnRKMEonFDQx3M6orYEEdcnP YJfpOS7wixiQlfvKH24ZF3wNIDLezbJOAAM7bLC+zU1eJzkxUYkXFOEdUYkzc1AzVlw+ sCOpGIA1SD8WhUIkNyURj0bDD9dD573M2VmB0QUMirDQTtnaZn7y6Pz4Q0HszTMFOnVn UUuEQ5/0HKOuCE/hNt3exsGr9ULt5EvyaO20BAaVGb6jQ14x45bpDZn+KQd9Ve2QE/Hn fo1A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=omprussia.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y16si17296171ili.97.2021.04.05.13.50.08; Mon, 05 Apr 2021 13:50:21 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=omprussia.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235932AbhDEOLW (ORCPT + 99 others); Mon, 5 Apr 2021 10:11:22 -0400 Received: from mxout02.lancloud.ru ([45.84.86.82]:46566 "EHLO mxout02.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235763AbhDEOLW (ORCPT ); Mon, 5 Apr 2021 10:11:22 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout02.lancloud.ru B65C4233D681 Received: from LanCloud Received: from LanCloud Received: from LanCloud Subject: Re: [PATCH 5.4 03/74] module: merge repetitive strings in module_sig_check() To: Greg Kroah-Hartman CC: , , Joe Perches , Miroslav Benes , Jessica Yu , Sasha Levin References: <20210405085024.703004126@linuxfoundation.org> <20210405085024.812932452@linuxfoundation.org> <35560933-d158-76ee-0034-0b5f43d9a3c2@omprussia.ru> From: Sergey Shtylyov Organization: Open Mobile Platform, LLC Message-ID: Date: Mon, 5 Apr 2021 17:11:13 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.11.198] X-ClientProxiedBy: LFEXT02.lancloud.ru (fd00:f066::142) To LFEX1908.lancloud.ru (fd00:f066::208) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/5/21 4:40 PM, Greg Kroah-Hartman wrote: [...] >>> [ Upstream commit 705e9195187d85249fbb0eaa844b1604a98fbc9a ] >>> >>> The 'reason' variable in module_sig_check() points to 3 strings across >>> the *switch* statement, all needlessly starting with the same text. >>> Let's put the starting text into the pr_notice() call -- it saves 21 >>> bytes of the object code (x86 gcc 10.2.1). >>> >>> Suggested-by: Joe Perches >>> Reviewed-by: Miroslav Benes >>> Signed-off-by: Sergey Shtylyov >>> Signed-off-by: Jessica Yu >>> Signed-off-by: Sasha Levin >>> --- >>> kernel/module.c | 9 +++++---- >>> 1 file changed, 5 insertions(+), 4 deletions(-) >>> >>> diff --git a/kernel/module.c b/kernel/module.c >>> index ab1f97cfe18d..9fe3e9b85348 100644 >>> --- a/kernel/module.c >>> +++ b/kernel/module.c >>> @@ -2908,16 +2908,17 @@ static int module_sig_check(struct load_info *info, int flags) >>> * enforcing, certain errors are non-fatal. >>> */ >>> case -ENODATA: >>> - reason = "Loading of unsigned module"; >>> + reason = "unsigned module"; >>> goto decide; >>> case -ENOPKG: >>> - reason = "Loading of module with unsupported crypto"; >>> + reason = "module with unsupported crypto"; >>> goto decide; >>> case -ENOKEY: >>> - reason = "Loading of module with unavailable key"; >>> + reason = "module with unavailable key"; >>> decide: >>> if (is_module_sig_enforced()) { >>> - pr_notice("%s is rejected\n", reason); >>> + pr_notice("%s: loading of %s is rejected\n", >>> + info->name, reason); >> >> Mhm, in 5.4 there was no printing of 'info->name'... > > Is that now a problem? Looking at 5.4.y, it probably shouldn't be a problem... but I had to go and look. :-) I've found a simple commit that added 'info->name' printing (perhaps should also be considered for inclusion?): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e9f35f634e099894f4d6c3b039cd3de5281ee637 > thanks, > > greg k-h MBR, Sergey