x86-64: decode clone LDT user_desc entries for x86 processes

* mem.c [X86_64]: Include asm/ldt.h.
[X86_64] (print_ldt_entry, sys_modify_ldt, sys_set_thread_area,
sys_get_thread_area): Define.
* process.c [X86_64]: Include asm/ldt.h.
(sys_clone) [X86_64]: Decode LDT entry if current_personality == 1.

Signed-off-by: Elliott Hughes <enh@google.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
This commit is contained in:
Elliott Hughes 2014-04-05 11:56:17 -07:00 committed by Dmitry V. Levin
parent 2c4fb25766
commit 44655a451e
2 changed files with 21 additions and 16 deletions

8
mem.c
View File

@ -33,12 +33,12 @@
#include "defs.h"
#include <asm/mman.h>
#include <sys/mman.h>
#if defined(I386)
#if defined(I386) || defined(X86_64)
# include <asm/ldt.h>
# ifdef HAVE_STRUCT_USER_DESC
# define modify_ldt_ldt_s user_desc
# endif
#endif
#endif /* I386 || X86_64 */
static unsigned long
get_pagesize()
@ -543,7 +543,7 @@ sys_getpagesize(struct tcb *tcp)
}
#endif
#if defined(I386)
#if defined(I386) || defined(X86_64)
void
print_ldt_entry(struct modify_ldt_ldt_s *ldt_entry)
{
@ -635,7 +635,7 @@ sys_get_thread_area(struct tcb *tcp)
return 0;
}
#endif /* I386 */
#endif /* I386 || X86_64 */
#if defined(M68K)
int

View File

@ -491,13 +491,13 @@ static const struct xlat clone_flags[] = {
XLAT_END
};
#ifdef I386
#if defined I386 || defined X86_64
# include <asm/ldt.h>
# ifdef HAVE_STRUCT_USER_DESC
# define modify_ldt_ldt_s user_desc
# endif
extern void print_ldt_entry();
#endif
#endif /* I386 || X86_64 */
#if defined IA64
# define ARG_FLAGS 0
@ -556,18 +556,23 @@ sys_clone(struct tcb *tcp)
if (flags & CLONE_PARENT_SETTID)
tprintf(", parent_tidptr=%#lx", tcp->u_arg[ARG_PTID]);
if (flags & CLONE_SETTLS) {
#ifdef I386
struct modify_ldt_ldt_s copy;
if (umove(tcp, tcp->u_arg[ARG_TLS], &copy) != -1) {
tprintf(", {entry_number:%d, ",
copy.entry_number);
if (!verbose(tcp))
tprints("...}");
else
print_ldt_entry(&copy);
#if defined I386 || defined X86_64
# ifndef I386
if (current_personality == 1)
# endif
{
struct modify_ldt_ldt_s copy;
if (umove(tcp, tcp->u_arg[ARG_TLS], &copy) != -1) {
tprintf(", {entry_number:%d, ",
copy.entry_number);
if (!verbose(tcp))
tprints("...}");
else
print_ldt_entry(&copy);
}
}
else
#endif
#endif /* I386 || X86_64 */
tprintf(", tls=%#lx", tcp->u_arg[ARG_TLS]);
}
if (flags & (CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID))