Re: ia32_sysenter_target does not preserve EFLAGS

From: Linus Torvalds
Date: Fri Mar 27 2015 - 16:01:06 EST


On Fri, Mar 27, 2015 at 7:25 AM, Denys Vlasenko <dvlasenk@xxxxxxxxxx> wrote:
>
> Apparently, users *don't* depend on arithmetic flags
> to survive over syscall. They also okay with DF flag
> being cleared.

Generally, users probably dont' care about many registers at all being
saved, but it's worth noting that the reason system calls save/restore
even caller-saved registers is at least partly in order to avoid any
kernel information leaks.

I don't believe that user mode will ever reasonably care about the
arithmetic flags being changed, but at the same time I also don't it
is something we should ever consider a "feature" we should try to take
advantage of. Generally we should try to not mess with the flag state,
and I'd *much* rather make the rule be that all the system call return
paths restore flags as much as possible.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/