Commit Graph

17 Commits

Author SHA1 Message Date
Martin Storsjö
ed7d73355e checkasm: aarch64: Check for stack overflows
Also fill x8-x17 with garbage before calling the function.

Figure out the number of stack parameters and make sure that the
value on the stack after those is untouched.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-15 21:22:36 +03:00
Martin Storsjö
89cf9e1fb6 checkasm: arm: Make the indentation consistent with other files
This makes it easier to share code with e.g. the dav1d implementation
of checkasm.

Signed-off-by: Martin Storsjö <martin@martin.st>
2020-05-15 21:22:27 +03:00
James Almer
122a749dfc Merge commit 'd05c9cde0e87c23ca42957646bea483dfc09d6bf'
* commit 'd05c9cde0e87c23ca42957646bea483dfc09d6bf':
  checkasm: aarch64: Specify alignment for the register_init const array

Merged-by: James Almer <jamrial@gmail.com>
2017-10-30 21:03:50 -03:00
Matthieu Bouron
067e42b851 checkasm/aarch64: fix tests returning a float
Avoids overriding the v0 register (which containins the result of the
tested function) in checkasm_call_checked.
2017-06-22 09:18:10 +02:00
Martin Storsjö
d05c9cde0e checkasm: aarch64: Specify alignment for the register_init const array
Loads from this strictly doesn't require alignment, but specify it
just for consistency with the arm version.

Signed-off-by: Martin Storsjö <martin@martin.st>
2017-05-15 10:19:46 +03:00
James Almer
0d34473d8e Merge commit 'dd5d4a0e1e3a30a254d1a57ecbdcedf230c6014b'
* commit 'dd5d4a0e1e3a30a254d1a57ecbdcedf230c6014b':
  checkasm: aarch64: Don't clobber x29 in checkasm_stack_clobber

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 18:31:36 -03:00
James Almer
f23078904f Merge commit '2816f8a8bb33bd67fec5e94f5d357918caf4e055'
* commit '2816f8a8bb33bd67fec5e94f5d357918caf4e055':
  build: Drop arch-specific checkasm Makefiles

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 18:01:47 -03:00
James Almer
67b639b496 Merge commit 'c91d6a33f872574c95c8784277cf60ffcf6bff4f'
* commit 'c91d6a33f872574c95c8784277cf60ffcf6bff4f':
  checkasm: aarch64: Add filler args to make sure all parameters are passed on the stack

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 17:38:20 -03:00
James Almer
a2d34cc51b Merge commit 'f1b3e131385176c3c9d9783b25047856a0dcebf6'
* commit 'f1b3e131385176c3c9d9783b25047856a0dcebf6':
  checkasm: aarch64: Clobber the stack before calling functions

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 17:36:53 -03:00
James Almer
cab4c7fa19 Merge commit 'a05cc56124b4f1237f6355784de821e3290ddb44'
* commit 'a05cc56124b4f1237f6355784de821e3290ddb44':
  checkasm: arm/aarch64: Fix the amount of space reserved for stack parameters

Merged-by: James Almer <jamrial@gmail.com>
2017-03-23 17:35:38 -03:00
Martin Storsjö
dd5d4a0e1e checkasm: aarch64: Don't clobber x29 in checkasm_stack_clobber
x29 (FP) is a callee saved register and should be restored on
return. Instead of backing up x29 and restoring it here, back up
sp in a register that we are allowed to overwrite.

This fixes crashes in checkasm on aarch64 since f1b3e13138.
For some reason, gcc builds didn't crash, but clang builds do.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-10-18 16:17:12 +03:00
Diego Biurrun
2816f8a8bb build: Drop arch-specific checkasm Makefiles
They only contain one line and will never contain more.
2016-10-17 16:25:38 +02:00
Martin Storsjö
c91d6a33f8 checkasm: aarch64: Add filler args to make sure all parameters are passed on the stack
This, combined with clobbering the stack space prior to the call,
increases the chances of finding cases where 32 bit parameters
are erroneously treated as 64 bit.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-10-16 23:26:33 +03:00
Martin Storsjö
f1b3e13138 checkasm: aarch64: Clobber the stack before calling functions
Signed-off-by: Martin Storsjö <martin@martin.st>
2016-10-16 23:26:22 +03:00
Martin Storsjö
a05cc56124 checkasm: arm/aarch64: Fix the amount of space reserved for stack parameters
Even if MAX_ARGS - 2 (for arm) or MAX_ARGS - 7 (for aarch64) parameters
are passed on the stack to checkasm_checked_call, we actually only
need to store MAX_ARGS - 4 (for arm) or MAX_ARGS - 8 (for aarch64)
parameters on the stack when calling the tested function.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-10-16 23:26:15 +03:00
Hendrik Leppkes
7e29903526 Merge commit 'fec76cd430f3c865183a6e5b4caec0743e055605'
* commit 'fec76cd430f3c865183a6e5b4caec0743e055605':
  checkasm: Check register clobbering on aarch64

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-19 08:50:44 +01:00
Martin Storsjö
fec76cd430 checkasm: Check register clobbering on aarch64
This is disabled on iOS, since iOS uses a slightly different ABI
for vararg parameters.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-01-07 09:33:24 +02:00