Tuesday, October 11, 2022

Re: valgrind: mark broken

From: Theo Buehler <tb@theobuehler.org>
Date: Sat, 8 Oct 2022 11:46:36 +0200

> There are still a few syscall numbers that are missing or not quite
> right. I'll need a bit of time to think about the rest of your diff.
>
> --- vki-scnums-openbsd.h Sat Oct 8 11:32:14 2022
> +++ syscall.h Sat Oct 8 11:46:11 2022

Currently, valgrind exits immediately after launch. This is due to
the following commit. I am working on a solution to this, but it will
take some time.

commit 8db818c7f40fac08bddec07697f8f4afe76dcbaa
Author: deraadt <deraadt@openbsd.org>
Date: Sat Oct 8 16:58:34 2022 +0000

The signal trampoline and timekeep regions can be marked immutable
at
execve() time
ok kettenis

diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 761441cd2dd..af474ee7d8d 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.232 2022/10/07 14:59:39 deraadt Exp
$ */
+/* $OpenBSD: kern_exec.c,v 1.233 2022/10/08 16:58:34 deraadt Exp
$ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $
*/

/*-
@@ -863,6 +863,8 @@ exec_sigcode_map(struct process *pr)
uao_detach(sigobject);
return (ENOMEM);
}
+ uvm_map_immutable(&pr->ps_vmspace->vm_map, pr->ps_sigcode,
+ pr->ps_sigcode + round_page(sz), 1, "sig");

/* Calculate PC at point of sigreturn entry */
pr->ps_sigcoderet = pr->ps_sigcode + (sigcoderet - sigcode);
@@ -911,6 +913,8 @@ exec_timekeep_map(struct process *pr)
uao_detach(timekeep_object);
return (ENOMEM);
}
+ uvm_map_immutable(&pr->ps_vmspace->vm_map, pr->ps_timekeep,
+ pr->ps_timekeep + timekeep_sz, 1, "time");

return (0);
}
--
ASOU Masato

No comments:

Post a Comment