From nobody@FreeBSD.org  Wed Sep 26 22:08:13 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id 4DFDF37B426
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 26 Sep 2001 22:08:13 -0700 (PDT)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.4/8.11.4) id f8R58DG21377;
	Wed, 26 Sep 2001 22:08:13 -0700 (PDT)
	(envelope-from nobody)
Message-Id: <200109270508.f8R58DG21377@freefall.freebsd.org>
Date: Wed, 26 Sep 2001 22:08:13 -0700 (PDT)
From: Marcel Moolenaar <marcel@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Linuxulator: stackgap does not handle recursion from interrupted syscalls.
X-Send-Pr-Version: www-1.0

>Number:         30861
>Category:       kern
>Synopsis:       Linuxulator: stackgap does not handle recursion from interrupted syscalls.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    marcel
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 26 22:10:00 PDT 2001
>Closed-Date:    Sun Nov 18 10:59:45 PST 2001
>Last-Modified:  Sun Nov 18 11:03:29 PST 2001
>Originator:     Marcel Moolenaar
>Release:        -current & -stable
>Organization:
FreeBSD
>Environment:
>Description:
Peter says:

Ever wonder why things crash for no apparent reason?  I think I know why.
 
Check out the stackgap_alloc() stuff.  Then think about linuxthreads
where multiple processes are using the same stack gap.  Think what happens
when one process does a translated syscall, blocks, and another one does
a syscall and reuses the same gap space. :-(

Solutions are ugly. :-(

Possible solution 1:
  make the stackgap_*() functions reentrant and alloc/free the space.
  downside: we presently have a small gap space and dont "free" the
  gap space.  We could run out of space easily.

Possible solution 2:
  Use space below the user stack.  We may have to do this.  This is nasty
  too, because we will have to assume that there is nothing below the
  user stack %esp.

Possible solution 3:
  Put a lock around stackgap functions so that translated syscalls are
  not reentrant.  This is really nasty as it single threads linuxthreads
  syscalls.

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->marcel 
Responsible-Changed-By: marcel 
Responsible-Changed-When: Wed Sep 26 22:20:04 PDT 2001 
Responsible-Changed-Why:  
Note to self 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30861 
State-Changed-From-To: open->closed 
State-Changed-By: marcel 
State-Changed-When: Sun Nov 18 10:59:45 PST 2001 
State-Changed-Why:  
Close this out since it was mostly a note to myself. It doesn't 
contain a trigger case or a patch so it's not expected that it 
will do much good in it's current form. A comment in the code 
would be more effective, because there it will be seen. 


http://www.FreeBSD.org/cgi/query-pr.cgi?pr=30861 
>Unformatted:
