tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: updating COMPAT_LINUX for linux 2.6.x support (take 2)



Hello,

Chuck Silvers <chuq%chuq.com@localhost> wrote:
> 
> I rewrote my COMPAT_LINUX changes using the 1-proc-many-LWPs model.
> the patch is at:
> 
> ftp://ftp.netbsd.org/pub/NetBSD/misc/chs/linux/diff.linux-nptl-take2.23
> 

I like this patch a lot!  Especially good clean-ups, as a result.
Few comments:

- Thanks for implementing ucas_*() for extra architectures.  This is
  planned to be used for POSIX shared synchronisation primitives, thus
  become a public API.  In the longer term, LINUX_UCAS_INT_UP should be
  moved to generic code or, preferably, die.

- From proc_alloc():

-       /* allocate next free pid */
+       p->p_pid = proc_alloc_pid(p);
+       kdtrace_proc_ctor(NULL, p);
+       mutex_exit(proc_lock);
+       return p;

The kdtrace_proc_ctor() should not allocate memory with proc_lock held.
Neither it needs to be called late - I fixed this on HEAD, so proc_lock
can now be released by proc_alloc_pid().

- From linux_clone_nptl():

+       lwp_lock(l2);
+       if ((l->l_flag & (LW_WREBOOT | LW_WSUSPEND | LW_WEXIT)) == 0) {
+               if (p->p_stat == SSTOP || (p->p_sflag & PS_STOPPING) != 0)
+                       l2->l_stat = LSSTOP;
+               else {

This needs lwp_unlock_to(l2, spc->spc_lwplock), as LSSTOP state is protected
by this lock.  This is also broken in sys__lwp_create() - will fix it shortly.

- From sys_obreak():

+       new = round_page((vaddr_t)SCARG(uap, nsize));
+       if (new == 0) {
+               return ENOMEM;
+       }

IIRC, some architectures check for zero from assembly in libc stubs, before
going to the syscall.

Thanks.

-- 
Mindaugas


Home | Main Index | Thread Index | Old Index