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]
Date:   Mon, 11 Sep 2017 16:25:17 +0800
From:   Dave Young <dyoung@...hat.com>
To:     AKASHI Takahiro <takahiro.akashi@...aro.org>
Cc:     catalin.marinas@....com, will.deacon@....com,
        bauerman@...ux.vnet.ibm.com, dhowells@...hat.com,
        vgoyal@...hat.com, herbert@...dor.apana.org.au,
        davem@...emloft.net, akpm@...ux-foundation.org, mpe@...erman.id.au,
        bhe@...hat.com, arnd@...db.de, ard.biesheuvel@...aro.org,
        kexec@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH 6/9] arm64: kexec_file: load initrd, device-tree and
 purgatory segments

> > +int arch_kimage_file_post_load_cleanup(struct kimage *image)
> > +{
> > +	vfree(image->arch.dtb_buf);
> > +	image->arch.dtb_buf = NULL;
> > +
> > +	vfree(image->arch.elf_headers);
> > +	image->arch.elf_headers = NULL;
> > +	image->arch.elf_headers_sz = 0;
> > +
> > +	if (!image->fops || !image->fops->cleanup)
> > +		return 0;
> > +
> > +	return image->fops->cleanup(image->image_loader_data);
> > +}
> > +
> > +#ifdef CONFIG_KEXEC_VERIFY_SIG
> > +int arch_kexec_kernel_verify_sig(struct kimage *image, void *kernel,
> > +				 unsigned long kernel_len)
> > +{
> > +	if (!image->fops || !image->fops->verify_sig) {
> > +		pr_debug("kernel loader does not support signature verification.\n");
> > +		return -EKEYREJECTED;
> > +	}
> > +
> > +	return image->fops->verify_sig(kernel, kernel_len);
> > +}
> 
> 
> arch_kexec_kernel_verify_sig now be duplicated so it can be put in the
> general function in kexec_file.c
> 
> Also the probe and load function are also duplicated, they can be moved
> to common code as well.
> 
> The x86 load function can be cleaned up with removing the vfree
> callback.
> 
> ---
>  arch/x86/kernel/machine_kexec_64.c |    3 ---
>  1 file changed, 3 deletions(-)
> 
> --- linux-x86.orig/arch/x86/kernel/machine_kexec_64.c
> +++ linux-x86/arch/x86/kernel/machine_kexec_64.c
> @@ -384,9 +384,6 @@ int arch_kexec_kernel_image_probe(struct
>  
>  void *arch_kexec_kernel_image_load(struct kimage *image)
>  {
> -	vfree(image->arch.elf_headers);
> -	image->arch.elf_headers = NULL;
> -

Hmm, should move above to arch_kimage_file_post_load_cleanup instead.. 

>  	if (!image->fops || !image->fops->load)
>  		return ERR_PTR(-ENOEXEC);
>  
> 


Thanks
Dave

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ