linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Alexander Potapenko <glider@google.com>,
	Marco Elver <elver@google.com>,
	syzbot <syzbot+ce179bc99e64377c24bc@syzkaller.appspotmail.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Jiri Olsa <jolsa@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Ingo Molnar <mingo@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	the arch/x86 maintainers <x86@kernel.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	syzkaller <syzkaller@googlegroups.com>
Subject: Re: general protection fault in perf_misc_flags
Date: Wed, 30 Sep 2020 18:17:11 +0200	[thread overview]
Message-ID: <20200930161711.GH6810@zn.tnic> (raw)
In-Reply-To: <CACT4Y+bfKwoZe3SC-BKJkOET1GxGp9tCpLzkae8q1sjWYnmgmw@mail.gmail.com>

Hi,

one more thing I just spotted. The default install of syzkaller here
runs the guest with this on the kernel command line:

2020/09/30 17:56:18 running command: qemu-system-x86_64 []string{"-m", "2048",
"-smp", "2", "-display", ... "-append", "earlyprintk=serial oops=panic ...
 nmi_watchdog=panic panic_on_warn=1 panic=1 ftrace_dump_on_oops=orig_cpu rodata=n
									^^^^^^^^^^

which basically leaves guest kernel's memory RW and it gets caught
immediately on vm boot by CONFIG_DEBUG_WX.

This pretty much explains why kernel text can get corrupted with a stray
pointer write or so. So what's the use case for rodata=n?

[    2.478136] Kernel memory protection disabled.
		^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[    2.478689] x86/mm: Checking user space page tables
[    2.550163] ------------[ cut here ]------------
[    2.550736] x86/mm: Found insecure W+X mapping at address entry_SYSCALL_64+0x0/0x29
[    2.551612] WARNING: CPU: 1 PID: 1 at arch/x86/mm/dump_pagetables.c:246 note_page+0x81f/0x13a0
[    2.552577] Kernel panic - not syncing: panic_on_warn set ...
[    2.553240] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.9.0-rc7+ #5
[    2.553953] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1 04/01/2014
[    2.554922] Call Trace:
[    2.555233]  dump_stack+0x9c/0xcf
[    2.555633]  panic+0x250/0x5a0
[    2.556004]  ? __warn_printk+0xf8/0xf8
[    2.556450]  ? console_trylock+0xb0/0xb0
[    2.556914]  ? __warn.cold+0x5/0x44
[    2.557332]  ? note_page+0x81f/0x13a0
[    2.557768]  __warn.cold+0x20/0x44
[    2.558176]  ? note_page+0x81f/0x13a0
[    2.558641]  report_bug+0x168/0x1b0
[    2.559059]  handle_bug+0x3c/0x60
[    2.559458]  exc_invalid_op+0x14/0x40
[    2.559894]  asm_exc_invalid_op+0x12/0x20
[    2.560368] RIP: 0010:note_page+0x81f/0x13a0
[    2.560870] Code: 26 00 80 3d 9a d0 7f 02 00 0f 85 82 f9 ff ff e8 47 3c 26 00 4c 89 e6 48 c7 c7 40 aff
[    2.562951] RSP: 0000:ffff88800e9f7a90 EFLAGS: 00010282
[    2.563554] RAX: 0000000000000000 RBX: ffff88800e9f7e00 RCX: 0000000000000000
[    2.564361] RDX: ffff88800e9edb80 RSI: 0000000000000004 RDI: ffffed1001d3ef44
[    2.565167] RBP: 0000000000000200 R08: 0000000000000001 R09: 0000000000000003
[    2.565973] R10: ffffed1001d3eefd R11: 0000000000000001 R12: ffffffff96e00000
[    2.566780] R13: 00000000000001e3 R14: 0000000000000000 R15: ffff88800e9f7e58
[    2.567587]  ? __kprobes_text_end+0xb3598/0xb3598
[    2.568122]  ? __entry_text_end+0x1fea85/0x1fea85
[    2.568754]  ? __entry_text_end+0x1fea85/0x1fea85
[    2.569288]  ? __entry_text_end+0x1fea85/0x1fea85
[    2.569821]  ptdump_hole+0x61/0x90
[    2.570212]  ? ptdump_pte_entry+0x100/0x100
[    2.570712]  walk_pgd_range+0xdb8/0x15f0
[    2.571178]  walk_page_range_novma+0xd9/0x140
[    2.571689]  ? walk_page_range+0x2b0/0x2b0
[    2.572171]  ? console_unlock+0x58f/0xb10
[    2.572644]  ptdump_walk_pgd+0xcd/0x180
[    2.573099]  ptdump_walk_pgd_level_core+0x13c/0x1b0
[    2.573663]  ? effective_prot+0xb0/0xb0
[    2.574117]  ? vprintk_emit+0x214/0x380
[    2.574601]  ? ptdump_walk_pgd_level_core+0x1b0/0x1b0
[    2.575186]  ? memtype_copy_nth_element+0x1a0/0x1a0
[    2.575752]  ? __kprobes_text_end+0xb3598/0xb3598
[    2.576300]  ? pti_user_pagetable_walk_pmd+0x130/0x460
[    2.576894]  ? __kprobes_text_end+0xb3598/0xb3598
[    2.577441]  ? __kprobes_text_end+0xb3598/0xb3598
[    2.577988]  ? __kprobes_text_end+0xb3598/0xb3598
[    2.578564]  ? rest_init+0xdd/0xdd
[    2.578972]  ptdump_walk_user_pgd_level_checkwx.cold+0x31/0x36
[    2.579640]  pti_finalize+0x7b/0x170
[    2.580066]  kernel_init+0x5b/0x183
[    2.580484]  ret_from_fork+0x22/0x30
[    2.581010] Dumping ftrace buffer:
[    2.581456]    (ftrace buffer empty)
ffffffffbfffffff)
[    2.583137] Rebooting in 1 seconds..
2020/09/30 17:56:23 failed to create instance: failed to read from qemu: EOF

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

  reply	other threads:[~2020-09-30 16:17 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-19  8:32 general protection fault in perf_misc_flags syzbot
2020-09-19 11:08 ` Borislav Petkov
2020-09-21  5:54   ` Dmitry Vyukov
2020-09-21  8:08     ` Dmitry Vyukov
2020-09-21 20:59       ` Nick Desaulniers
2020-09-21 22:13         ` Borislav Petkov
2020-09-22 18:56           ` Nick Desaulniers
2020-09-22 19:29             ` Borislav Petkov
2020-09-23  9:03             ` Borislav Petkov
2020-09-23  9:24               ` Dmitry Vyukov
2020-09-23 10:34                 ` Borislav Petkov
2020-09-23 15:20                   ` Dmitry Vyukov
2020-09-25 12:22                     ` Dmitry Vyukov
2020-09-26  0:32                       ` Nick Desaulniers
2020-09-26  6:46                         ` Dmitry Vyukov
2020-09-26 17:14                         ` Borislav Petkov
2020-09-26 11:21                     ` Borislav Petkov
2020-09-26 12:08                       ` Dmitry Vyukov
2020-09-22  5:15         ` Dmitry Vyukov
2020-09-22  5:16         ` Dmitry Vyukov
2020-09-27 14:57 ` Borislav Petkov
2020-09-28  5:18   ` Dmitry Vyukov
2020-09-28  6:06     ` Dmitry Vyukov
2020-09-28  8:38       ` Borislav Petkov
2020-09-28  8:40         ` Dmitry Vyukov
2020-09-28  8:54           ` Borislav Petkov
2020-09-28 10:33             ` Dmitry Vyukov
2020-09-28 20:23               ` Borislav Petkov
2020-09-29  8:33                 ` Borislav Petkov
2020-09-29 13:29                   ` Dmitry Vyukov
2020-09-30 16:17                     ` Borislav Petkov [this message]
2020-09-30 16:23                       ` Dmitry Vyukov
2020-09-30 16:29                         ` Dmitry Vyukov
2020-09-30 16:31                         ` Borislav Petkov
2020-10-01 10:23                           ` Dmitry Vyukov
2020-10-01 11:05                             ` Borislav Petkov
2020-09-28 20:51               ` Nick Desaulniers
2020-09-28 21:19                 ` Andy Lutomirski
2020-09-28  7:25     ` Marco Elver
2020-09-28 20:32     ` Nick Desaulniers
2020-09-29 13:27       ` Dmitry Vyukov

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=20200930161711.GH6810@zn.tnic \
    --to=bp@alien8.de \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=syzbot+ce179bc99e64377c24bc@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=syzkaller@googlegroups.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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).