Date: Sun, 12 May 2002 22:16:35 -0700 (PDT) From: David Xu <davidx@viasoft.com.cn> To: freebsd-gnats-submit@FreeBSD.org Subject: i386/38016: i386_get_ldt range checking bug Message-ID: <200205130516.g4D5GZh8027512@www.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 38016
>Category: i386
>Synopsis: i386_get_ldt range checking bug
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun May 12 22:20:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: David Xu
>Release: FreeBSD 5.0-CURRENT
>Organization:
Viatech
>Environment:
FreeBSD davidbsd.viasoft.com.cn 5.0-CURRENT FreeBSD 5.0-CURRENT #23:
Mon May 13 12:16:30 CST 2002
davidx@davidbsd.viasoft.com.cn:/usr/src/sys/i386/compile/xu i386
>Description:
function i386_get_ldt() in sys_machdep.c has range checking bug, it
allow program to access LDT out of bound, may cause page fault.
>How-To-Repeat:
>Fix:
--- /usr/src/sys/i386/i386/sys_machdep.c Wed Apr 3 02:37:41 2002
+++ /usr/src/sys/i386/i386/sys_machdep.c.new Mon May 13 11:11:19 2002
@@ -363,6 +363,7 @@
char *args;
{
int error = 0;
+ int largest_ld;
struct proc_ldt *pldt = td->td_proc->p_md.md_ldt;
int nldt, num;
union descriptor *lp;
@@ -389,7 +390,8 @@
num = min(uap->num, nldt);
lp = &ldt[uap->start];
}
- if (uap->start > nldt)
+ largest_ld = uap->start + num - 1;
+ if (uap->start >= nldt || largest_ld >= nldt)
return(EINVAL);
error = copyout(lp, uap->descs, num * sizeof(union descriptor));
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200205130516.g4D5GZh8027512>
