~mpu/qbe

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] Fix IBT/BTI by instrumenting function calls

Details
Message ID
<20231203163504.45696-1-me@tobhe.de>
DKIM signature
missing
Download raw message
Patch: +4 -0
---
This is needed to work with struct BTI enforcement as is the default
now on OpenBSD. The instructions should evaluate to nops on non-supported
hardware.

The reason I use hint #34 instead of bti c for arm64 is that the gnu
assembler doesn't like bti instructions unless it is explicitly enabled,
see https://reviews.llvm.org/D81257

 amd64/emit.c | 2 ++
 arm64/emit.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/amd64/emit.c b/amd64/emit.c
index 297cc76..a39b1b6 100644
--- a/amd64/emit.c
+++ b/amd64/emit.c
@@ -581,6 +581,8 @@ amd64_emitfn(Fn *fn, FILE *f)
	uint64_t fs;

	emitfnlnk(fn->name, &fn->lnk, f);
	/* ibt */
	fputs("\tendbr64\n", f);
	fputs("\tpushq %rbp\n\tmovq %rsp, %rbp\n", f);
	fs = framesz(fn);
	if (fs)
diff --git a/arm64/emit.c b/arm64/emit.c
index 78a0358..0c121cb 100644
--- a/arm64/emit.c
+++ b/arm64/emit.c
@@ -514,6 +514,8 @@ arm64_emitfn(Fn *fn, FILE *out)
	if (T.apple)
		e->fn->lnk.align = 4;
	emitfnlnk(e->fn->name, &e->fn->lnk, e->f);
	/* bti */
	fputs("\thint\t#34\n", e->f);
	framelayout(e);

	if (e->fn->vararg && !T.apple) {
-- 
2.43.0
Details
Message ID
<4f3390ef-d7e4-4ea0-82c5-8a1c79655c03@app.fastmail.com>
In-Reply-To
<20231203163504.45696-1-me@tobhe.de> (view parent)
DKIM signature
missing
Download raw message
Thanks, it's applied and pushed to master.
Reply to thread Export thread (mbox)