linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Will Deacon <will@kernel.org>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>
Subject: Re: linux-next: manual merge of the akpm-current tree with the arm64 tree
Date: Tue, 13 Apr 2021 10:14:29 +0100	[thread overview]
Message-ID: <20210413091429.GA15806@arm.com> (raw)
In-Reply-To: <20210413185936.5095cb11@canb.auug.org.au>

On Tue, Apr 13, 2021 at 06:59:36PM +1000, Stephen Rothwell wrote:
> diff --cc lib/test_kasan.c
> index 785e724ce0d8,bf9225002a7e..000000000000
> --- a/lib/test_kasan.c
> +++ b/lib/test_kasan.c
> @@@ -78,33 -83,30 +83,35 @@@ static void kasan_test_exit(struct kuni
>    * fields, it can reorder or optimize away the accesses to those fields.
>    * Use READ/WRITE_ONCE() for the accesses and compiler barriers around the
>    * expression to prevent that.
> +  *
> +  * In between KUNIT_EXPECT_KASAN_FAIL checks, fail_data.report_found is kept as
> +  * false. This allows detecting KASAN reports that happen outside of the checks
> +  * by asserting !fail_data.report_found at the start of KUNIT_EXPECT_KASAN_FAIL
> +  * and in kasan_test_exit.
>    */
> - #define KUNIT_EXPECT_KASAN_FAIL(test, expression) do {		\
> - 	if (IS_ENABLED(CONFIG_KASAN_HW_TAGS) &&			\
> - 	    !kasan_async_mode_enabled())			\
> - 		migrate_disable();				\
> - 	WRITE_ONCE(fail_data.report_expected, true);		\
> - 	WRITE_ONCE(fail_data.report_found, false);		\
> - 	kunit_add_named_resource(test,				\
> - 				NULL,				\
> - 				NULL,				\
> - 				&resource,			\
> - 				"kasan_data", &fail_data);	\
> - 	barrier();						\
> - 	expression;						\
> - 	barrier();						\
> - 	if (kasan_async_mode_enabled())				\
> - 		kasan_force_async_fault();			\
> - 	barrier();						\
> - 	KUNIT_EXPECT_EQ(test,					\
> - 			READ_ONCE(fail_data.report_expected),	\
> - 			READ_ONCE(fail_data.report_found));	\
> - 	if (IS_ENABLED(CONFIG_KASAN_HW_TAGS) &&			\
> - 	    !kasan_async_mode_enabled()) {			\
> - 		if (READ_ONCE(fail_data.report_found))		\
> - 			kasan_enable_tagging_sync();		\
> - 		migrate_enable();				\
> - 	}							\
> + #define KUNIT_EXPECT_KASAN_FAIL(test, expression) do {			\
>  -	if (IS_ENABLED(CONFIG_KASAN_HW_TAGS))				\
> ++	if (IS_ENABLED(CONFIG_KASAN_HW_TAGS) &&				\
> ++	    !kasan_async_mode_enabled())				\
> + 		migrate_disable();					\
> + 	KUNIT_EXPECT_FALSE(test, READ_ONCE(fail_data.report_found));	\
> + 	WRITE_ONCE(fail_data.report_expected, true);			\
> + 	barrier();							\
> + 	expression;							\
> + 	barrier();							\
> ++	if (kasan_async_mode_enabled())					\
> ++		kasan_force_async_fault();				\
> ++	barrier();							\
> + 	KUNIT_EXPECT_EQ(test,						\
> + 			READ_ONCE(fail_data.report_expected),		\
> + 			READ_ONCE(fail_data.report_found));		\
>  -	if (IS_ENABLED(CONFIG_KASAN_HW_TAGS)) {				\
> ++	if (IS_ENABLED(CONFIG_KASAN_HW_TAGS) &&				\
> ++	    !kasan_async_mode_enabled()) {				\
> + 		if (READ_ONCE(fail_data.report_found))			\
>  -			kasan_enable_tagging();				\
> ++			kasan_enable_tagging_sync();			\
> + 		migrate_enable();					\
> + 	}								\
> + 	WRITE_ONCE(fail_data.report_found, false);			\
> + 	WRITE_ONCE(fail_data.report_expected, false);			\
>   } while (0)
>   
>   #define KASAN_TEST_NEEDS_CONFIG_ON(test, config) do {			\

Thanks Stephen. The resolution looks correct.

Andrew, if you'd rather I dropped the MTE async mode support from the
arm64 tree please let me know. Thanks.

https://lore.kernel.org/r/20210315132019.33202-1-vincenzo.frascino@arm.com/

-- 
Catalin

  reply	other threads:[~2021-04-13  9:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13  8:59 linux-next: manual merge of the akpm-current tree with the arm64 tree Stephen Rothwell
2021-04-13  9:14 ` Catalin Marinas [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-10-08  6:04 Stephen Rothwell
2021-10-08  7:37 ` Will Deacon
2020-12-03  8:06 Stephen Rothwell
2020-12-03 11:16 ` Catalin Marinas
2020-09-21  8:03 Stephen Rothwell
2020-09-21  8:12 ` Catalin Marinas
2020-10-13  7:34 ` Stephen Rothwell
2020-07-16  8:00 Stephen Rothwell
2020-07-16  8:23 ` Will Deacon
2020-04-30  6:26 Stephen Rothwell
2020-04-29  6:53 Stephen Rothwell
2019-08-07  6:39 Stephen Rothwell
2018-12-13  6:01 Stephen Rothwell
2018-12-13 11:12 ` Will Deacon
2018-12-11  6:11 linux-next: manual merge of the akpm-current tree with the FIXME tree Stephen Rothwell
2018-12-11  6:12 ` linux-next: manual merge of the akpm-current tree with the arm64 tree Stephen Rothwell
2018-12-11 10:39   ` Will Deacon
2018-12-11  6:02 Stephen Rothwell
2018-09-24  4:38 Stephen Rothwell
2018-09-24  9:32 ` Catalin Marinas
2018-07-27 10:55 Stephen Rothwell
2018-08-16  0:11 ` Stephen Rothwell
2017-11-06  5:33 Stephen Rothwell
2016-09-27  6:03 Stephen Rothwell
2016-06-22  4:54 Stephen Rothwell
2015-12-16  5:01 Stephen Rothwell
2015-12-16 10:14 ` Will Deacon
2014-09-23  7:23 Stephen Rothwell
2014-09-23  8:36 ` Catalin Marinas
2014-07-24  8:42 Stephen Rothwell

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=20210413091429.GA15806@arm.com \
    --to=catalin.marinas@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=andreyknvl@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --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;
as well as URLs for NNTP newsgroup(s).