From: Boyan Karatotev <boian4o1@gmail.com>
To: Amit Kachhap <amit.kachhap@arm.com>,
Boyan Karatotev <boyan.karatotev@arm.com>,
linux-arm-kernel@lists.infradead.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: vincenzo.frascino@arm.com, Shuah Khan <shuah@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>
Subject: Re: [PATCH v2 1/4] kselftests/arm64: add a basic Pointer Authentication test
Date: Thu, 17 Sep 2020 14:38:01 +0100 [thread overview]
Message-ID: <fa24987e-c8e9-0130-d2bc-ec114a729491@gmail.com> (raw)
In-Reply-To: <2e89a5ff-738b-5484-bd00-9ccdeccf9f60@arm.com>
On 16/09/2020 1:11 pm, Amit Kachhap wrote:
> On 8/31/20 4:34 PM, Boyan Karatotev wrote:
>> PAuth signs and verifies return addresses on the stack. It does so by
>> +
>> +/* check that a corrupted PAC results in SIGSEGV */
>> +TEST_SIGNAL(corrupt_pac, SIGSEGV)
>> +{
>> + ASSERT_PAUTH_ENABLED();
>> +
>> + pac_corruptor();
>
> With 8.6-Pauth extension merged in arm tree [1]. It makes sense to
> verify PAC corruption for both SIGSEGV and SIGILL signals.
>
> Code something like below handles both the cases.
>
>
-----------------------------------------------------------------------------------
>
> int exec_sign_all(struct signatures *signed_vals, size_t val)
> @@ -187,12 +188,29 @@ int exec_sign_all(struct signatures *signed_vals,
> size_t val)
> return 0;
> }
>
> -/* check that a corrupted PAC results in SIGSEGV */
> -TEST_SIGNAL(corrupt_pac, SIGSEGV)
> +sigjmp_buf jmpbuf;
> +void pac_signal_handler(int signum, siginfo_t *si, void *uc)
> {
> - ASSERT_PAUTH_ENABLED();
> + if (signum == SIGSEGV || signum == SIGILL) {
> + siglongjmp(jmpbuf, 1);
> + }
> +}
> +
> +/* check that a corrupted PAC results in SIGSEGV or SIGILL */
> +TEST(corrupt_pac)
> +{
> + struct sigaction sa;
>
> - pac_corruptor();
> + ASSERT_PAUTH_ENABLED();
> + if (sigsetjmp(jmpbuf, 1) == 0) {
> + sa.sa_sigaction = pac_signal_handler;
> + sa.sa_flags = SA_SIGINFO;
> + sigemptyset(&sa.sa_mask);
> + sigaction(SIGSEGV, &sa, NULL);
> + sigaction(SIGILL, &sa, NULL);
> + pac_corruptor();
> + ASSERT_TRUE(0) TH_LOG("SIGSEGV/SIGILL signal did not
> occur");
> + }
> }
>
> /*
> @@ -265,7 +283,7 @@ TEST(single_thread_different_keys)
>
> tmp = n_same_single_set(&signed_vals, nkeys);
>
---------------------------------------------------------------------------------------
>
>
>
> Thanks,
> Amit Daniel
>
> [1]:
>
https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=for-next/ptrauth
Okay, I will add this and post it with the next version.
Regards,
Boyan
next prev parent reply other threads:[~2020-09-17 14:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-31 11:04 [PATCH v2 0/4] kselftests/arm64: add PAuth tests Boyan Karatotev
2020-08-31 11:04 ` [PATCH v2 1/4] kselftests/arm64: add a basic Pointer Authentication test Boyan Karatotev
2020-09-16 12:11 ` Amit Kachhap
2020-09-17 13:38 ` Boyan Karatotev [this message]
2020-08-31 11:04 ` [PATCH v2 2/4] kselftests/arm64: add nop checks for PAuth tests Boyan Karatotev
2020-08-31 11:04 ` [PATCH v2 3/4] kselftests/arm64: add PAuth test for whether exec() changes keys Boyan Karatotev
2020-09-02 17:08 ` Dave Martin
2020-09-03 10:48 ` Boyan Karatotev
2020-09-07 10:35 ` Dave Martin
2020-08-31 11:04 ` [PATCH v2 4/4] kselftests/arm64: add PAuth tests for single threaded consistency and key uniqueness Boyan Karatotev
2020-08-31 21:04 ` [PATCH v2 0/4] kselftests/arm64: add PAuth tests Shuah Khan
2020-09-11 18:15 ` Will Deacon
2020-09-14 12:24 ` Vincenzo Frascino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fa24987e-c8e9-0130-d2bc-ec114a729491@gmail.com \
--to=boian4o1@gmail.com \
--cc=amit.kachhap@arm.com \
--cc=boyan.karatotev@arm.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=vincenzo.frascino@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox