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: <754886ff-b502-3f68-3c32-5355d4176829@amd.com>
Date:   Tue, 30 May 2017 11:46:52 -0500
From:   Tom Lendacky <thomas.lendacky@....com>
To:     Borislav Petkov <bp@...en8.de>
CC:     <linux-arch@...r.kernel.org>, <linux-efi@...r.kernel.org>,
        <kvm@...r.kernel.org>, <linux-doc@...r.kernel.org>,
        <x86@...nel.org>, <kexec@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <kasan-dev@...glegroups.com>,
        <linux-mm@...ck.org>, <iommu@...ts.linux-foundation.org>,
        Rik van Riel <riel@...hat.com>,
        Radim Krčmář <rkrcmar@...hat.com>,
        Toshimitsu Kani <toshi.kani@....com>,
        Arnd Bergmann <arnd@...db.de>,
        Jonathan Corbet <corbet@....net>,
        Matt Fleming <matt@...eblueprint.co.uk>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Joerg Roedel <joro@...tes.org>,
        Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Larry Woodman <lwoodman@...hat.com>,
        Brijesh Singh <brijesh.singh@....com>,
        Ingo Molnar <mingo@...hat.com>,
        Andy Lutomirski <luto@...nel.org>,
        "H. Peter Anvin" <hpa@...or.com>,
        Andrey Ryabinin <aryabinin@...tuozzo.com>,
        Alexander Potapenko <glider@...gle.com>,
        Dave Young <dyoung@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Dmitry Vyukov <dvyukov@...gle.com>
Subject: Re: [PATCH v5 17/32] x86/mm: Add support to access boot related data
 in the clear

On 5/21/2017 2:16 AM, Borislav Petkov wrote:
> On Fri, May 19, 2017 at 03:50:32PM -0500, Tom Lendacky wrote:
>> The "worker" function would be doing the loop through the setup data,
>> but since the setup data is mapped inside the loop I can't do the __init
>> calling the non-init function and still hope to consolidate the code.
>> Maybe I'm missing something here...
> 
> Hmm, I see what you mean. But the below change ontop doesn't fire any
> warnings here. Maybe your .config has something set which I don't...

Check if you have CONFIG_DEBUG_SECTION_MISMATCH=y

Thanks,
Tom

> 
> ---
> diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
> index 55317ba3b6dc..199c983192ae 100644
> --- a/arch/x86/mm/ioremap.c
> +++ b/arch/x86/mm/ioremap.c
> @@ -515,71 +515,50 @@ static bool memremap_is_efi_data(resource_size_t phys_addr,
>    * Examine the physical address to determine if it is boot data by checking
>    * it against the boot params setup_data chain.
>    */
> -static bool memremap_is_setup_data(resource_size_t phys_addr,
> -				   unsigned long size)
> +static bool
> +__memremap_is_setup_data(resource_size_t phys_addr, unsigned long size, bool early)
>   {
>   	struct setup_data *data;
>   	u64 paddr, paddr_next;
> +	u32 len;
>   
>   	paddr = boot_params.hdr.setup_data;
>   	while (paddr) {
> -		bool is_setup_data = false;
>   
>   		if (phys_addr == paddr)
>   			return true;
>   
> -		data = memremap(paddr, sizeof(*data),
> -				MEMREMAP_WB | MEMREMAP_DEC);
> +		if (early)
> +			data = early_memremap_decrypted(paddr, sizeof(*data));
> +		else
> +			data = memremap(paddr, sizeof(*data), MEMREMAP_WB | MEMREMAP_DEC);
>   
>   		paddr_next = data->next;
> +		len = data->len;
>   
> -		if ((phys_addr > paddr) && (phys_addr < (paddr + data->len)))
> -			is_setup_data = true;
> +		if (early)
> +			early_memunmap(data, sizeof(*data));
> +		else
> +			memunmap(data);
>   
> -		memunmap(data);
>   
> -		if (is_setup_data)
> +		if ((phys_addr > paddr) && (phys_addr < (paddr + data->len)))
>   			return true;
>   
>   		paddr = paddr_next;
>   	}
> -
>   	return false;
>   }
>   
> -/*
> - * Examine the physical address to determine if it is boot data by checking
> - * it against the boot params setup_data chain (early boot version).
> - */
>   static bool __init early_memremap_is_setup_data(resource_size_t phys_addr,
>   						unsigned long size)
>   {
> -	struct setup_data *data;
> -	u64 paddr, paddr_next;
> -
> -	paddr = boot_params.hdr.setup_data;
> -	while (paddr) {
> -		bool is_setup_data = false;
> -
> -		if (phys_addr == paddr)
> -			return true;
> -
> -		data = early_memremap_decrypted(paddr, sizeof(*data));
> -
> -		paddr_next = data->next;
> -
> -		if ((phys_addr > paddr) && (phys_addr < (paddr + data->len)))
> -			is_setup_data = true;
> -
> -		early_memunmap(data, sizeof(*data));
> -
> -		if (is_setup_data)
> -			return true;
> -
> -		paddr = paddr_next;
> -	}
> +	return __memremap_is_setup_data(phys_addr, size, true);
> +}
>   
> -	return false;
> +static bool memremap_is_setup_data(resource_size_t phys_addr, unsigned long size)
> +{
> +	return __memremap_is_setup_data(phys_addr, size, false);
>   }
>   
>   /*
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ