[PATCH v2] ARM: fix Thumb-2 bug in AES assembler code

Nicolas Pitre nicolas.pitre at linaro.org
Tue Sep 17 17:45:42 EDT 2013


On Tue, 17 Sep 2013, Ard Biesheuvel wrote:

> On 17 September 2013 20:34, Nicolas Pitre <nicolas.pitre at linaro.org> wrote:
> > On Tue, 17 Sep 2013, Ard Biesheuvel wrote:
> >
> >> Patch 638591c enabled building the AES assembler code in Thumb2 mode.
> >> However, this code used arithmetic involving PC rather than adr{l}
> >> instructions to generate PC-relative references to the lookup tables,
> >> and this break in Thumb mode due to the different PC offset.
> >>
> >> Use adr instructions instead.
> >>
> >> Signed-off-by: Ard Biesheuvel <ard.biesheuvel at linaro.org>
> >> ---
> >>
> >> v2:
> >> - use 'adr' instruction rather than explicit PC arithmetic
> >> - move the tables around so they are in range for 'adr' in each mode
> >>
> >>  arch/arm/crypto/aes-armv4.S | 388 ++++++++++++++++++++++----------------------
> >>  1 file changed, 193 insertions(+), 195 deletions(-)
> >
> > No no no.  NAK.
> >
> > This makes the patch completely unreviewable.  And unacceptable for
> > inclusion into the stable tree.
> >
> > Also, why do you have to move tables around?
> >
> 
> Well, my approach was to remove all the PC related arithmetic, but
> loading the address of the table itself using adr doesn't work in ARM
> as it's too far away, and adrl doesn't exist in Thumb.
> 
> > Isn't the following sufficient to fix the issue?
> >
> 
> Yes, this is obviously much less obtrusive, so much better.
> Should I respin my patch or should we just paste your diff into the
> patch system?
> (I will test it properly first, of course)

I don't think you need to repost this.

With regard to your comment about trying to stay as close as possible to 
the originating copy of the code... the best solution in this case would 
be to contribute back all those fixes to that other version.


Nicolas



More information about the linux-arm-kernel mailing list