From owner-svn-src-head@FreeBSD.ORG Tue Oct 14 07:59:23 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89184106569B; Tue, 14 Oct 2008 07:59:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 76AE38FC19; Tue, 14 Oct 2008 07:59:23 +0000 (UTC) (envelope-from kib@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 m9E7xNhO099432; Tue, 14 Oct 2008 07:59:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9E7xNwX099428; Tue, 14 Oct 2008 07:59:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200810140759.m9E7xNwX099428@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 14 Oct 2008 07:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183871 - in head/sys: amd64/linux32 compat/linux i386/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 07:59:23 -0000 Author: kib Date: Tue Oct 14 07:59:23 2008 New Revision: 183871 URL: http://svn.freebsd.org/changeset/base/183871 Log: Make robust futexes work on linux32/amd64. Use PTRIN to read user-mode pointers. Change types used in the structures definitions to properly-sized architecture-specific types. Submitted by: dchagin MFC after: 1 week Modified: head/sys/amd64/linux32/linux.h head/sys/compat/linux/linux_futex.c head/sys/compat/linux/linux_futex.h head/sys/i386/linux/linux.h Modified: head/sys/amd64/linux32/linux.h ============================================================================== --- head/sys/amd64/linux32/linux.h Tue Oct 14 07:58:18 2008 (r183870) +++ head/sys/amd64/linux32/linux.h Tue Oct 14 07:59:23 2008 (r183871) @@ -880,4 +880,15 @@ typedef int l_mqd_t; (LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES | \ LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD) +/* robust futexes */ +struct linux_robust_list { + l_uintptr_t next; +}; + +struct linux_robust_list_head { + struct linux_robust_list list; + l_ulong futex_offset; + l_uintptr_t pending_list; +}; + #endif /* !_AMD64_LINUX_H_ */ Modified: head/sys/compat/linux/linux_futex.c ============================================================================== --- head/sys/compat/linux/linux_futex.c Tue Oct 14 07:58:18 2008 (r183870) +++ head/sys/compat/linux/linux_futex.c Tue Oct 14 07:59:23 2008 (r183871) @@ -661,17 +661,17 @@ release_futexes(struct proc *p) if (head == NULL) return; - if (fetch_robust_entry(&entry, &head->list.next, &pi)) + if (fetch_robust_entry(&entry, PTRIN(&head->list.next), &pi)) return; if (copyin(&head->futex_offset, &futex_offset, sizeof(l_ulong))) return; - if (fetch_robust_entry(&pending, &head->pending_list, &pip)) + if (fetch_robust_entry(&pending, PTRIN(&head->pending_list), &pip)) return; while (entry != &head->list) { - rc = fetch_robust_entry(&next_entry, &entry->next, &next_pi); + rc = fetch_robust_entry(&next_entry, PTRIN(&entry->next), &next_pi); if (entry != pending) if (handle_futex_death((char *)entry + futex_offset, Modified: head/sys/compat/linux/linux_futex.h ============================================================================== --- head/sys/compat/linux/linux_futex.h Tue Oct 14 07:58:18 2008 (r183870) +++ head/sys/compat/linux/linux_futex.h Tue Oct 14 07:59:23 2008 (r183871) @@ -63,18 +63,6 @@ #define FUTEX_OP_CMP_GT 4 /* if (oldval > CMPARG) wake */ #define FUTEX_OP_CMP_GE 5 /* if (oldval >= CMPARG) wake */ -/* This is defined by Linux user-space */ - -struct linux_robust_list { - struct linux_robust_list *next; -}; - -struct linux_robust_list_head { - struct linux_robust_list list; - l_ulong futex_offset; - struct linux_robust_list *pending_list; -}; - #define FUTEX_WAITERS 0x80000000 #define FUTEX_OWNER_DIED 0x40000000 #define FUTEX_TID_MASK 0x3fffffff Modified: head/sys/i386/linux/linux.h ============================================================================== --- head/sys/i386/linux/linux.h Tue Oct 14 07:58:18 2008 (r183870) +++ head/sys/i386/linux/linux.h Tue Oct 14 07:59:23 2008 (r183871) @@ -845,4 +845,15 @@ typedef int l_mqd_t; (LINUX_CLONE_VM | LINUX_CLONE_FS | LINUX_CLONE_FILES | \ LINUX_CLONE_SIGHAND | LINUX_CLONE_THREAD) +/* robust futexes */ +struct linux_robust_list { + struct linux_robust_list *next; +}; + +struct linux_robust_list_head { + struct linux_robust_list list; + l_ulong futex_offset; + struct linux_robust_list *pending_list; +}; + #endif /* !_I386_LINUX_H_ */