From 20098981e11317ef63fd0ae17872027a0bc512d4 Mon Sep 17 00:00:00 2001 From: kib Date: Mon, 26 Nov 2007 11:06:19 +0000 Subject: [PATCH] Implement read_default_ldt in linux_modify_ldt(). It copies out zeroed descriptor, like real Linux does. Tested by: Yuriy Tsibizov Submitted by: rdivacky MFC after: 1 week --- sys/i386/linux/linux_machdep.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c index d3fa388abb63..a92c751fcd19 100644 --- a/sys/i386/linux/linux_machdep.c +++ b/sys/i386/linux/linux_machdep.c @@ -873,6 +873,7 @@ linux_modify_ldt(struct thread *td, struct linux_modify_ldt_args *uap) struct i386_ldt_args ldt; struct l_descriptor ld; union descriptor desc; + int size, written; if (uap->ptr == NULL) return (EINVAL); @@ -885,6 +886,14 @@ linux_modify_ldt(struct thread *td, struct linux_modify_ldt_args *uap) error = i386_get_ldt(td, &ldt); td->td_retval[0] *= sizeof(union descriptor); break; + case 0x02: /* read_default_ldt = 0 */ + size = 5*sizeof(struct l_desc_struct); + if (size > uap->bytecount) + size = uap->bytecount; + for (written = error = 0; written < size && error == 0; written++) + error = subyte((char *)uap->ptr + written, 0); + td->td_retval[0] = written; + break; case 0x01: /* write_ldt */ case 0x11: /* write_ldt */ if (uap->bytecount != sizeof(ld))