From owner-freebsd-sparc64@FreeBSD.ORG Fri Nov 13 09:00:13 2009 Return-Path: Delivered-To: freebsd-sparc64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D696B106568B for ; Fri, 13 Nov 2009 09:00:13 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 9B3C48FC1A for ; Fri, 13 Nov 2009 09:00:13 +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 nAD907mI082827 for ; Fri, 13 Nov 2009 09:00:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nAD907rv082826; Fri, 13 Nov 2009 09:00:07 GMT (envelope-from gnats) Resent-Date: Fri, 13 Nov 2009 09:00:07 GMT Resent-Message-Id: <200911130900.nAD907rv082826@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-sparc64@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Nathaniel Filardo Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AD0E1065676 for ; Fri, 13 Nov 2009 08:53:46 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 0ADC68FC08 for ; Fri, 13 Nov 2009 08:53:46 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id nAD8rjgb068314 for ; Fri, 13 Nov 2009 08:53:45 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id nAD8rjHV068307; Fri, 13 Nov 2009 08:53:45 GMT (envelope-from nobody) Message-Id: <200911130853.nAD8rjHV068307@www.freebsd.org> Date: Fri, 13 Nov 2009 08:53:45 GMT From: Nathaniel Filardo To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: sparc64/140523: sparc {set, swap}context calls trash TLS register %g7 X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2009 09:00:13 -0000 >Number: 140523 >Category: sparc64 >Synopsis: sparc {set,swap}context calls trash TLS register %g7 >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-sparc64 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Nov 13 09:00:07 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Nathaniel Filardo >Release: 9.0-CURRENT >Organization: >Environment: FreeBSD hydra.priv.oc.ietfng.org 9.0-CURRENT FreeBSD 9.0-CURRENT #12: Mon Oct 26 02:37:54 EDT 2009 root@hydra.priv.oc.ietfng.org:/systank/obj/systank/src/sys/NWFKERN sparc64 >Description: The FreeBSD sparc64 implementation of {set,swap}context() will trash the Thread Local Storage register (%g7), making migration of contexts across threads unsafe. This breaks plan9port, at least. The same problem existed in Linux; see http://sourceware.org/bugzilla/show_bug.cgi?id=6577 for my report there. >How-To-Repeat: Attempt to setcontext() in one pthread the result of getcontext() in another thread. Suddenly pthread_self() will return as if running on the other thread. >Fix: Don't restore %g7 from the stored context. >Release-Note: >Audit-Trail: >Unformatted: