From owner-freebsd-threads@FreeBSD.ORG Mon Oct 5 11:07:02 2009 Return-Path: Delivered-To: freebsd-threads@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 960701065692 for ; Mon, 5 Oct 2009 11:07:02 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 79D7C8FC19 for ; Mon, 5 Oct 2009 11:07:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n95B72jf088821 for ; Mon, 5 Oct 2009 11:07:02 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n95B719X088819 for freebsd-threads@FreeBSD.org; Mon, 5 Oct 2009 11:07:01 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 5 Oct 2009 11:07:01 GMT Message-Id: <200910051107.n95B719X088819@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-threads@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-threads@FreeBSD.org X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Oct 2009 11:07:02 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o threa/136345 threads Recursive read rwlocks in thread A cause deadlock with o threa/135673 threads databases/mysql50-server - MySQL query lock-ups on 7.2 p threa/135462 threads [PATCH] _thread_cleanupspecific() doesn't handle delet o threa/133734 threads 32 bit libthr failing pthread_create() o threa/128922 threads threads hang with xorg running o threa/127225 threads bug in lib/libthr/thread/thr_init.c o threa/122923 threads 'nice' does not prevent background process from steali o threa/121336 threads lang/neko threading ok on UP, broken on SMP (FreeBSD 7 o threa/118715 threads kse problem o threa/116668 threads can no longer use jdk15 with libthr on -stable SMP o threa/116181 threads /dev/io-related io access permissions are not propagat o threa/115211 threads pthread_atfork misbehaves in initial thread o threa/110636 threads [request] gdb(1): using gdb with multi thread applicat o threa/110306 threads apache 2.0 segmentation violation when calling gethost o threa/103975 threads Implicit loading/unloading of libpthread.so may crash o threa/101323 threads [patch] fork(2) in threaded programs broken. s threa/100815 threads FBSD 5.5 broke nanosleep in libc_r s threa/94467 threads send(), sendto() and sendmsg() are not correct in libc s threa/84483 threads problems with devel/nspr and -lc_r on 4.x o threa/83914 threads [libc] popen() doesn't work in static threaded program o threa/80992 threads abort() sometimes not caught by gdb depending on threa o threa/80435 threads panic on high loads o threa/79887 threads [patch] freopen() isn't thread-safe o threa/79683 threads svctcp_create() fails if multiple threads call at the s threa/76694 threads fork cause hang in dup()/close() function in child (-l s threa/76690 threads fork hang in child for -lc_r o threa/75374 threads pthread_kill() ignores SA_SIGINFO flag o threa/75273 threads FBSD 5.3 libpthread (KSE) bug o threa/72953 threads fork() unblocks blocked signals w/o PTHREAD_SCOPE_SYST o threa/70975 threads [sysvipc] unexpected and unreliable behaviour when usi s threa/69020 threads pthreads library leaks _gc_mutex s threa/49087 threads Signals lost in programs linked with libc_r s threa/48856 threads Setting SIGCHLD to SIG_IGN still leaves zombies under s threa/40671 threads pthread_cancel doesn't remove thread from condition qu s threa/39922 threads [threads] [patch] Threaded applications executed with s threa/37676 threads libc_r: msgsnd(), msgrcv(), pread(), pwrite() need wra s threa/34536 threads accept() blocks other threads s threa/32295 threads [libc_r] [patch] pthread(3) dont dequeue signals s threa/30464 threads pthread mutex attributes -- pshared s threa/24632 threads libc_r delicate deviation from libc in handling SIGCHL s threa/24472 threads libc_r does not honor SO_SNDTIMEO/SO_RCVTIMEO socket o 41 problems total. From owner-freebsd-threads@FreeBSD.ORG Mon Oct 5 17:17:31 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92AEF1065676 for ; Mon, 5 Oct 2009 17:17:31 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id 3FE8C8FC19 for ; Mon, 5 Oct 2009 17:17:31 +0000 (UTC) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 0D0BB1DD63B for ; Mon, 5 Oct 2009 19:17:30 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id EF109228CD; Mon, 5 Oct 2009 19:17:29 +0200 (CEST) Date: Mon, 5 Oct 2009 19:17:29 +0200 From: Jilles Tjoelker To: freebsd-threads@freebsd.org Message-ID: <20091005171729.GA2830@stack.nl> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="6TrnltStXW4iwmi0" Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Subject: review request: making openat(2) a cancellation point X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Oct 2009 17:17:31 -0000 --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline While implementing a faster, cleaner and more compliant getcwd(3) using *at functions, I noticed that openat() was not a cancellation point (unlike open()). I think that should be fixed first, both for its own sake and because getcwd() will need to use _openat. I created the attached patch. It seems to work, I can still compile and run non-threaded and threaded programs using openat() and I can cancel a thread blocked in openat() (such as trying to open a fifo). I can also use _openat in libc. However, I think some review is appropriate because it all looks fairly complicated. Because libkse and libc_r don't seem to be built, I have not updated them. Note that this will cause threaded 9.x binaries that use openat() to break on 8.x. This is to be expected. -- Jilles Tjoelker --6TrnltStXW4iwmi0 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="openat-cancel.patch" Index: lib/libc/include/namespace.h =================================================================== --- lib/libc/include/namespace.h (revision 197481) +++ lib/libc/include/namespace.h (working copy) @@ -80,6 +80,7 @@ #define listen _listen #define nanosleep _nanosleep #define open _open +#define openat _openat #define poll _poll #define pthread_atfork _pthread_atfork #define pthread_attr_destroy _pthread_attr_destroy Index: lib/libc/include/un-namespace.h =================================================================== --- lib/libc/include/un-namespace.h (revision 197481) +++ lib/libc/include/un-namespace.h (working copy) @@ -61,6 +61,7 @@ #undef listen #undef nanosleep #undef open +#undef openat #undef poll #undef pthread_atfork #undef pthread_attr_destroy Index: lib/libc/sys/Symbol.map =================================================================== --- lib/libc/sys/Symbol.map (revision 197481) +++ lib/libc/sys/Symbol.map (working copy) @@ -769,6 +769,8 @@ FBSDprivate_1.0 { __sys_olio_listio; _open; __sys_open; + _openat; + __sys_openat; _pathconf; __sys_pathconf; _pipe; Index: lib/libthr/pthread.map =================================================================== --- lib/libthr/pthread.map (revision 197481) +++ lib/libthr/pthread.map (working copy) @@ -195,6 +195,7 @@ FBSDprivate_1.0 { __msync; __nanosleep; __open; + __openat; __poll; __pthread_cond_timedwait; __pthread_cond_wait; @@ -406,3 +407,7 @@ FBSD_1.1 { pthread_mutex_setspinloops_np; pthread_mutex_setyieldloops_np; }; + +FBSD_1.2 { + openat; +}; Index: lib/libthr/thread/thr_syscalls.c =================================================================== --- lib/libthr/thread/thr_syscalls.c (revision 197481) +++ lib/libthr/thread/thr_syscalls.c (working copy) @@ -139,6 +139,7 @@ int __fsync(int); int __msync(void *, size_t, int); int __nanosleep(const struct timespec *, struct timespec *); int __open(const char *, int,...); +int __openat(int, const char *, int,...); int __poll(struct pollfd *, unsigned int, int); ssize_t __read(int, void *buf, size_t); ssize_t __readv(int, const struct iovec *, int); @@ -341,6 +342,33 @@ __open(const char *path, int flags,...) return ret; } +__weak_reference(__openat, openat); + +int +__openat(int fd, const char *path, int flags,...) +{ + struct pthread *curthread = _get_curthread(); + int ret; + int mode = 0; + va_list ap; + + _thr_cancel_enter(curthread); + + /* Check if the file is being created: */ + if (flags & O_CREAT) { + /* Get the creation mode: */ + va_start(ap, flags); + mode = va_arg(ap, int); + va_end(ap); + } + + ret = __sys_openat(fd, path, flags, mode); + + _thr_cancel_leave(curthread); + + return ret; +} + __weak_reference(__poll, poll); int Index: lib/libthr/thread/thr_private.h =================================================================== --- lib/libthr/thread/thr_private.h (revision 197481) +++ lib/libthr/thread/thr_private.h (working copy) @@ -668,6 +668,7 @@ void _pthread_cleanup_pop(int); #ifdef _SYS_FCNTL_H_ int __sys_fcntl(int, int, ...); int __sys_open(const char *, int, ...); +int __sys_openat(int, const char *, int, ...); #endif /* #include */ --6TrnltStXW4iwmi0-- From owner-freebsd-threads@FreeBSD.ORG Mon Oct 5 18:27:18 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76F3910656ED for ; Mon, 5 Oct 2009 18:27:18 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id 36F938FC1D for ; Mon, 5 Oct 2009 18:27:17 +0000 (UTC) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.14.3/8.14.3/NETPLEX) with ESMTP id n95IGfX9009391; Mon, 5 Oct 2009 14:16:41 -0400 (EDT) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.2.2 (mail.netplex.net [204.213.176.10]); Mon, 05 Oct 2009 14:16:41 -0400 (EDT) Date: Mon, 5 Oct 2009 14:16:41 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Jilles Tjoelker In-Reply-To: <20091005171729.GA2830@stack.nl> Message-ID: References: <20091005171729.GA2830@stack.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Content-ID: Content-Disposition: inline Cc: freebsd-threads@freebsd.org Subject: Re: review request: making openat(2) a cancellation point X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Oct 2009 18:27:18 -0000 On Mon, 5 Oct 2009, Jilles Tjoelker wrote: > While implementing a faster, cleaner and more compliant getcwd(3) using > *at functions, I noticed that openat() was not a cancellation point > (unlike open()). I think that should be fixed first, both for its own > sake and because getcwd() will need to use _openat. POSIX states that openat() is a cancellation point, so it should be changed accordingly. I have not reviewed th patch, but the intent is valid :-) > I created the attached patch. It seems to work, I can still compile and > run non-threaded and threaded programs using openat() and I can cancel a > thread blocked in openat() (such as trying to open a fifo). I can also > use _openat in libc. However, I think some review is appropriate because > it all looks fairly complicated. > > Because libkse and libc_r don't seem to be built, I have not updated > them. > > Note that this will cause threaded 9.x binaries that use openat() to > break on 8.x. This is to be expected. -- DE From owner-freebsd-threads@FreeBSD.ORG Fri Oct 9 16:08:14 2009 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F9251065693 for ; Fri, 9 Oct 2009 16:08:14 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 527248FC36 for ; Fri, 9 Oct 2009 16:08:14 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 052B246B0C; Fri, 9 Oct 2009 12:08:14 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 3A1CA8A026; Fri, 9 Oct 2009 12:08:13 -0400 (EDT) From: John Baldwin To: freebsd-threads@freebsd.org Date: Fri, 9 Oct 2009 10:38:34 -0400 User-Agent: KMail/1.9.7 References: <20091005171729.GA2830@stack.nl> In-Reply-To: <20091005171729.GA2830@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200910091038.34735.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Fri, 09 Oct 2009 12:08:13 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Jilles Tjoelker Subject: Re: review request: making openat(2) a cancellation point X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2009 16:08:14 -0000 On Monday 05 October 2009 1:17:29 pm Jilles Tjoelker wrote: > While implementing a faster, cleaner and more compliant getcwd(3) using > *at functions, I noticed that openat() was not a cancellation point > (unlike open()). I think that should be fixed first, both for its own > sake and because getcwd() will need to use _openat. >=20 > I created the attached patch. It seems to work, I can still compile and > run non-threaded and threaded programs using openat() and I can cancel a > thread blocked in openat() (such as trying to open a fifo). I can also > use _openat in libc. However, I think some review is appropriate because > it all looks fairly complicated. >=20 > Because libkse and libc_r don't seem to be built, I have not updated > them. >=20 > Note that this will cause threaded 9.x binaries that use openat() to > break on 8.x. This is to be expected. =46rom what I can tell the patch looks fine to me. =2D-=20 John Baldwin