Re: [PATCH v4 7/7] selftests/x86: Add a userspace test for LASS enforcement
From: Sohil Mehta
Date: Mon Sep 14 2026 - 23:27:18 EST
>
>> +int main(void)
>> +{
>> + ksft_print_header();
>> +
>> + if (!is_lass_active())
>> + ksft_exit_skip("LASS is not enabled\n");
>> +
>> + ksft_set_plan(TOTAL_TESTS);
>> +
>> + sethandler(SIGSEGV, fault_handler, 0);
>> + /* Only to report a #SS; LASS shouldn't cause one here. */
>> + sethandler(SIGBUS, fault_handler, 0);
>
> So the purpose is that if there is an unexpected #SS, fails the test instead of
> killing it, right?
>
Sorry, I missed this question earlier. Yes, the goal is to catch the
SIGBUS and report a failure.
I think it isn't worth keeping in the first place. My initial plan was
to trigger an LASS violation #SS. But, it turned out to be much harder
to trigger. I'll probably remove it because it creates a distraction.
>> +
>> + ksft_print_msg("Accessing the kernel address 0x%lx from userspace\n",
>> + (unsigned long)KERNEL_ADDR);
>> + test_kernel_read();
>> + test_kernel_write();
>> + test_kernel_fetch();
>> +
>> + clearhandler(SIGBUS);
>> + clearhandler(SIGSEGV);
>> +
>> + ksft_finished();
>> +}
>