mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-20 08:56:47 -05:00
daemon: before exec'ing ourselves, make sure nobody plays games with /proc/self/exe
This commit is contained in:
parent
6fdd5846b2
commit
a2b207e38a
2 changed files with 16 additions and 6 deletions
|
|
@ -405,7 +405,8 @@ int main(int argc, char *argv[]) {
|
||||||
/*
|
/*
|
||||||
Disable lazy relocations to make usage of external libraries
|
Disable lazy relocations to make usage of external libraries
|
||||||
more deterministic for our RT threads. We abuse __OPTIMIZE__ as
|
more deterministic for our RT threads. We abuse __OPTIMIZE__ as
|
||||||
a check whether we are a debug build or not.
|
a check whether we are a debug build or not. This all is
|
||||||
|
admittedly a bit snake-oilish.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!getenv("LD_BIND_NOW")) {
|
if (!getenv("LD_BIND_NOW")) {
|
||||||
|
|
@ -416,9 +417,16 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
pa_set_env("LD_BIND_NOW", "1");
|
pa_set_env("LD_BIND_NOW", "1");
|
||||||
|
|
||||||
if ((rp = pa_readlink("/proc/self/exe")))
|
if ((rp = pa_readlink("/proc/self/exe"))) {
|
||||||
|
|
||||||
|
if (pa_streq(rp, PA_BINARY))
|
||||||
pa_assert_se(execv(rp, argv) == 0);
|
pa_assert_se(execv(rp, argv) == 0);
|
||||||
else
|
else
|
||||||
|
pa_log_warn("/proc/self/exe does not point to " PA_BINARY ", cannot self execute. Are you playing games?");
|
||||||
|
|
||||||
|
pa_xfree(rp);
|
||||||
|
|
||||||
|
} else
|
||||||
pa_log_warn("Couldn't read /proc/self/exe, cannot self execute. Running in a chroot()?");
|
pa_log_warn("Couldn't read /proc/self/exe, cannot self execute. Running in a chroot()?");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,10 @@ static void dump_block(const pa_sample_spec *ss, const pa_memchunk *chunk) {
|
||||||
case PA_SAMPLE_S24RE: {
|
case PA_SAMPLE_S24RE: {
|
||||||
uint8_t *u = d;
|
uint8_t *u = d;
|
||||||
|
|
||||||
for (i = 0; i < chunk->length / pa_frame_size(ss); i++)
|
for (i = 0; i < chunk->length / pa_frame_size(ss); i++) {
|
||||||
printf("0x%02x%02x%02xx ", *(u++), *(u++), *(u++));
|
printf("0x%02x%02x%02xx ", *u, *(u+1), *(u+2));
|
||||||
|
u += 3;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue