Implement read_default_ldt in linux_modify_ldt(). It copies out zeroed

descriptor, like real Linux does.

Tested by: Yuriy Tsibizov <yuriy.tsibizov at gmail com>
Submitted by:	rdivacky
MFC after:	1 week
This commit is contained in:
kib 2007-11-26 11:06:19 +00:00
parent 011b0ff906
commit 20098981e1

View File

@ -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))