Subject: sa_register() in chroot: regression since newlock2 merge
To: None <current-users@netbsd.org>
From: Jukka Salmi <j+nbsd@2007.salmi.ch>
List: current-users
Date: 04/26/2007 18:44:53
--qMm9M+Fa2AknHoGS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hi,

since newlock2 was merged to HEAD building the OpenLDAP client package
(and probably others) from pkgsrc in a netbsd-3 chroot environment on
a -current NetBSD system fails because the configure script can't
"locate usable POSIX Threads". The relevant configure code snippet of
the failing test program is attached.

$ gcc -g -O2 -lpthread -o conftest2 conftest2.c
$ ktrace ./conftest2
Bad system call (core dumped)

# gdb ./conftest2 conftest2.core 
GNU gdb 5.3nb1
[...]
Core was generated by `conftest2'.
Program terminated with signal 12, Bad system call.
[...]
#0  0xbbb3559f in sa_register () from /usr/lib/libc.so.12
[...]
(gdb) bt
#0  0xbbb3559f in sa_register () from /usr/lib/libc.so.12
#1  0xbbbe26d4 in pthread__sa_start () from /usr/lib/libpthread.so.0
#2  0xbbbe5c20 in pthread_init () from /usr/lib/libpthread.so.0
#3  0xbbbe6159 in pthread_create () from /usr/lib/libpthread.so.0
#4  0x0804880f in main (argc=1, argv=0xbfbfeae4) at conftest2.c:31
#5  0x080485f6 in ___start ()
(gdb) quit

# kdump | tail
  4890 conftest2 CALL  mprotect(0xbb201000,0x1000,0)
  4890 conftest2 RET   mprotect 0
  4890 conftest2 CALL  getcontext(0xbfbfe390)
  4890 conftest2 RET   getcontext 0
  4890 conftest2 CALL  __sysctl(0xbfbfe568,2,0xbfbfe560,0xbfbfe564,0,0)
  4890 conftest2 RET   __sysctl 0
  4890 conftest2 CALL  sa_register
  4890 conftest2 RET   sa_register -1 errno 78 Function not implemented
  4890 conftest2 PSIG  SIGSYS SIG_DFL
  4890 conftest2 NAMI  "conftest2.core"


Is it possible to get this working again, as it did with prae-newlock2
kernels? Some compatibility option maybe?


Regards, Jukka

-- 
bashian roulette:
$ ((RANDOM%6)) || rm -rf ~

--qMm9M+Fa2AknHoGS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="conftest2.c"

#include <pthread.h>

static void *task(p)
	void *p;
{
	return (void *) (p == NULL);
}


int main(argc, argv)
	int argc;
	char **argv;
{

	/* pthread test function */
#ifndef PTHREAD_CREATE_DETACHED
#define	PTHREAD_CREATE_DETACHED	1
#endif
	pthread_t t;
	int status;
	int detach = PTHREAD_CREATE_DETACHED;

	/* Final pthreads */
	pthread_attr_t attr;

	status = pthread_attr_init(&attr);
	if( status ) return status;

	status = pthread_attr_setdetachstate(&attr, detach);
	if( status ) return status;
	status = pthread_create( &t, &attr, task, NULL );
	if( status ) return status;

	return 0;
}

--qMm9M+Fa2AknHoGS--