Re: [PATCH v4 1/4] syscalls: Restore address limit after a syscall

From: H. Peter Anvin
Date: Wed Mar 22 2017 - 17:17:13 EST


On 03/22/17 13:44, Andy Lutomirski wrote:
>
> While it's possible that silently papering over the bug is slightly
> faster than BUGging, it will allow bugs to continue to exist
> undetected.
>

It would also allow the test to be inlined (at least on architectures
which have a one-site implementation) and have only the failure case out
of line, with a __noreturn annotation (which allows it to be jumped to
rather than called, which is usually available as a conditional
operation whereas call often isn't.)

That is...

extern void __noreturn __pre_usermode_state_invalid(void);

static void verify_pre_usermode_state(void)
{
if (unlikely(!segment_eq(get_fs(), USER_DS))
__pre_usermode_state_invalid();
}

-hpa