File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -453,16 +453,23 @@ impl Descriptor {
453453 return Err ( InvalidIoMap :: TooLong { len : iomap. len ( ) } )
454454 }
455455
456- let distance = iomap. as_ptr ( ) as usize - tss as * const _ as usize ;
457- if distance > 0xdfff {
458- return Err ( InvalidIoMap :: TooFarFromTss { distance } )
456+ let base = iomap. as_ptr ( ) as usize - tss as * const _ as usize ;
457+ if base > 0xdfff {
458+ return Err ( InvalidIoMap :: TooFarFromTss { distance : base } )
459459 }
460460
461461 let last_byte = * iomap. last ( ) . unwrap_or ( & 0xff ) ;
462462 if last_byte != 0xff {
463463 return Err ( InvalidIoMap :: InvalidTerminatingByte { byte : last_byte } )
464464 }
465465
466+ if tss. iomap_base != base as u16 {
467+ return Err ( InvalidIoMap :: InvalidBase {
468+ expected : base as u16 ,
469+ got : tss. iomap_base
470+ } ) ;
471+ }
472+
466473 // SAFETY: all invariants checked above
467474 Ok ( unsafe { Self :: tss_segment_raw ( tss, iomap. len ( ) as u16 ) } )
468475 }
Original file line number Diff line number Diff line change @@ -68,6 +68,11 @@ pub enum InvalidIoMap {
6868 TooLong {
6969 len : usize
7070 } ,
71+ /// The `iomap_base` in the `TaskStateSegment` struct was not what was expected.
72+ InvalidBase {
73+ expected : u16 ,
74+ got : u16 ,
75+ }
7176}
7277
7378#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments