diff options
author | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2017-02-08 11:18:23 +0530 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2017-02-08 14:17:17 +0530 |
commit | 8cbc826c37c0221ada65a7a622fe079b4e89a4b0 (patch) | |
tree | 598314eb1d2c9bb8da92f7c7f4cc25caf2cc31b4 /elf | |
parent | 3f67d1a7021ed3184830511636a0867faec730fe (diff) | |
download | glibc-8cbc826c37c0221ada65a7a622fe079b4e89a4b0.tar glibc-8cbc826c37c0221ada65a7a622fe079b4e89a4b0.tar.gz glibc-8cbc826c37c0221ada65a7a622fe079b4e89a4b0.tar.bz2 glibc-8cbc826c37c0221ada65a7a622fe079b4e89a4b0.zip |
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.
Diffstat (limited to 'elf')
-rw-r--r-- | elf/dl-tunable-types.h | 4 | ||||
-rw-r--r-- | elf/dl-tunables.c | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/elf/dl-tunable-types.h b/elf/dl-tunable-types.h index a986f0b593..37a4e8021f 100644 --- a/elf/dl-tunable-types.h +++ b/elf/dl-tunable-types.h @@ -21,8 +21,6 @@ # define _TUNABLE_TYPES_H_ #include <stddef.h> -typedef void (*tunable_callback_t) (void *); - typedef enum { TUNABLE_TYPE_INT_32, @@ -43,6 +41,8 @@ typedef union const char *strval; } tunable_val_t; +typedef void (*tunable_callback_t) (tunable_val_t *); + /* Security level for tunables. This decides what to do with individual tunables for AT_SECURE binaries. */ typedef enum diff --git a/elf/dl-tunables.c b/elf/dl-tunables.c index a8d53d6a31..e42aa67003 100644 --- a/elf/dl-tunables.c +++ b/elf/dl-tunables.c @@ -455,6 +455,8 @@ __tunable_set_val (tunable_id_t id, void *valp, tunable_callback_t callback) if (cur->strval == NULL) return; + /* Caller does not need the value, just call the callback with our tunable + value. */ if (valp == NULL) goto cb; |