Date: Wed, 29 Jan 2014 14:03:25 GMT From: Svatopluk Kraus <onwahe@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/186236: sigcode not synced on executable stack on icache not coherent archs Message-ID: <201401291403.s0TE3PVi032056@oldred.freebsd.org> Resent-Message-ID: <201401291410.s0TEA06Q065129@freefall.freebsd.org>
index | next in thread | raw e-mail
>Number: 186236
>Category: kern
>Synopsis: sigcode not synced on executable stack on icache not coherent archs
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Jan 29 14:10:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator: Svatopluk Kraus
>Release: current
>Organization:
>Environment:
>Description:
When sigcode (signal trampoline) is copied to user stack during exec, no icache syncing is called. This is problem on architectures where icache is not coherent.
>How-To-Repeat:
I have noticed the problem after fork(), when parent process was immediately sending signal to child process. As a cache problem, the problem displayed itself rarely.
>Fix:
I'm attaching simple patch. Another approche is to map user stack without exec privilege, copy sigcode, and then remap the stack with exec privilege.
Patch attached with submission follows:
Index: sys/kern/kern_exec.c
===================================================================
--- sys/kern/kern_exec.c (revision 261262)
+++ sys/kern/kern_exec.c (working copy)
@@ -1264,9 +1264,12 @@
/*
* install sigcode
*/
- if (szsigcode != 0)
+ if (szsigcode != 0) {
copyout(p->p_sysent->sv_sigcode, ((caddr_t)arginfo -
szsigcode), szsigcode);
+ vm_sync_icache(&(p->p_vmspace->vm_map), ((vm_offset_t)arginfo -
+ szsigcode), szsigcode);
+ }
/*
* Copy the image path for the rtld.
>Release-Note:
>Audit-Trail:
>Unformatted:
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401291403.s0TE3PVi032056>
