cvs commit: src/sys/i386/i386 sys_machdep.c

David Xu davidxu at freebsd.org
Sat Aug 2 01:13:47 PDT 2003


----- Original Message ----- 
From: "Julian Elischer" <julian at FreeBSD.org>
To: <src-committers at FreeBSD.org>; <cvs-src at FreeBSD.org>; <cvs-all at FreeBSD.org>
Sent: Saturday, August 02, 2003 2:52 PM
Subject: cvs commit: src/sys/i386/i386 sys_machdep.c


> julian      2003/08/01 23:52:36 PDT
> 
>   FreeBSD src repository
> 
>   Modified files:
>     sys/i386/i386        sys_machdep.c 
>   Log:
>   Relax the check for bad LDTE allocations. It turns out that
>   there is code that blindly allocates LDTEs starting at slot 6
>   and I quess it doesn't really matter to us if they overwrite the BSDI
>   syscall slot, since it isn't a BSDI binary. Also add some code to help track
>   down other such users (commented out for now).
>   
>   Reviewed by:    deischen@
>   
>   Revision  Changes    Path
>   1.87      +21 -4     src/sys/i386/i386/sys_machdep.c
> 

The code is incorrect:

dp = &((union descriptor *)(pldt->ldt_base))[NLDT];
		/*
 * start scanning a bit up to leave room for NVidia and
 * Wine, which still user the "Blat" method of allocation.
 */
		for (i = NLDT + 1; i < pldt->ldt_len; ++i) {
    if (dp->sd.sd_type == SDT_SYSNULL)
      	break;
    dp++;
		}

dp is set to start from NLDT not NLDT+1, so the 'i' and 'dp' is
out of synchronous.

And why is complaint included in DEBUG section ?
    #ifdef	DEBUG
    		/* complain a for a while if using old methods */
    		if (ldt_warnings++ < NUM_LDT_WARNINGS) {
    			printf("Warning: pid %d used static ldt allocation.\n",
    			    td->td_proc->p_pid);
    			printf("See the i386_set_ldt man page for more info\n");
    		}
    #endif

--
David Xu



More information about the cvs-src mailing list