mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
Fix getting tunable values on big-endian (BZ #21109)
The code to set value passed a tunable_val_t, which when cast to int32_t on big-endian gives the wrong value. Instead, use tunable_val_t.numval instead, which can then be safely cast into int32_t.
This commit is contained in:
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
|||||||
|
2017-02-08 Siddhesh Poyarekar <siddhesh@sourceware.org>
|
||||||
|
|
||||||
|
[BZ #21109]
|
||||||
|
* elf/dl-tunable-types.h (tunable_callback_t): Accept
|
||||||
|
tunable_val_t as argument.
|
||||||
|
* elf/dl-tunables.c (__tunable_set_val): Add comment.
|
||||||
|
* malloc/arena.c (set_mallopt_check): Take tunable_val_t as
|
||||||
|
argument.
|
||||||
|
(DL_TUNABLE_CALLBACK_FNDECL): Likewise.
|
||||||
|
|
||||||
2017-02-08 Kir Kolyshkin <kir@openvz.org>
|
2017-02-08 Kir Kolyshkin <kir@openvz.org>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h (__ptrace_eventcodes):
|
* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h (__ptrace_eventcodes):
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
# define _TUNABLE_TYPES_H_
|
# define _TUNABLE_TYPES_H_
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
typedef void (*tunable_callback_t) (void *);
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
TUNABLE_TYPE_INT_32,
|
TUNABLE_TYPE_INT_32,
|
||||||
@ -43,6 +41,8 @@ typedef union
|
|||||||
const char *strval;
|
const char *strval;
|
||||||
} tunable_val_t;
|
} tunable_val_t;
|
||||||
|
|
||||||
|
typedef void (*tunable_callback_t) (tunable_val_t *);
|
||||||
|
|
||||||
/* Security level for tunables. This decides what to do with individual
|
/* Security level for tunables. This decides what to do with individual
|
||||||
tunables for AT_SECURE binaries. */
|
tunables for AT_SECURE binaries. */
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -455,6 +455,8 @@ __tunable_set_val (tunable_id_t id, void *valp, tunable_callback_t callback)
|
|||||||
if (cur->strval == NULL)
|
if (cur->strval == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* Caller does not need the value, just call the callback with our tunable
|
||||||
|
value. */
|
||||||
if (valp == NULL)
|
if (valp == NULL)
|
||||||
goto cb;
|
goto cb;
|
||||||
|
|
||||||
|
@ -212,9 +212,9 @@ __malloc_fork_unlock_child (void)
|
|||||||
#if HAVE_TUNABLES
|
#if HAVE_TUNABLES
|
||||||
static inline int do_set_mallopt_check (int32_t value);
|
static inline int do_set_mallopt_check (int32_t value);
|
||||||
void
|
void
|
||||||
DL_TUNABLE_CALLBACK (set_mallopt_check) (void *valp)
|
DL_TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp)
|
||||||
{
|
{
|
||||||
int32_t value = *(int32_t *) valp;
|
int32_t value = (int32_t) valp->numval;
|
||||||
do_set_mallopt_check (value);
|
do_set_mallopt_check (value);
|
||||||
if (check_action != 0)
|
if (check_action != 0)
|
||||||
__malloc_check_init ();
|
__malloc_check_init ();
|
||||||
@ -223,9 +223,9 @@ DL_TUNABLE_CALLBACK (set_mallopt_check) (void *valp)
|
|||||||
# define DL_TUNABLE_CALLBACK_FNDECL(__name, __type) \
|
# define DL_TUNABLE_CALLBACK_FNDECL(__name, __type) \
|
||||||
static inline int do_ ## __name (__type value); \
|
static inline int do_ ## __name (__type value); \
|
||||||
void \
|
void \
|
||||||
DL_TUNABLE_CALLBACK (__name) (void *valp) \
|
DL_TUNABLE_CALLBACK (__name) (tunable_val_t *valp) \
|
||||||
{ \
|
{ \
|
||||||
__type value = *(__type *) valp; \
|
__type value = (__type) (valp)->numval; \
|
||||||
do_ ## __name (value); \
|
do_ ## __name (value); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user