tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH v4 2/4] Fix alignment when reading core notes



> Date: Tue, 24 Dec 2019 07:52:14 +0100
> From: Micha�  Górny <mgorny%gentoo.org@localhost>
> 
> On Mon, 2019-12-23 at 16:17 +0000, Christos Zoulas wrote:
> > In article <20191222164104.165346-2-mgorny%gentoo.org@localhost>,
> > Micha�  Górny  <mgorny%gentoo.org@localhost> wrote:
> > > Both desc and note header needs to be aligned.  Therefore, we need
> > > to realign after skipping past desc as well.
> > 
> > Should probably be done with a standard alignment macro?
> 
> Could you be more specific?  I don't see any macro that would accept
> actual alignment value.  Well, besides STACK_ALIGN() but that seems to
> do some weird casting, so I presume it's not semantically correct here.

Instead of

+			offset = ((offset + core_hdr.p_align - 1)
+			    / core_hdr.p_align) * core_hdr.p_align;

do

+			offset = roundup(offset, core_hdr.p_align);


Home | Main Index | Thread Index | Old Index