NetBSD Problem Report #29952

From ken@mitana.nanohz.org  Tue Apr 12 02:32:51 2005
Return-Path: <ken@mitana.nanohz.org>
Received: from mitana.nanohz.org (cp.64translator.com [202.214.123.2])
	by narn.netbsd.org (Postfix) with ESMTP id D0CC763B116
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 12 Apr 2005 02:32:50 +0000 (UTC)
Message-Id: <200504120233.j3C2XTRq019011@mitana.nanohz.org>
Date: Tue, 12 Apr 2005 11:33:29 +0900 (JST)
From: kamada@nanohz.org
Reply-To: kamada@nanohz.org
To: gnats-bugs@netbsd.org
Subject: How about adding pthread_equal() stub to libc?  (MIT krb5-1.4 fails)
X-Send-Pr-Version: 3.95

>Number:         29952
>Category:       lib
>Synopsis:       How about adding pthread_equal() stub to libc?  (MIT krb5-1.4 fails)
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 12 02:33:00 +0000 2005
>Closed-Date:    Tue Jul 04 03:49:06 +0000 2006
>Last-Modified:  Tue Jul 04 03:49:06 +0000 2006
>Originator:     KAMADA Ken'ichi
>Release:        NetBSD 3.99.2
>Organization:
>Environment:
System: NetBSD mitana.nanohz.org 3.99.2 NetBSD 3.99.2 (MITANA) #41: Mon Mar 28 11:04:24 JST 2005 ken@mitana.nanohz.org:/usr/src/sys/arch/i386/compile/MITANA i386
Architecture: i386
Machine: i386
>Description:
MIT krb5-1.4 uses pthread_equal(), so could you consider
adding pthread_equal() stub to libc (and pthread.h)?  I think that
unconditionally returning 1 is enough for non-threaded applications.

NetBSD's libc doesn't have a stub for pthread_equal(), but
MIT krb5 is weak-referencing pthread_equal().
Therefore the absense of pthread_equal() is not detected on the
link-time, and programs using krb5 mysteriously dies at run-time.
(unless the application is linked with libpthread)

>How-To-Repeat:
Install MIT krb5-1.4 (or pkgsrc/security/mit-krb5 1.4 or later) and
run kinit from it.

>Fix:

>Release-Note:

>Audit-Trail:
From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@netbsd.org, lib-bug-people@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc: 
Subject: Re: lib/29952: How about adding pthread_equal() stub to libc?  (MIT krb5-1.4 fails)
Date: Mon, 11 Apr 2005 22:43:47 -0400

 It is easy enough to add....

 http://www.opengroup.org/onlinepubs/007908799/xsh/pthread_equal.html

 christos

From: KAMADA Ken'ichi <kamada@nanohz.org>
To: gnats-bugs@netbsd.org
Cc: kamada@nanohz.org
Subject: Re: lib/29952
Date: Mon, 02 May 2005 18:24:51 +0900

 > >Description:
 > MIT krb5-1.4 uses pthread_equal(), so could you consider
 > adding pthread_equal() stub to libc (and pthread.h)?  I think that
 > unconditionally returning 1 is enough for non-threaded applications.


 Index: libc/thread-stub/thread-stub.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libc/thread-stub/thread-stub.c,v
 retrieving revision 1.12
 diff -u -r1.12 thread-stub.c
 --- libc/thread-stub/thread-stub.c	14 Dec 2004 00:21:40 -0000	1.12
 +++ libc/thread-stub/thread-stub.c	2 May 2005 09:14:02 -0000
 @@ -329,6 +329,7 @@
  int	__libc_thr_once_stub(once_t *, void (*)(void));
  int	__libc_thr_sigsetmask_stub(int, const sigset_t *, sigset_t *);
  thr_t	__libc_thr_self_stub(void);
 +int	__libc_thr_equal_stub(thr_t, thr_t);
  int	__libc_thr_yield_stub(void);
  int	__libc_thr_create_stub(thr_t *, const thrattr_t *,
  	    void *(*)(void *), void *);
 @@ -339,6 +340,7 @@
  __weak_alias(__libc_thr_once,__libc_thr_once_stub)
  __weak_alias(__libc_thr_sigsetmask,__libc_thr_sigsetmask_stub)
  __weak_alias(__libc_thr_self,__libc_thr_self_stub)
 +__weak_alias(__libc_thr_equal,__libc_thr_equal_stub)
  __weak_alias(__libc_thr_yield,__libc_thr_yield_stub)
  __weak_alias(__libc_thr_create,__libc_thr_create_stub)
  __weak_alias(__libc_thr_exit,__libc_thr_exit_stub)
 @@ -377,6 +379,18 @@
  }

  int
 +__libc_thr_equal_stub(thr_t t1, thr_t t2)
 +{
 +	/* LINTED deliberate lack of effect */
 +	(void)t1;
 +	/* LINTED deliberate lack of effect */
 +	(void)t2;
 +
 +	/* There is only one thread. */
 +	return 1;
 +}
 +
 +int
  __libc_thr_yield_stub(void)
  {

 Index: libpthread/pthread.h
 ===================================================================
 RCS file: /cvsroot/src/lib/libpthread/pthread.h,v
 retrieving revision 1.21
 diff -u -r1.21 pthread.h
 --- libpthread/pthread.h	21 Mar 2005 17:55:07 -0000	1.21
 +++ libpthread/pthread.h	2 May 2005 09:14:02 -0000
 @@ -344,12 +344,14 @@
  __BEGIN_DECLS
  int	__libc_thr_once(pthread_once_t *, void (*)(void));
  pthread_t	__libc_thr_self(void);
 +int	__libc_thr_equal(pthread_t, pthread_t);
  void	__libc_thr_exit(void *) __attribute__((__noreturn__));
  int	__libc_thr_setcancelstate(int, int *);
  __END_DECLS

  #define	pthread_once			__libc_thr_once
  #define	pthread_self			__libc_thr_self
 +#define	pthread_equal			__libc_thr_equal
  #define	pthread_exit			__libc_thr_exit
  #define	pthread_setcancelstate		__libc_thr_setcancelstate


 -- 
 KAMADA Ken'ichi

From: KAMADA Ken'ichi <kamada@nanohz.org>
To: gnats-bugs@NetBSD.org
Cc: kamada@nanohz.org
Subject: Re: lib/29952: How about adding pthread_equal() stub to libc?  (MIT krb5-1.4 fails)
Date: Tue, 04 Jul 2006 12:31:37 +0900

 At Tue, 12 Apr 2005 11:33:29 +0900 (JST),
 I wrote:
 > 
 > >Synopsis:      How about adding pthread_equal() stub to libc?  (MIT krb5-1.4 fails)

 Please close this PR (lib/29952), since the issue was dealt by mit-krb5.

 Thanks,
 -- 
 KAMADA Ken'ichi <kamada@nanohz.org>

State-Changed-From-To: open->closed
State-Changed-By: jnemeth@netbsd.org
State-Changed-When: Tue, 04 Jul 2006 03:49:06 +0000
State-Changed-Why:
Submitter requested it be closed as the problem is fixed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.