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 @@ -320,16 +320,23 @@ impl Descriptor {
320320 return Err ( InvalidIoMap :: TooLong { len : iomap. len ( ) } )
321321 }
322322
323- let distance = iomap. as_ptr ( ) as usize - tss as * const _ as usize ;
324- if distance > 0xdfff {
325- return Err ( InvalidIoMap :: TooFarFromTss { distance } )
323+ let base = iomap. as_ptr ( ) as usize - tss as * const _ as usize ;
324+ if base > 0xdfff {
325+ return Err ( InvalidIoMap :: TooFarFromTss { distance : base } )
326326 }
327327
328328 let last_byte = * iomap. last ( ) . unwrap_or ( & 0xff ) ;
329329 if last_byte != 0xff {
330330 return Err ( InvalidIoMap :: InvalidTerminatingByte { byte : last_byte } )
331331 }
332332
333+ if tss. iomap_base != base as u16 {
334+ return Err ( InvalidIoMap :: InvalidBase {
335+ expected : base as u16 ,
336+ got : tss. iomap_base
337+ } ) ;
338+ }
339+
333340 // SAFETY: all invariants checked above
334341 Ok ( unsafe { Self :: tss_segment_raw ( tss, iomap. len ( ) as u16 ) } )
335342 }
Original file line number Diff line number Diff line change @@ -55,4 +55,9 @@ pub enum InvalidIoMap {
5555 TooLong {
5656 len : usize
5757 } ,
58+ /// The `iomap_base` in the `TaskStateSegment` struct was not what was expected.
59+ InvalidBase {
60+ expected : u16 ,
61+ got : u16 ,
62+ }
5863}
You can’t perform that action at this time.
0 commit comments