mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-27 03:41:23 +08:00
elf: Ignore LD_BIND_NOW and LD_BIND_NOT for setuid binaries
To avoid any environment variable to change setuid binaries semantics. Checked on x86_64-linux-gnu. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
This commit is contained in:
parent
876a12e513
commit
61d848b554
@ -2604,12 +2604,14 @@ process_envvars (struct dl_main_state *state)
|
|||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
/* Do we bind early? */
|
/* Do we bind early? */
|
||||||
if (memcmp (envline, "BIND_NOW", 8) == 0)
|
if (!__libc_enable_secure
|
||||||
|
&& memcmp (envline, "BIND_NOW", 8) == 0)
|
||||||
{
|
{
|
||||||
GLRO(dl_lazy) = envline[9] == '\0';
|
GLRO(dl_lazy) = envline[9] == '\0';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (memcmp (envline, "BIND_NOT", 8) == 0)
|
if (! __libc_enable_secure
|
||||||
|
&& memcmp (envline, "BIND_NOT", 8) == 0)
|
||||||
GLRO(dl_bind_not) = envline[9] != '\0';
|
GLRO(dl_bind_not) = envline[9] != '\0';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2686,6 +2688,8 @@ process_envvars (struct dl_main_state *state)
|
|||||||
|
|
||||||
if (GLRO(dl_debug_mask) != 0
|
if (GLRO(dl_debug_mask) != 0
|
||||||
|| GLRO(dl_verbose) != 0
|
|| GLRO(dl_verbose) != 0
|
||||||
|
|| GLRO(dl_lazy) != 1
|
||||||
|
|| GLRO(dl_bind_not) != 0
|
||||||
|| state->mode != rtld_mode_normal
|
|| state->mode != rtld_mode_normal
|
||||||
|| state->version_info)
|
|| state->version_info)
|
||||||
_exit (5);
|
_exit (5);
|
||||||
|
@ -63,12 +63,12 @@ static const struct envvar_t filtered_envvars[] =
|
|||||||
{ "LD_DEBUG_OUTPUT", "/tmp/some-file" },
|
{ "LD_DEBUG_OUTPUT", "/tmp/some-file" },
|
||||||
{ "LD_WARN", FILTERED_VALUE },
|
{ "LD_WARN", FILTERED_VALUE },
|
||||||
{ "LD_VERBOSE", FILTERED_VALUE },
|
{ "LD_VERBOSE", FILTERED_VALUE },
|
||||||
|
{ "LD_BIND_NOW", "0" },
|
||||||
|
{ "LD_BIND_NOT", "1" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct envvar_t unfiltered_envvars[] =
|
static const struct envvar_t unfiltered_envvars[] =
|
||||||
{
|
{
|
||||||
{ "LD_BIND_NOW", "0" },
|
|
||||||
{ "LD_BIND_NOT", "1" },
|
|
||||||
/* Non longer supported option. */
|
/* Non longer supported option. */
|
||||||
{ "LD_ASSUME_KERNEL", UNFILTERED_VALUE },
|
{ "LD_ASSUME_KERNEL", UNFILTERED_VALUE },
|
||||||
};
|
};
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
"GLIBC_TUNABLES\0" \
|
"GLIBC_TUNABLES\0" \
|
||||||
"HOSTALIASES\0" \
|
"HOSTALIASES\0" \
|
||||||
"LD_AUDIT\0" \
|
"LD_AUDIT\0" \
|
||||||
|
"LD_BIND_NOT\0" \
|
||||||
|
"LD_BIND_NOW\0" \
|
||||||
"LD_DEBUG\0" \
|
"LD_DEBUG\0" \
|
||||||
"LD_DEBUG_OUTPUT\0" \
|
"LD_DEBUG_OUTPUT\0" \
|
||||||
"LD_DYNAMIC_WEAK\0" \
|
"LD_DYNAMIC_WEAK\0" \
|
||||||
|
Loading…
Reference in New Issue
Block a user