lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4da44e94-a839-2033-29d2-90bebd4ee1e2@redhat.com>
Date:   Wed, 27 May 2020 12:08:12 +0800
From:   lijiang <lijiang@...hat.com>
To:     Jiri Bohac <jbohac@...e.cz>
Cc:     linux-kernel@...r.kernel.org, kexec@...ts.infradead.org,
        ebiederm@...ssion.com, jmorris@...ei.org, mjg59@...gle.com,
        dyoung@...hat.com, bhe@...hat.com
Subject: Re: [PATCH] kexec: Do not verify the signature without the lockdown
 or mandatory signature

在 2020年05月27日 11:15, lijiang 写道:
> 在 2020年05月26日 21:59, Jiri Bohac 写道:
>> On Mon, May 25, 2020 at 01:23:51PM +0800, Lianbo Jiang wrote:
>>> So, here, let's simplify the logic to improve code readability. If the
>>> KEXEC_SIG_FORCE enabled or kexec lockdown enabled, signature verification
>>> is mandated. Otherwise, we lift the bar for any kernel image.
>>
>> I agree completely; in fact that was my intention when
>> introducing the code, but I got overruled about the return codes:
>> https://lore.kernel.org/lkml/20180119125425.l72meyyc2qtrriwe@dwarf.suse.cz/
>>
>> I like this simplification very much, except this part:
>>
>>> +	if (ret) {
>>> +		pr_debug("kernel signature verification failed (%d).\n", ret);
>>
>> ...
>>
>>> -		pr_notice("kernel signature verification failed (%d).\n", ret);
>>
>> I think the log level should stay at most PR_NOTICE when the
>> verification failure results in rejecting the kernel. Perhaps
>> even lower.
>>
> 
> Thank you for the comment, Jiri Bohac.
> 
> I like the idea of staying at most PR_NOTICE, but the pr_notice() will output
> some messages that kernel could want to ignore, such as the case you mentioned
> below.
> 
>> In case verification is not enforced and the failure is
>> ignored, KERN_DEBUG seems reasonable.
>>
> 
> Yes, good understanding. It seems that the pr_debug() is still a good option here?
> Any other thoughts?
> 

Or the following change looks better? What's your opinion?

static int
kimage_validate_signature(struct kimage *image)
{
        int ret;

        ret = arch_kexec_kernel_verify_sig(image, image->kernel_buf,
                                           image->kernel_buf_len);
        if (ret) {

                if (IS_ENABLED(CONFIG_KEXEC_SIG_FORCE)) {
                        pr_notice("Enforced kernel signature verification failed (%d).\n", ret);
                        return ret;
                }

                /*
                 * If IMA is guaranteed to appraise a signature on the kexec
                 * image, permit it even if the kernel is otherwise locked
                 * down.
                 */
                if (!ima_appraise_signature(READING_KEXEC_IMAGE) &&
                    security_locked_down(LOCKDOWN_KEXEC))
                        return -EPERM;

                pr_debug("kernel signature verification failed (%d).\n", ret);
        }

        return 0;
}


Thanks.
Lianbo

> Thanks.
> Lianbo
> 
> 
>> Regards,
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ