Hide internal signal functions [BZ #18822]

Hide internal signal functions to allow direct access within libc.so and
libc.a without using GOT nor PLT.

__GI___kill and __GI___sigaltstack are defined when syscalls.list is
used to generate them.  Otherwise libc_hidden_def is needed explicitly.

	[BZ #18822]
	* include/signal.h (__kill): Add libc_hidden_proto.
	(__sigblock): Likewise.
	(__sigprocmask): Likewise.
	(__sigaltstack): Likewise.
	* signal/kill.c (__kill): Add libc_hidden_def.
	* signal/sigblock.c (__sigblock): Likewise.
	* signal/sigprocmask.c (__sigprocmask): Likewise.
	* sysdeps/mach/hurd/kill.c (__kill): Likewise.
	* sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise.
	* sysdeps/mach/hurd/sigprocmask.c (__sigprocmask): Likewise.
	* sysdeps/posix/sigblock.c (__sigblock): Likewise.
	* sysdeps/unix/sysv/linux/alpha/sigprocmask.c (__sigprocmask):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/sigprocmask.c (__sigprocmask):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c
	(__sigprocmask): Likewise.
	* sysdeps/unix/sysv/linux/sigprocmask.c (__sigprocmask):
	Likewise.
	* /sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c
	(__sigprocmask): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/sigprocmask.c (__sigprocmask):
	Likewise.
This commit is contained in:
H.J. Lu 2017-10-01 16:04:26 -07:00
parent 78cf1d74d2
commit 6a088436d4
15 changed files with 44 additions and 0 deletions

View File

@ -1,3 +1,30 @@
2017-10-01 H.J. Lu <hongjiu.lu@intel.com>
[BZ #18822]
* include/signal.h (__kill): Add libc_hidden_proto.
(__sigblock): Likewise.
(__sigprocmask): Likewise.
(__sigaltstack): Likewise.
* signal/kill.c (__kill): Add libc_hidden_def.
* signal/sigblock.c (__sigblock): Likewise.
* signal/sigprocmask.c (__sigprocmask): Likewise.
* sysdeps/mach/hurd/kill.c (__kill): Likewise.
* sysdeps/mach/hurd/sigaltstack.c (__sigaltstack): Likewise.
* sysdeps/mach/hurd/sigprocmask.c (__sigprocmask): Likewise.
* sysdeps/posix/sigblock.c (__sigblock): Likewise.
* sysdeps/unix/sysv/linux/alpha/sigprocmask.c (__sigprocmask):
Likewise.
* sysdeps/unix/sysv/linux/ia64/sigprocmask.c (__sigprocmask):
Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/sigprocmask.c
(__sigprocmask): Likewise.
* sysdeps/unix/sysv/linux/sigprocmask.c (__sigprocmask):
Likewise.
* /sysdeps/unix/sysv/linux/sparc/sparc64/sigprocmask.c
(__sigprocmask): Likewise.
* sysdeps/unix/sysv/linux/x86_64/sigprocmask.c (__sigprocmask):
Likewise.
2017-10-01 H.J. Lu <hongjiu.lu@intel.com>
[BZ #18822]

View File

@ -17,13 +17,16 @@ libc_hidden_proto (_sys_siglist)
/* Now define the internal interfaces. */
extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler);
extern int __kill (__pid_t __pid, int __sig);
libc_hidden_proto (__kill)
extern int __sigaction (int __sig, const struct sigaction *__restrict __act,
struct sigaction *__restrict __oact);
libc_hidden_proto (__sigaction)
extern int __sigblock (int __mask);
libc_hidden_proto (__sigblock)
extern int __sigsetmask (int __mask);
extern int __sigprocmask (int __how,
const sigset_t *__set, sigset_t *__oset);
libc_hidden_proto (__sigprocmask)
extern int __sigsuspend (const sigset_t *__set);
libc_hidden_proto (__sigsuspend)
extern int __sigwait (const sigset_t *__set, int *__sig);
@ -40,6 +43,7 @@ extern int __sigreturn (struct sigcontext *__scp);
#endif
extern int __sigaltstack (const stack_t *__ss,
stack_t *__oss);
libc_hidden_proto (__sigaltstack)
extern int __libc_sigaction (int sig, const struct sigaction *act,
struct sigaction *oact);
libc_hidden_proto (__libc_sigaction)

View File

@ -30,4 +30,5 @@ __kill (int pid, int sig)
}
stub_warning (kill)
libc_hidden_def (__kill)
weak_alias (__kill, kill)

View File

@ -27,4 +27,5 @@ __sigblock (int mask)
}
stub_warning (sigblock)
libc_hidden_def (__sigblock)
weak_alias (__sigblock, sigblock)

View File

@ -44,4 +44,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
and we don't want warnings for every use of abort on
a system without safe signals. */
libc_hidden_def (__sigprocmask)
weak_alias (__sigprocmask, sigprocmask)

View File

@ -146,4 +146,5 @@ __kill (pid_t pid, int sig)
return delivered ? 0 : __hurd_fail (err ?: ESRCH);
}
libc_hidden_def (__kill)
weak_alias (__kill, kill)

View File

@ -57,4 +57,5 @@ __sigaltstack (const stack_t *argss, stack_t *oss)
return 0;
}
libc_hidden_def (__sigaltstack)
weak_alias (__sigaltstack, sigaltstack)

View File

@ -80,4 +80,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
return 0;
}
libc_hidden_def (__sigprocmask)
weak_alias (__sigprocmask, sigprocmask)

View File

@ -35,4 +35,5 @@ __sigblock (int mask)
return sigset_get_old_mask (&oset);
}
libc_hidden_def (__sigblock)
weak_alias (__sigblock, sigblock)

View File

@ -54,4 +54,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
return 0;
}
libc_hidden_def (__sigprocmask)
weak_alias (__sigprocmask, sigprocmask);

View File

@ -36,4 +36,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
real size of the user-level sigset_t. */
return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
}
libc_hidden_def (__sigprocmask)
weak_alias (__sigprocmask, sigprocmask)

View File

@ -34,4 +34,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
real size of the user-level sigset_t. */
return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
}
libc_hidden_def (__sigprocmask)
weak_alias (__sigprocmask, sigprocmask)

View File

@ -53,4 +53,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
}
libc_hidden_def (__sigprocmask)
weak_alias (__sigprocmask, sigprocmask)

View File

@ -30,4 +30,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
real size of the user-level sigset_t. */
return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
}
libc_hidden_def (__sigprocmask)
weak_alias (__sigprocmask, sigprocmask)

View File

@ -35,4 +35,5 @@ __sigprocmask (int how, const sigset_t *set, sigset_t *oset)
real size of the user-level sigset_t. */
return INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8);
}
libc_hidden_def (__sigprocmask)
weak_alias (__sigprocmask, sigprocmask)