diff mbox series

[v15,10/10] arm64: Add IMA log information in kimage used for kexec

Message ID 20210115173017.30617-11-nramas@linux.microsoft.com (mailing list archive)
State New, archived
Headers show
Series Carry forward IMA measurement log on kexec on ARM64 | expand

Commit Message

Lakshmi Ramasubramanian Jan. 15, 2021, 5:30 p.m. UTC
Address and size of the buffer containing the IMA measurement log need
to be passed from the current kernel to the next kernel on kexec.

Add address and size fields to "struct kimage_arch" for ARM64 platform
to hold the address and size of the IMA measurement log buffer.

Update CONFIG_KEXEC_FILE to select CONFIG_HAVE_IMA_KEXEC, if CONFIG_IMA
is enabled, to indicate that the IMA measurement log information is
present in the device tree for ARM64.

Co-developed-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
Signed-off-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
---
 arch/arm64/Kconfig             | 1 +
 arch/arm64/include/asm/kexec.h | 5 +++++
 2 files changed, 6 insertions(+)

Comments

Will Deacon Jan. 27, 2021, 4:54 p.m. UTC | #1
On Fri, Jan 15, 2021 at 09:30:17AM -0800, Lakshmi Ramasubramanian wrote:
> Address and size of the buffer containing the IMA measurement log need
> to be passed from the current kernel to the next kernel on kexec.
> 
> Add address and size fields to "struct kimage_arch" for ARM64 platform
> to hold the address and size of the IMA measurement log buffer.
> 
> Update CONFIG_KEXEC_FILE to select CONFIG_HAVE_IMA_KEXEC, if CONFIG_IMA
> is enabled, to indicate that the IMA measurement log information is
> present in the device tree for ARM64.
> 
> Co-developed-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
> Signed-off-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
> Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
> Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
> ---
>  arch/arm64/Kconfig             | 1 +
>  arch/arm64/include/asm/kexec.h | 5 +++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 1d466addb078..ea7f7fe3dccd 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -1094,6 +1094,7 @@ config KEXEC
>  config KEXEC_FILE
>  	bool "kexec file based system call"
>  	select KEXEC_CORE
> +	select HAVE_IMA_KEXEC if IMA
>  	help
>  	  This is new version of kexec system call. This system call is
>  	  file based and takes file descriptors as system call argument
> diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h
> index d24b527e8c00..2bd19ccb6c43 100644
> --- a/arch/arm64/include/asm/kexec.h
> +++ b/arch/arm64/include/asm/kexec.h
> @@ -100,6 +100,11 @@ struct kimage_arch {
>  	void *elf_headers;
>  	unsigned long elf_headers_mem;
>  	unsigned long elf_headers_sz;
> +
> +#ifdef CONFIG_IMA_KEXEC
> +	phys_addr_t ima_buffer_addr;
> +	size_t ima_buffer_size;
> +#endif

Why do these need to be in the arch structure instead of 'struct kimage'?

Will
Lakshmi Ramasubramanian Jan. 27, 2021, 5:56 p.m. UTC | #2
On 1/27/21 8:54 AM, Will Deacon wrote:

Hi Will,

> On Fri, Jan 15, 2021 at 09:30:17AM -0800, Lakshmi Ramasubramanian wrote:
>> Address and size of the buffer containing the IMA measurement log need
>> to be passed from the current kernel to the next kernel on kexec.
>>
>> Add address and size fields to "struct kimage_arch" for ARM64 platform
>> to hold the address and size of the IMA measurement log buffer.
>>
>> Update CONFIG_KEXEC_FILE to select CONFIG_HAVE_IMA_KEXEC, if CONFIG_IMA
>> is enabled, to indicate that the IMA measurement log information is
>> present in the device tree for ARM64.
>>
>> Co-developed-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
>> Signed-off-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
>> Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
>> Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
>> ---
>>   arch/arm64/Kconfig             | 1 +
>>   arch/arm64/include/asm/kexec.h | 5 +++++
>>   2 files changed, 6 insertions(+)
>>
>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>> index 1d466addb078..ea7f7fe3dccd 100644
>> --- a/arch/arm64/Kconfig
>> +++ b/arch/arm64/Kconfig
>> @@ -1094,6 +1094,7 @@ config KEXEC
>>   config KEXEC_FILE
>>   	bool "kexec file based system call"
>>   	select KEXEC_CORE
>> +	select HAVE_IMA_KEXEC if IMA
>>   	help
>>   	  This is new version of kexec system call. This system call is
>>   	  file based and takes file descriptors as system call argument
>> diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h
>> index d24b527e8c00..2bd19ccb6c43 100644
>> --- a/arch/arm64/include/asm/kexec.h
>> +++ b/arch/arm64/include/asm/kexec.h
>> @@ -100,6 +100,11 @@ struct kimage_arch {
>>   	void *elf_headers;
>>   	unsigned long elf_headers_mem;
>>   	unsigned long elf_headers_sz;
>> +
>> +#ifdef CONFIG_IMA_KEXEC
>> +	phys_addr_t ima_buffer_addr;
>> +	size_t ima_buffer_size;
>> +#endif
> 
> Why do these need to be in the arch structure instead of 'struct kimage'?
> 

Currently, only powerpc and, with this patch set, arm64 have support for 
carrying forward IMA measurement list across kexec system call. The 
above fields are used for tracking IMA measurement list.

Do you see a reason to move these fields to "struct kimage"?

thanks,
  -lakshmi
Will Deacon Jan. 27, 2021, 6:02 p.m. UTC | #3
On Wed, Jan 27, 2021 at 09:56:53AM -0800, Lakshmi Ramasubramanian wrote:
> On 1/27/21 8:54 AM, Will Deacon wrote:
> > On Fri, Jan 15, 2021 at 09:30:17AM -0800, Lakshmi Ramasubramanian wrote:
> > > Address and size of the buffer containing the IMA measurement log need
> > > to be passed from the current kernel to the next kernel on kexec.
> > > 
> > > Add address and size fields to "struct kimage_arch" for ARM64 platform
> > > to hold the address and size of the IMA measurement log buffer.
> > > 
> > > Update CONFIG_KEXEC_FILE to select CONFIG_HAVE_IMA_KEXEC, if CONFIG_IMA
> > > is enabled, to indicate that the IMA measurement log information is
> > > present in the device tree for ARM64.
> > > 
> > > Co-developed-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
> > > Signed-off-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
> > > Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
> > > Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
> > > ---
> > >   arch/arm64/Kconfig             | 1 +
> > >   arch/arm64/include/asm/kexec.h | 5 +++++
> > >   2 files changed, 6 insertions(+)
> > > 
> > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> > > index 1d466addb078..ea7f7fe3dccd 100644
> > > --- a/arch/arm64/Kconfig
> > > +++ b/arch/arm64/Kconfig
> > > @@ -1094,6 +1094,7 @@ config KEXEC
> > >   config KEXEC_FILE
> > >   	bool "kexec file based system call"
> > >   	select KEXEC_CORE
> > > +	select HAVE_IMA_KEXEC if IMA
> > >   	help
> > >   	  This is new version of kexec system call. This system call is
> > >   	  file based and takes file descriptors as system call argument
> > > diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h
> > > index d24b527e8c00..2bd19ccb6c43 100644
> > > --- a/arch/arm64/include/asm/kexec.h
> > > +++ b/arch/arm64/include/asm/kexec.h
> > > @@ -100,6 +100,11 @@ struct kimage_arch {
> > >   	void *elf_headers;
> > >   	unsigned long elf_headers_mem;
> > >   	unsigned long elf_headers_sz;
> > > +
> > > +#ifdef CONFIG_IMA_KEXEC
> > > +	phys_addr_t ima_buffer_addr;
> > > +	size_t ima_buffer_size;
> > > +#endif
> > 
> > Why do these need to be in the arch structure instead of 'struct kimage'?
> > 
> 
> Currently, only powerpc and, with this patch set, arm64 have support for
> carrying forward IMA measurement list across kexec system call. The above
> fields are used for tracking IMA measurement list.
> 
> Do you see a reason to move these fields to "struct kimage"?

If they're gated on CONFIG_IMA_KEXEC, then it seems harmless for them to
be added to the shared structure. Or are you saying that there are
architectures which have CONFIG_IMA_KEXEC but do not want these fields?

Will
Lakshmi Ramasubramanian Jan. 27, 2021, 6:24 p.m. UTC | #4
On 1/27/21 10:02 AM, Will Deacon wrote:
> On Wed, Jan 27, 2021 at 09:56:53AM -0800, Lakshmi Ramasubramanian wrote:
>> On 1/27/21 8:54 AM, Will Deacon wrote:
>>> On Fri, Jan 15, 2021 at 09:30:17AM -0800, Lakshmi Ramasubramanian wrote:
>>>> Address and size of the buffer containing the IMA measurement log need
>>>> to be passed from the current kernel to the next kernel on kexec.
>>>>
>>>> Add address and size fields to "struct kimage_arch" for ARM64 platform
>>>> to hold the address and size of the IMA measurement log buffer.
>>>>
>>>> Update CONFIG_KEXEC_FILE to select CONFIG_HAVE_IMA_KEXEC, if CONFIG_IMA
>>>> is enabled, to indicate that the IMA measurement log information is
>>>> present in the device tree for ARM64.
>>>>
>>>> Co-developed-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
>>>> Signed-off-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
>>>> Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
>>>> Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
>>>> ---
>>>>    arch/arm64/Kconfig             | 1 +
>>>>    arch/arm64/include/asm/kexec.h | 5 +++++
>>>>    2 files changed, 6 insertions(+)
>>>>
>>>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>>>> index 1d466addb078..ea7f7fe3dccd 100644
>>>> --- a/arch/arm64/Kconfig
>>>> +++ b/arch/arm64/Kconfig
>>>> @@ -1094,6 +1094,7 @@ config KEXEC
>>>>    config KEXEC_FILE
>>>>    	bool "kexec file based system call"
>>>>    	select KEXEC_CORE
>>>> +	select HAVE_IMA_KEXEC if IMA
>>>>    	help
>>>>    	  This is new version of kexec system call. This system call is
>>>>    	  file based and takes file descriptors as system call argument
>>>> diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h
>>>> index d24b527e8c00..2bd19ccb6c43 100644
>>>> --- a/arch/arm64/include/asm/kexec.h
>>>> +++ b/arch/arm64/include/asm/kexec.h
>>>> @@ -100,6 +100,11 @@ struct kimage_arch {
>>>>    	void *elf_headers;
>>>>    	unsigned long elf_headers_mem;
>>>>    	unsigned long elf_headers_sz;
>>>> +
>>>> +#ifdef CONFIG_IMA_KEXEC
>>>> +	phys_addr_t ima_buffer_addr;
>>>> +	size_t ima_buffer_size;
>>>> +#endif
>>>
>>> Why do these need to be in the arch structure instead of 'struct kimage'?
>>>
>>
>> Currently, only powerpc and, with this patch set, arm64 have support for
>> carrying forward IMA measurement list across kexec system call. The above
>> fields are used for tracking IMA measurement list.
>>
>> Do you see a reason to move these fields to "struct kimage"?
> 
> If they're gated on CONFIG_IMA_KEXEC, then it seems harmless for them to
> be added to the shared structure. Or are you saying that there are
> architectures which have CONFIG_IMA_KEXEC but do not want these fields?
> 

As far as I know, there are no other architectures that define 
CONFIG_IMA_KEXEC, but do not use these fields.

Mimi - please correct me if I am wrong.

thanks,
  -lakshmi
Mimi Zohar Jan. 27, 2021, 6:31 p.m. UTC | #5
On Wed, 2021-01-27 at 10:24 -0800, Lakshmi Ramasubramanian wrote:
> On 1/27/21 10:02 AM, Will Deacon wrote:
> > On Wed, Jan 27, 2021 at 09:56:53AM -0800, Lakshmi Ramasubramanian wrote:
> >> On 1/27/21 8:54 AM, Will Deacon wrote:
> >>> On Fri, Jan 15, 2021 at 09:30:17AM -0800, Lakshmi Ramasubramanian wrote:
> >>>> Address and size of the buffer containing the IMA measurement log need
> >>>> to be passed from the current kernel to the next kernel on kexec.
> >>>>
> >>>> Add address and size fields to "struct kimage_arch" for ARM64 platform
> >>>> to hold the address and size of the IMA measurement log buffer.
> >>>>
> >>>> Update CONFIG_KEXEC_FILE to select CONFIG_HAVE_IMA_KEXEC, if CONFIG_IMA
> >>>> is enabled, to indicate that the IMA measurement log information is
> >>>> present in the device tree for ARM64.
> >>>>
> >>>> Co-developed-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
> >>>> Signed-off-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
> >>>> Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
> >>>> Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
> >>>> ---
> >>>>    arch/arm64/Kconfig             | 1 +
> >>>>    arch/arm64/include/asm/kexec.h | 5 +++++
> >>>>    2 files changed, 6 insertions(+)
> >>>>
> >>>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> >>>> index 1d466addb078..ea7f7fe3dccd 100644
> >>>> --- a/arch/arm64/Kconfig
> >>>> +++ b/arch/arm64/Kconfig
> >>>> @@ -1094,6 +1094,7 @@ config KEXEC
> >>>>    config KEXEC_FILE
> >>>>    	bool "kexec file based system call"
> >>>>    	select KEXEC_CORE
> >>>> +	select HAVE_IMA_KEXEC if IMA
> >>>>    	help
> >>>>    	  This is new version of kexec system call. This system call is
> >>>>    	  file based and takes file descriptors as system call argument
> >>>> diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h
> >>>> index d24b527e8c00..2bd19ccb6c43 100644
> >>>> --- a/arch/arm64/include/asm/kexec.h
> >>>> +++ b/arch/arm64/include/asm/kexec.h
> >>>> @@ -100,6 +100,11 @@ struct kimage_arch {
> >>>>    	void *elf_headers;
> >>>>    	unsigned long elf_headers_mem;
> >>>>    	unsigned long elf_headers_sz;
> >>>> +
> >>>> +#ifdef CONFIG_IMA_KEXEC
> >>>> +	phys_addr_t ima_buffer_addr;
> >>>> +	size_t ima_buffer_size;
> >>>> +#endif
> >>>
> >>> Why do these need to be in the arch structure instead of 'struct kimage'?
> >>>
> >>
> >> Currently, only powerpc and, with this patch set, arm64 have support for
> >> carrying forward IMA measurement list across kexec system call. The above
> >> fields are used for tracking IMA measurement list.
> >>
> >> Do you see a reason to move these fields to "struct kimage"?
> > 
> > If they're gated on CONFIG_IMA_KEXEC, then it seems harmless for them to
> > be added to the shared structure. Or are you saying that there are
> > architectures which have CONFIG_IMA_KEXEC but do not want these fields?
> > 
> 
> As far as I know, there are no other architectures that define 
> CONFIG_IMA_KEXEC, but do not use these fields.

Yes, CONFIG_IMA_KEXEC enables "carrying the IMA measurement list across
a soft boot".   The only arch that currently carries the IMA
measurement across kexec is powerpc.

Mimi
Will Deacon Jan. 27, 2021, 11:13 p.m. UTC | #6
On Wed, Jan 27, 2021 at 01:31:02PM -0500, Mimi Zohar wrote:
> On Wed, 2021-01-27 at 10:24 -0800, Lakshmi Ramasubramanian wrote:
> > On 1/27/21 10:02 AM, Will Deacon wrote:
> > > On Wed, Jan 27, 2021 at 09:56:53AM -0800, Lakshmi Ramasubramanian wrote:
> > >> On 1/27/21 8:54 AM, Will Deacon wrote:
> > >>> On Fri, Jan 15, 2021 at 09:30:17AM -0800, Lakshmi Ramasubramanian wrote:
> > >>>> Address and size of the buffer containing the IMA measurement log need
> > >>>> to be passed from the current kernel to the next kernel on kexec.
> > >>>>
> > >>>> Add address and size fields to "struct kimage_arch" for ARM64 platform
> > >>>> to hold the address and size of the IMA measurement log buffer.
> > >>>>
> > >>>> Update CONFIG_KEXEC_FILE to select CONFIG_HAVE_IMA_KEXEC, if CONFIG_IMA
> > >>>> is enabled, to indicate that the IMA measurement log information is
> > >>>> present in the device tree for ARM64.
> > >>>>
> > >>>> Co-developed-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
> > >>>> Signed-off-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
> > >>>> Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
> > >>>> Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
> > >>>> ---
> > >>>>    arch/arm64/Kconfig             | 1 +
> > >>>>    arch/arm64/include/asm/kexec.h | 5 +++++
> > >>>>    2 files changed, 6 insertions(+)
> > >>>>
> > >>>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> > >>>> index 1d466addb078..ea7f7fe3dccd 100644
> > >>>> --- a/arch/arm64/Kconfig
> > >>>> +++ b/arch/arm64/Kconfig
> > >>>> @@ -1094,6 +1094,7 @@ config KEXEC
> > >>>>    config KEXEC_FILE
> > >>>>    	bool "kexec file based system call"
> > >>>>    	select KEXEC_CORE
> > >>>> +	select HAVE_IMA_KEXEC if IMA
> > >>>>    	help
> > >>>>    	  This is new version of kexec system call. This system call is
> > >>>>    	  file based and takes file descriptors as system call argument
> > >>>> diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h
> > >>>> index d24b527e8c00..2bd19ccb6c43 100644
> > >>>> --- a/arch/arm64/include/asm/kexec.h
> > >>>> +++ b/arch/arm64/include/asm/kexec.h
> > >>>> @@ -100,6 +100,11 @@ struct kimage_arch {
> > >>>>    	void *elf_headers;
> > >>>>    	unsigned long elf_headers_mem;
> > >>>>    	unsigned long elf_headers_sz;
> > >>>> +
> > >>>> +#ifdef CONFIG_IMA_KEXEC
> > >>>> +	phys_addr_t ima_buffer_addr;
> > >>>> +	size_t ima_buffer_size;
> > >>>> +#endif
> > >>>
> > >>> Why do these need to be in the arch structure instead of 'struct kimage'?
> > >>>
> > >>
> > >> Currently, only powerpc and, with this patch set, arm64 have support for
> > >> carrying forward IMA measurement list across kexec system call. The above
> > >> fields are used for tracking IMA measurement list.
> > >>
> > >> Do you see a reason to move these fields to "struct kimage"?
> > > 
> > > If they're gated on CONFIG_IMA_KEXEC, then it seems harmless for them to
> > > be added to the shared structure. Or are you saying that there are
> > > architectures which have CONFIG_IMA_KEXEC but do not want these fields?
> > > 
> > 
> > As far as I know, there are no other architectures that define 
> > CONFIG_IMA_KEXEC, but do not use these fields.
> 
> Yes, CONFIG_IMA_KEXEC enables "carrying the IMA measurement list across
> a soft boot".   The only arch that currently carries the IMA
> measurement across kexec is powerpc.

Ok, in which case this sounds like it should be in the shared structure, no?

Will
Lakshmi Ramasubramanian Jan. 28, 2021, 4:05 a.m. UTC | #7
On 1/27/21 3:13 PM, Will Deacon wrote:
> On Wed, Jan 27, 2021 at 01:31:02PM -0500, Mimi Zohar wrote:
>> On Wed, 2021-01-27 at 10:24 -0800, Lakshmi Ramasubramanian wrote:
>>> On 1/27/21 10:02 AM, Will Deacon wrote:
>>>> On Wed, Jan 27, 2021 at 09:56:53AM -0800, Lakshmi Ramasubramanian wrote:
>>>>> On 1/27/21 8:54 AM, Will Deacon wrote:
>>>>>> On Fri, Jan 15, 2021 at 09:30:17AM -0800, Lakshmi Ramasubramanian wrote:
>>>>>>> Address and size of the buffer containing the IMA measurement log need
>>>>>>> to be passed from the current kernel to the next kernel on kexec.
>>>>>>>
>>>>>>> Add address and size fields to "struct kimage_arch" for ARM64 platform
>>>>>>> to hold the address and size of the IMA measurement log buffer.
>>>>>>>
>>>>>>> Update CONFIG_KEXEC_FILE to select CONFIG_HAVE_IMA_KEXEC, if CONFIG_IMA
>>>>>>> is enabled, to indicate that the IMA measurement log information is
>>>>>>> present in the device tree for ARM64.
>>>>>>>
>>>>>>> Co-developed-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
>>>>>>> Signed-off-by: Prakhar Srivastava <prsriva@linux.microsoft.com>
>>>>>>> Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
>>>>>>> Reviewed-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
>>>>>>> ---
>>>>>>>     arch/arm64/Kconfig             | 1 +
>>>>>>>     arch/arm64/include/asm/kexec.h | 5 +++++
>>>>>>>     2 files changed, 6 insertions(+)
>>>>>>>
>>>>>>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>>>>>>> index 1d466addb078..ea7f7fe3dccd 100644
>>>>>>> --- a/arch/arm64/Kconfig
>>>>>>> +++ b/arch/arm64/Kconfig
>>>>>>> @@ -1094,6 +1094,7 @@ config KEXEC
>>>>>>>     config KEXEC_FILE
>>>>>>>     	bool "kexec file based system call"
>>>>>>>     	select KEXEC_CORE
>>>>>>> +	select HAVE_IMA_KEXEC if IMA
>>>>>>>     	help
>>>>>>>     	  This is new version of kexec system call. This system call is
>>>>>>>     	  file based and takes file descriptors as system call argument
>>>>>>> diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h
>>>>>>> index d24b527e8c00..2bd19ccb6c43 100644
>>>>>>> --- a/arch/arm64/include/asm/kexec.h
>>>>>>> +++ b/arch/arm64/include/asm/kexec.h
>>>>>>> @@ -100,6 +100,11 @@ struct kimage_arch {
>>>>>>>     	void *elf_headers;
>>>>>>>     	unsigned long elf_headers_mem;
>>>>>>>     	unsigned long elf_headers_sz;
>>>>>>> +
>>>>>>> +#ifdef CONFIG_IMA_KEXEC
>>>>>>> +	phys_addr_t ima_buffer_addr;
>>>>>>> +	size_t ima_buffer_size;
>>>>>>> +#endif
>>>>>>
>>>>>> Why do these need to be in the arch structure instead of 'struct kimage'?
>>>>>>
>>>>>
>>>>> Currently, only powerpc and, with this patch set, arm64 have support for
>>>>> carrying forward IMA measurement list across kexec system call. The above
>>>>> fields are used for tracking IMA measurement list.
>>>>>
>>>>> Do you see a reason to move these fields to "struct kimage"?
>>>>
>>>> If they're gated on CONFIG_IMA_KEXEC, then it seems harmless for them to
>>>> be added to the shared structure. Or are you saying that there are
>>>> architectures which have CONFIG_IMA_KEXEC but do not want these fields?
>>>>
>>>
>>> As far as I know, there are no other architectures that define
>>> CONFIG_IMA_KEXEC, but do not use these fields.
>>
>> Yes, CONFIG_IMA_KEXEC enables "carrying the IMA measurement list across
>> a soft boot".   The only arch that currently carries the IMA
>> measurement across kexec is powerpc.
> 
> Ok, in which case this sounds like it should be in the shared structure, no?
> 

Ok - I'll move the IMA kexec buffer fields from "struct kimage_arch" to 
"struct kimage" for both powerpc and arm64.

thanks,
  -lakshmi
diff mbox series

Patch

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 1d466addb078..ea7f7fe3dccd 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1094,6 +1094,7 @@  config KEXEC
 config KEXEC_FILE
 	bool "kexec file based system call"
 	select KEXEC_CORE
+	select HAVE_IMA_KEXEC if IMA
 	help
 	  This is new version of kexec system call. This system call is
 	  file based and takes file descriptors as system call argument
diff --git a/arch/arm64/include/asm/kexec.h b/arch/arm64/include/asm/kexec.h
index d24b527e8c00..2bd19ccb6c43 100644
--- a/arch/arm64/include/asm/kexec.h
+++ b/arch/arm64/include/asm/kexec.h
@@ -100,6 +100,11 @@  struct kimage_arch {
 	void *elf_headers;
 	unsigned long elf_headers_mem;
 	unsigned long elf_headers_sz;
+
+#ifdef CONFIG_IMA_KEXEC
+	phys_addr_t ima_buffer_addr;
+	size_t ima_buffer_size;
+#endif
 };
 
 extern const struct kexec_file_ops kexec_image_ops;