[prev in list] [next in list] [prev in thread] [next in thread]
List: freebsd-bugs
Subject: kern/186236: sigcode not synced on executable stack on icache not coherent archs
From: Svatopluk Kraus <onwahe () gmail ! com>
Date: 2014-01-29 14:03:25
Message-ID: 201401291403.s0TE3PVi032056 () oldred ! freebsd ! org
[Download RAW message or body]
> 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:
_______________________________________________
freebsd-bugs@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic