RE: [Linux-ima-devel] [PATCH 1/7] ima: on soft reboot, restore the measurement list

From: David Laight
Date: Wed Aug 10 2016 - 17:14:07 EST


From: Linuxppc-dev [mailto:linuxppc-dev-bounces+david.laight=aculab.com@xxxxxxxxxxxxxxxx] On Behalf Of
> > > So given what you have above, you'd use something like:
> > >
> > > struct ima_kexec_hdr {
> > > u16 version;
> > > u16 _reserved0;
> > > u32 _reserved1;
> > > u64 buffer_size;
> > > u64 count;
> > > };
> > >
> > > cheers
> >
> > Thanks, I'll make this change.
>
> I would suggest:
>
> struct ima_kexec_hdr {
> u64 buffer_size;
> u64 count;
> u16 version;
> };
>
> and let the compiler add the proper padding, depending on the architecture. On
> 32bit machine we'll have 4 bytes smaller allocations (compared to 64bit) while
> retaining the same functionality.

AAAArrrrgggg.....

That doesn't work for 32bit applications on 64bit hosts.
The extra bytes will make 0 difference to the allocation cost and
lots to the processing.

David