public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Matthew Maurer <mmaurer@google.com>,
	Miguel Ojeda <ojeda@kernel.org>,
	Sabyrzhan Tasbolatov <snovitoll@gmail.com>
Subject: linux-next: manual merge of the mm tree with Linus' tree
Date: Mon, 30 Sep 2024 09:56:48 +1000	[thread overview]
Message-ID: <20240930095648.40f7cbaf@canb.auug.org.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 2665 bytes --]

Hi all,

Today's linux-next merge of the mm tree got a conflict in:

  mm/kasan/kasan_test_c.c

between commit:

  a2f115470520 ("kasan: rust: Add KASAN smoke test via UAF")

from Linus' tree and commit:

  88ad9dc30bbf ("mm, kasan: instrument copy_from/to_kernel_nofault")

from the mm tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc mm/kasan/kasan_test_c.c
index a181e4780d9d,329d815185a5..000000000000
--- a/mm/kasan/kasan_test_c.c
+++ b/mm/kasan/kasan_test_c.c
@@@ -1944,16 -1944,36 +1944,46 @@@ static void match_all_mem_tag(struct ku
  	kfree(ptr);
  }
  
 +/*
 + * Check that Rust performing a use-after-free using `unsafe` is detected.
 + * This is a smoke test to make sure that Rust is being sanitized properly.
 + */
 +static void rust_uaf(struct kunit *test)
 +{
 +	KASAN_TEST_NEEDS_CONFIG_ON(test, CONFIG_RUST);
 +	KUNIT_EXPECT_KASAN_FAIL(test, kasan_test_rust_uaf());
 +}
 +
+ static void copy_from_to_kernel_nofault_oob(struct kunit *test)
+ {
+ 	char *ptr;
+ 	char buf[128];
+ 	size_t size = sizeof(buf);
+ 
+ 	/* Not detecting fails currently with HW_TAGS */
+ 	KASAN_TEST_NEEDS_CONFIG_OFF(test, CONFIG_KASAN_HW_TAGS);
+ 
+ 	ptr = kmalloc(size - KASAN_GRANULE_SIZE, GFP_KERNEL);
+ 	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
+ 	OPTIMIZER_HIDE_VAR(ptr);
+ 
+ 	if (IS_ENABLED(CONFIG_KASAN_SW_TAGS)) {
+ 		/* Check that the returned pointer is tagged. */
+ 		KUNIT_EXPECT_GE(test, (u8)get_tag(ptr), (u8)KASAN_TAG_MIN);
+ 		KUNIT_EXPECT_LT(test, (u8)get_tag(ptr), (u8)KASAN_TAG_KERNEL);
+ 	}
+ 
+ 	KUNIT_EXPECT_KASAN_FAIL(test,
+ 		copy_from_kernel_nofault(&buf[0], ptr, size));
+ 	KUNIT_EXPECT_KASAN_FAIL(test,
+ 		copy_from_kernel_nofault(ptr, &buf[0], size));
+ 	KUNIT_EXPECT_KASAN_FAIL(test,
+ 		copy_to_kernel_nofault(&buf[0], ptr, size));
+ 	KUNIT_EXPECT_KASAN_FAIL(test,
+ 		copy_to_kernel_nofault(ptr, &buf[0], size));
+ 	kfree(ptr);
+ }
+ 
  static struct kunit_case kasan_kunit_test_cases[] = {
  	KUNIT_CASE(kmalloc_oob_right),
  	KUNIT_CASE(kmalloc_oob_left),
@@@ -2027,7 -2047,7 +2057,8 @@@
  	KUNIT_CASE(match_all_not_assigned),
  	KUNIT_CASE(match_all_ptr_tag),
  	KUNIT_CASE(match_all_mem_tag),
 +	KUNIT_CASE(rust_uaf),
+ 	KUNIT_CASE(copy_from_to_kernel_nofault_oob),
  	{}
  };
  

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2024-09-29 23:56 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-29 23:56 Stephen Rothwell [this message]
2024-09-30  6:01 ` linux-next: manual merge of the mm tree with Linus' tree Miguel Ojeda
  -- strict thread matches above, loose matches on Subject: below --
2025-02-09 22:39 Stephen Rothwell
2024-09-16 23:27 Stephen Rothwell
2024-09-17 23:40 ` Stephen Rothwell
2024-09-09  0:00 Stephen Rothwell
2024-09-09  1:53 ` Huang, Ying
2024-09-17 23:36 ` Stephen Rothwell
2024-07-28 22:41 Stephen Rothwell
2024-07-28 22:45 ` Stephen Rothwell
2024-07-28 23:31   ` Andrew Morton
2024-05-09 23:22 Stephen Rothwell
2023-07-27 23:18 Stephen Rothwell
2023-07-27 23:29 ` Stephen Rothwell
2023-07-27 23:40   ` Suren Baghdasaryan
2023-07-27 23:50     ` Matthew Wilcox
2023-07-28  0:08       ` Suren Baghdasaryan
2023-07-28  0:00   ` Stephen Rothwell
2023-07-28  3:13     ` Matthew Wilcox
2023-07-27 23:49 ` Matthew Wilcox
2023-07-28  0:21   ` Stephen Rothwell
2023-07-28  0:23     ` Suren Baghdasaryan
2023-07-28  0:29       ` Stephen Rothwell
2023-07-28  0:30         ` Suren Baghdasaryan
2023-07-06 22:54 Stephen Rothwell
2023-07-07  4:52 ` Baoquan He
2023-06-18 23:23 Stephen Rothwell
2023-06-19 20:25 ` Andrew Morton
2023-06-19 20:43 ` Will Deacon
2023-06-19 21:39   ` Andrew Morton
2023-06-20  9:43     ` Will Deacon
2023-06-20 15:00       ` Jain, Ayush
2023-02-24 23:39 Stephen Rothwell
2023-02-25  2:04 ` Andrew Morton
2023-02-25  7:13   ` Christian Brauner
2023-02-25 20:52     ` Andrew Morton
2023-02-27 10:18       ` Christian Brauner
2023-02-27 17:55         ` Andrew Morton
2022-11-07  2:52 Stephen Rothwell
2022-09-06  9:01 Stephen Rothwell
2022-09-06  9:21 ` Rolf Eike Beer
2022-05-26  6:09 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=20240930095648.40f7cbaf@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mmaurer@google.com \
    --cc=ojeda@kernel.org \
    --cc=snovitoll@gmail.com \
    /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