> The comment style around __no_sanitize_memory looks very different for > different call sites, perhaps it makes sense to unify it somehow. Done in v4. > > +/* > > + * Dark magic happening here, let's not instrument this function. > > + * Also avoid copying any metadata by using raw __memmove(). > > + */ > > +__no_sanitize_memory > > struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s) > > { > > /* > > @@ -648,10 +656,10 @@ struct bad_iret_stack *fixup_bad_iret(struct bad_iret_stack *s) > > (struct bad_iret_stack *)this_cpu_read(cpu_tss_rw.x86_tss.sp0) - 1; > > > > /* Copy the IRET target to the new stack. */ > > - memmove(&new_stack->regs.ip, (void *)s->regs.sp, 5*8); > > + __memmove(&new_stack->regs.ip, (void *)s->regs.sp, 5*8); > > > > /* Copy the remainder of the stack from the current stack. */ > > - memmove(new_stack, s, offsetof(struct bad_iret_stack, regs.ip)); > > + __memmove(new_stack, s, offsetof(struct bad_iret_stack, regs.ip)); > > Looks like this change should go into a separate patch. I disagree. Both the __no_sanitize_memory annotation and __memmove() calls serve the same purpose: avoid calling KMSAN code from fixup_bad_iret(). I don't think it makes sense to separate them. > > + kmsan_unpoison_shadow(args, sizeof(*args)); > > + regs = args->regs; > > + if (regs) > > + kmsan_unpoison_shadow(regs, sizeof(*regs)); > > This one as well. Done in v4.