mailing list of musl libc
 help / color / mirror / code / Atom feed
* reserved symbol violations
@ 2014-08-02 16:28 Jens Gustedt
  2014-08-02 16:37 ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Gustedt @ 2014-08-02 16:28 UTC (permalink / raw)
  To: musl


[-- Attachment #1.1: Type: text/plain, Size: 1189 bytes --]

Hi,
 by digging into the symbols that are dragged into a C11 thread
executable I noticed that there are some hotspots that should perhaps
be worth looking at. I attach a file that summarizes the findings.

One is simple, I'd change the reference to clock_gettime in
__timedwait to __clock_gettime.

There are bunch of others, that look simple to resolve, tell me if I
should look into that.

One looks weird, though, lock_ptc.o It is only linked (via __synccall)
if setrlimit or setxid are. But then it drags a whole bunch of pthread
symbols in, which looks wrong to me. Also I think that this doesn't
really capture the need, because the code is only active if both
setrlimit *and* pthread_create are *used*.

So in the absence of either of it, __syncall shouldn't be linked. But
I wouldn't know how to achieve this with weak symbols, I have to
admit.

Jens

-- 
:: INRIA Nancy Grand Est ::: AlGorille ::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::




[-- Attachment #1.2: musl-symbol-violations.txt --]
[-- Type: text/plain, Size: 1863 bytes --]

Observed reserved symbol violations as of current musl

setxid.o:
setrlimit.o:
	U __synccall

synccall.o:
	U __inhibit_ptc		-> lock_ptc.o
	U sem_init
	U sem_post
	U sem_wait
	U sigfillset
	U sigqueue

lock_ptc.o:
	U pthread_rwlock_rdlock
	U pthread_rwlock_unlock
	U pthread_rwlock_wrlock

pthread_rwlock_wrlock.o:
	U pthread_rwlock_timedwrlock

pthread_rwlock_rdlock.o:
	U pthread_rwlock_timedrdlock

pthread_cond_timedwait.o:
pthread_join.o:
pthread_mutex_timedlock.o:
pthread_rwlock_timedrdlock.o:
pthread_rwlock_timedwrlock.o:
sem_timedwait.o:
	U __timedwait

__timedwait.o:
	U clock_gettime

sigqueue.o:
	U getpid
	U getuid
	U memset

sem_open.o (also sem_close):
	U access
	U calloc
	U clock_gettime
	U close
	U fstat
	U link
	U mmap
	U munmap
	U open
	U pthread_setcancelstate
	U snprintf
	U unlink
	U write

sem_unlink.o:
	U shm_unlink

shm_open.o (also shm_unlink):
	U memcpy
	U open
	U pthread_setcancelstate
	U unlink

__asctime.o:
	U snprintf

getdate.o:
	U fclose
	U fgets
	U fopen
	U getenv
	U pthread_setcancelstate
	U strptime

strftime.o:
	U abs
	U memcpy
	U snprintf
	U strlen
	U strtoul

strptime.o:
	U isspace
	U nl_langinfo
	U strlen
	U strncasecmp
	U strtoul

sleep.o:
        U nanosleep

__init_tls.o:
	U memcpy

__libc_start_main.o:
	U exit

__reset_tls.o:
	U memcpy
	U memset

__stack_chk_fail.o:
	U memcpy

getenv.o:
	U strchr
	U strlen
	U strncmp

putenv.o:
	U memcmp
	U memcpy
	U strchr

setenv.o:
	U memcpy
	U strchr
	U strlen

unsetenv.o:
	U memcmp
	U strchr
	U strlen

assert.o:
	U abort
	U fflush
	U fprintf
	U stderr

timer_create.o:
	U longjmp
	U pthread_attr_init
	U pthread_attr_setdetachstate
	U pthread_barrier_init
	U pthread_barrier_wait
	U pthread_create
	U pthread_once
	U setjmp

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: reserved symbol violations
  2014-08-02 16:28 reserved symbol violations Jens Gustedt
@ 2014-08-02 16:37 ` Rich Felker
  2014-08-02 16:57   ` Jens Gustedt
  0 siblings, 1 reply; 4+ messages in thread
From: Rich Felker @ 2014-08-02 16:37 UTC (permalink / raw)
  To: musl

On Sat, Aug 02, 2014 at 06:28:03PM +0200, Jens Gustedt wrote:
> Hi,
>  by digging into the symbols that are dragged into a C11 thread
> executable I noticed that there are some hotspots that should perhaps
> be worth looking at. I attach a file that summarizes the findings.
> 
> One is simple, I'd change the reference to clock_gettime in
> __timedwait to __clock_gettime.

That's fine.

> One looks weird, though, lock_ptc.o It is only linked (via __synccall)
> if setrlimit or setxid are. But then it drags a whole bunch of pthread
> symbols in, which looks wrong to me. Also I think that this doesn't
> really capture the need, because the code is only active if both
> setrlimit *and* pthread_create are *used*.
> 
> So in the absence of either of it, __syncall shouldn't be linked. But
> I wouldn't know how to achieve this with weak symbols, I have to
> admit.

I have no idea how to make it get linked only if both are used, and I
suspect it's impossible. However, there's no namespace violation here;
setrlimit and set*id are from POSIX, not ISO C. So it's just excess
bloat.

Rich


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: reserved symbol violations
  2014-08-02 16:37 ` Rich Felker
@ 2014-08-02 16:57   ` Jens Gustedt
  2014-08-02 17:34     ` Rich Felker
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Gustedt @ 2014-08-02 16:57 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1162 bytes --]

Am Samstag, den 02.08.2014, 12:37 -0400 schrieb Rich Felker:
> On Sat, Aug 02, 2014 at 06:28:03PM +0200, Jens Gustedt wrote:
> > Hi,
> >  by digging into the symbols that are dragged into a C11 thread
> > executable I noticed that there are some hotspots that should perhaps
> > be worth looking at. I attach a file that summarizes the findings.
> > 
> > One is simple, I'd change the reference to clock_gettime in
> > __timedwait to __clock_gettime.
> 
> That's fine.

ok

> I have no idea how to make it get linked only if both are used, and I
> suspect it's impossible. However, there's no namespace violation here;
> setrlimit and set*id are from POSIX, not ISO C. So it's just excess
> bloat.

Hm, even inside POSIX this is not conforming, I think. POSIX has a
quite precise idea which headers make which symbols visible.

Jens

-- 
:: INRIA Nancy Grand Est ::: AlGorille ::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: reserved symbol violations
  2014-08-02 16:57   ` Jens Gustedt
@ 2014-08-02 17:34     ` Rich Felker
  0 siblings, 0 replies; 4+ messages in thread
From: Rich Felker @ 2014-08-02 17:34 UTC (permalink / raw)
  To: musl

On Sat, Aug 02, 2014 at 06:57:00PM +0200, Jens Gustedt wrote:
> Am Samstag, den 02.08.2014, 12:37 -0400 schrieb Rich Felker:
> > On Sat, Aug 02, 2014 at 06:28:03PM +0200, Jens Gustedt wrote:
> > > Hi,
> > >  by digging into the symbols that are dragged into a C11 thread
> > > executable I noticed that there are some hotspots that should perhaps
> > > be worth looking at. I attach a file that summarizes the findings.
> > > 
> > > One is simple, I'd change the reference to clock_gettime in
> > > __timedwait to __clock_gettime.
> > 
> > That's fine.
> 
> ok
> 
> > I have no idea how to make it get linked only if both are used, and I
> > suspect it's impossible. However, there's no namespace violation here;
> > setrlimit and set*id are from POSIX, not ISO C. So it's just excess
> > bloat.
> 
> Hm, even inside POSIX this is not conforming, I think. POSIX has a
> quite precise idea which headers make which symbols visible.

Headers and "making it visible" are not involved here. See XBD 2.2.2
The Name Space:

    The following identifiers are reserved regardless of the inclusion
    of headers:

    4. All functions and external identifiers defined in XBD Headers
    are reserved for use as identifiers with external linkage.

    5. All the identifiers defined in this volume of POSIX.1-2008 that
    have external linkage are always reserved for use as identifiers
    with external linkage.

Rich


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-08-02 17:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-02 16:28 reserved symbol violations Jens Gustedt
2014-08-02 16:37 ` Rich Felker
2014-08-02 16:57   ` Jens Gustedt
2014-08-02 17:34     ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).