From owner-svn-src-stable@FreeBSD.ORG Mon May 25 14:36:21 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 764BF1065670; Mon, 25 May 2009 14:36:21 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62B068FC15; Mon, 25 May 2009 14:36:21 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n4PEaLwd026521; Mon, 25 May 2009 14:36:21 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4PEaL72026517; Mon, 25 May 2009 14:36:21 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <200905251436.n4PEaL72026517@svn.freebsd.org> From: Dmitry Chagin Date: Mon, 25 May 2009 14:36:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r192759 - in stable/7/sys: . compat/linux contrib/pf dev/ath/ath_hal dev/cxgb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 14:36:22 -0000 Author: dchagin Date: Mon May 25 14:36:21 2009 New Revision: 192759 URL: http://svn.freebsd.org/changeset/base/192759 Log: Merge r191269 from HEAD to stable/7: Remove support for FUTEX_REQUEUE operation. Glibc does not use this operation since 2.3.3 version (Jun 2004), as it is racy and replaced by FUTEX_CMP_REQUEUE operation. Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when FUTEX_REQUEUE returned EINVAL. Any application directly using FUTEX_REQUEUE without return value checking are definitely broken. Limit quantity of messages per process about unsupported operation. Approved by: kib(mentor) Modified: stable/7/sys/ (props changed) stable/7/sys/compat/linux/linux_emul.c stable/7/sys/compat/linux/linux_emul.h stable/7/sys/compat/linux/linux_futex.c stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/ath/ath_hal/ (props changed) stable/7/sys/dev/cxgb/ (props changed) Modified: stable/7/sys/compat/linux/linux_emul.c ============================================================================== --- stable/7/sys/compat/linux/linux_emul.c Mon May 25 13:52:51 2009 (r192758) +++ stable/7/sys/compat/linux/linux_emul.c Mon May 25 14:36:21 2009 (r192759) @@ -86,6 +86,7 @@ linux_proc_init(struct thread *td, pid_t em = malloc(sizeof *em, M_LINUX, M_WAITOK | M_ZERO); em->pid = child; em->pdeath_signal = 0; + em->used_requeue = 0; em->robust_futexes = NULL; if (flags & LINUX_CLONE_THREAD) { /* handled later in the code */ Modified: stable/7/sys/compat/linux/linux_emul.h ============================================================================== --- stable/7/sys/compat/linux/linux_emul.h Mon May 25 13:52:51 2009 (r192758) +++ stable/7/sys/compat/linux/linux_emul.h Mon May 25 14:36:21 2009 (r192759) @@ -51,6 +51,7 @@ struct linux_emuldata { struct linux_emuldata_shared *shared; int pdeath_signal; /* parent death signal */ + int used_requeue; /* uses deprecated futex op */ struct linux_robust_list_head *robust_futexes; Modified: stable/7/sys/compat/linux/linux_futex.c ============================================================================== --- stable/7/sys/compat/linux/linux_futex.c Mon May 25 13:52:51 2009 (r192758) +++ stable/7/sys/compat/linux/linux_futex.c Mon May 25 14:36:21 2009 (r192759) @@ -114,6 +114,7 @@ linux_sys_futex(struct thread *td, struc struct timeval tv = {0, 0}; struct futex *f2; int op_ret; + struct linux_emuldata *em; #ifdef DEBUG if (ldebug(sys_futex)) @@ -262,19 +263,6 @@ linux_sys_futex(struct thread *td, struc FUTEX_SYSTEM_UNLOCK; break; - case LINUX_FUTEX_REQUEUE: - FUTEX_SYSTEM_LOCK; - - f = futex_get(args->uaddr, FUTEX_UNLOCKED); - newf = futex_get(args->uaddr2, FUTEX_UNLOCKED); - td->td_retval[0] = futex_wake(f, args->val, newf, - (int)(unsigned long)args->timeout); - futex_put(f); - futex_put(newf); - - FUTEX_SYSTEM_UNLOCK; - break; - case LINUX_FUTEX_WAKE_OP: FUTEX_SYSTEM_LOCK; #ifdef DEBUG @@ -342,6 +330,23 @@ linux_sys_futex(struct thread *td, struc /* not yet implemented */ return (ENOSYS); + case LINUX_FUTEX_REQUEUE: + + /* + * Glibc does not use this operation since Jun 2004 (2.3.3), + * as it is racy and replaced by FUTEX_CMP_REQUEUE operation. + * Glibc versions prior to 2.3.3 fall back to FUTEX_WAKE when + * FUTEX_REQUEUE returned EINVAL. + */ + em = em_find(td->td_proc, EMUL_DONTLOCK); + if (em->used_requeue == 0) { + printf("linux(%s (%d)) sys_futex: " + "unsupported futex_requeue op\n", + td->td_proc->p_comm, td->td_proc->p_pid); + em->used_requeue = 1; + } + return (EINVAL); + default: printf("linux_sys_futex: unknown op %d\n", args->op);