svn commit: r324439 - head/sys/amd64/amd64
Konstantin Belousov
kib at FreeBSD.org
Mon Oct 9 16:20:40 UTC 2017
Author: kib
Date: Mon Oct 9 16:20:39 2017
New Revision: 324439
URL: https://svnweb.freebsd.org/changeset/base/324439
Log:
Change amd64_get_ldt() to return 'EOF' when the LDT is not yet
allocated, when requested range of descriptors does not fit into
currently allocated LDT, or trim the return if the range fits
partially. Before, the function returned EINVAL.
Reviewed by: bde
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Modified:
head/sys/amd64/amd64/sys_machdep.c
Modified: head/sys/amd64/amd64/sys_machdep.c
==============================================================================
--- head/sys/amd64/amd64/sys_machdep.c Mon Oct 9 16:19:26 2017 (r324438)
+++ head/sys/amd64/amd64/sys_machdep.c Mon Oct 9 16:20:39 2017 (r324439)
@@ -556,12 +556,12 @@ amd64_get_ldt(struct thread *td, struct i386_ldt_args
uap->start, uap->num, (void *)uap->descs);
#endif
- if (uap->start >= max_ldt_segment)
- return (EINVAL);
- num = min(uap->num, max_ldt_segment - uap->start);
pldt = td->td_proc->p_md.md_ldt;
- if (pldt == NULL)
- return (EINVAL);
+ if (pldt == NULL || uap->start >= max_ldt_segment || uap->num == 0) {
+ td->td_retval[0] = 0;
+ return (0);
+ }
+ num = min(uap->num, max_ldt_segment - uap->start);
lp = &((struct user_segment_descriptor *)(pldt->ldt_base))[uap->start];
data = malloc(num * sizeof(struct user_segment_descriptor), M_TEMP,
M_WAITOK);
More information about the svn-src-head
mailing list