From: David Hildenbrand <david@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: syzbot <syzbot+d8426b591c36b21c750e@syzkaller.appspotmail.com>,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, pasha.tatashin@soleen.com,
syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [mm?] WARNING in __page_table_check_ptes_set
Date: Mon, 22 Apr 2024 17:10:15 +0200 [thread overview]
Message-ID: <bb3605e1-81e6-45a3-bd08-79662b371049@redhat.com> (raw)
In-Reply-To: <ZiZmCl3fTFfIYf1t@x1n>
>> commit f369b07c861435bd812a9d14493f71b34132ed6f
>> Author: Peter Xu <peterx@redhat.com>
>> Date: Thu Aug 11 16:13:40 2022 -0400
>>
>> mm/uffd: reset write protection when unregister with wp-mode
>>
>>
>> close should behave just like unregister.
>>
>>
>> Simplified+readable reproducer:
>>
>> #define _GNU_SOURCE
>>
>> #include <stdint.h>
>> #include <fcntl.h>
>> #include <sys/syscall.h>
>> #include <sys/mman.h>
>> #include <sys/types.h>
>> #include <sys/ioctl.h>
>> #include <linux/userfaultfd.h>
>> #include <unistd.h>
>>
>> int main(void)
>> {
>> void *src = mmap(0, 4096, PROT_READ, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
>> void *dst = mmap(0, 4096, PROT_READ, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
>> struct uffdio_register uffdio_register = {};
>> struct uffdio_copy uffdio_copy = {};
>> struct uffdio_api uffdio_api = {};
>> int uffd;
>>
>> uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK | UFFD_USER_MODE_ONLY);
>> uffdio_api.api = UFFD_API;
>> ioctl(uffd, UFFDIO_API, &uffdio_api);
>>
>> uffdio_register.range.start = (uintptr_t)dst;
>> uffdio_register.range.len = 4096;
>> uffdio_register.mode = UFFDIO_REGISTER_MODE_WP;
>> ioctl(uffd, UFFDIO_REGISTER, &uffdio_register);
>>
>> uffdio_copy.dst = (uintptr_t)dst;
>> uffdio_copy.src = (uintptr_t)src;
>> uffdio_copy.len = 4096;
>> uffdio_copy.mode = UFFDIO_COPY_MODE_DONTWAKE|UFFDIO_COPY_MODE_WP;
>> ioctl(uffd, UFFDIO_COPY, &uffdio_copy);
>>
>> close(uffd);
>>
>> mprotect(dst, 4096, PROT_READ|PROT_WRITE);
>> return 0;
>> }
>
> Thanks, I'll post a patch.
>
> PS: next time feel free to try "strace ./reproducer", it'll do the
> translations and I found it handy to work with syzbot.
Cool, was not aware that it would do that amount of translation!
--
Cheers,
David / dhildenb
prev parent reply other threads:[~2024-04-22 15:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-21 20:16 syzbot
2024-04-22 10:07 ` David Hildenbrand
2024-04-22 10:38 ` David Hildenbrand
2024-04-22 11:46 ` David Hildenbrand
2024-04-22 13:28 ` Peter Xu
2024-04-22 15:10 ` David Hildenbrand [this message]
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=bb3605e1-81e6-45a3-bd08-79662b371049@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@soleen.com \
--cc=peterx@redhat.com \
--cc=syzbot+d8426b591c36b21c750e@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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