Zero-initialize user_desc for __set_thread_area.
The kernel does seem to read some of the "unused" fields if only to do basic validity checks. valgrind complained about this, and I'm not convinced it's spurious. Bug: http://b/38034461 Test: ran tests Change-Id: I077fcc75bf0738491242166fc4576a9693ce18a5
This commit is contained in:
parent
1f9e648878
commit
b291d08af2
|
@ -32,9 +32,9 @@
|
|||
|
||||
#include <asm/ldt.h>
|
||||
|
||||
extern "C" int __set_thread_area(struct user_desc*);
|
||||
extern "C" int __set_thread_area(user_desc*);
|
||||
|
||||
__LIBC_HIDDEN__ void __init_user_desc(struct user_desc* result, bool allocate, void* base_addr) {
|
||||
__LIBC_HIDDEN__ void __init_user_desc(user_desc* result, bool allocate, void* base_addr) {
|
||||
if (allocate) {
|
||||
// Let the kernel choose.
|
||||
result->entry_number = -1;
|
||||
|
@ -58,7 +58,7 @@ __LIBC_HIDDEN__ void __init_user_desc(struct user_desc* result, bool allocate, v
|
|||
}
|
||||
|
||||
extern "C" __LIBC_HIDDEN__ int __set_tls(void* ptr) {
|
||||
struct user_desc tls_descriptor;
|
||||
user_desc tls_descriptor = {};
|
||||
__init_user_desc(&tls_descriptor, true, ptr);
|
||||
|
||||
int rc = __set_thread_area(&tls_descriptor);
|
||||
|
|
Loading…
Reference in New Issue