1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
From ffd2585ef162a6dcc42011a33bd69687048ab4a8 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Sat, 11 May 2019 19:38:13 -0700
Subject: [PATCH] arm64: Prevent stack clobber when passing structures < 8
bytes
---
arm64/abi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arm64/abi.c b/arm64/abi.c
index f5b605a..4e80db2 100644
--- a/arm64/abi.c
+++ b/arm64/abi.c
@@ -308,12 +308,14 @@ stkblob(Ref r, Class *c, Fn *fn, Insl **ilp)
{
Insl *il;
int al;
+ uint64_t sz;
il = alloc(sizeof *il);
al = c->t->align - 2; /* NAlign == 3 */
if (al < 0)
al = 0;
- il->i = (Ins){Oalloc+al, Kl, r, {getcon(c->t->size, fn)}};
+ sz = c->class & Cptr ? c->t->size : c->size;
+ il->i = (Ins){Oalloc+al, Kl, r, {getcon(sz, fn)}};
il->link = *ilp;
*ilp = il;
}
--
2.21.0
|