On 12/08/2019 12:04, Jan Beulich wrote: > On 12.08.2019 12:29, Andrew Cooper wrote: >> On 12/08/2019 08:23, Jan Beulich wrote: >>> @@ -747,16 +747,10 @@ void load_system_tables(void) >>> .bitmap = IOBMP_INVALID_OFFSET, >>> }; >>> - _set_tssldt_desc( >>> - gdt + TSS_ENTRY, >>> - (unsigned long)tss, >>> - offsetof(struct tss_struct, __cacheline_filler) - 1, >>> - SYS_DESC_tss_avail); >>> - _set_tssldt_desc( >>> - compat_gdt + TSS_ENTRY, >>> - (unsigned long)tss, >>> - offsetof(struct tss_struct, __cacheline_filler) - 1, >>> - SYS_DESC_tss_busy); >>> + _set_tssldt_desc(gdt + TSS_ENTRY, (unsigned long)tss, >>> + sizeof(*tss) - 1, SYS_DESC_tss_avail); >>> + _set_tssldt_desc(compat_gdt + TSS_ENTRY, (unsigned long)tss, >>> + sizeof(*tss) - 1, SYS_DESC_tss_busy); >> >> Do you think it is worth having a BUILD_BUG_ON(sizeof(*tss) < 0x67), >> just to confirm that the load wont fault? > > Not sure - it feels like going a little overboard with checks. Feel > free to add one though if you're really convinced it helps, but > then please with 0x68 in place of 0x67. (I'm about to leave now, > so if you want me to add anything and/or commit it, it would have > to wait two weeks.)
I spotted the off-by-one just after I sent the email, but I've gone with <= 0x67 rather than < 0x68 because 0x67 is the way both manuals refer to the restriction. I've also reformatted the commit message so it doesn't read as a changelog, but am going to throw it in now that we're both happy with the result. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel