From: Jiri Olsa <jolsa@redhat.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>,
luca abeni <luca.abeni@santannapisa.it>,
Thomas Gleixner <tglx@linutronix.de>,
Oleg Nesterov <oleg@redhat.com>,
syzkaller <syzkaller@googlegroups.com>
Subject: Re: perf_event_open+clone = unkillable process
Date: Sat, 2 Feb 2019 19:30:45 +0100 [thread overview]
Message-ID: <20190202183013.GA10522@krava> (raw)
In-Reply-To: <CACT4Y+YdVewFEmw2wFrnaHOc78b4bMZ4Nfu0uEzLk08UtvwOMA@mail.gmail.com>
On Fri, Feb 01, 2019 at 06:06:03PM +0100, Dmitry Vyukov wrote:
> On Fri, Feb 1, 2019 at 5:48 PM Dmitry Vyukov <dvyukov@google.com> wrote:
> >
> > Hello,
> >
> > The following program creates an unkillable process that eats CPU.
> > /proc/pid/stack is empty, I am not sure what other info I can provide.
> >
> > Tested is on upstream commit 4aa9fc2a435abe95a1e8d7f8c7b3d6356514b37a.
> > Config is attached.
>
> Looking through other reproducers that create unkillable processes, I
> think I found a much simpler reproducer (below). It's single threaded
> and just setups SIGBUS handler and does timer_create+timer_settime to
> send repeated SIGBUS. The resulting process can't be killed with
> SIGKILL.
> +Thomas for timers.
nice, I managed to kill it by strace ;-)
[jolsa@krava perf]$ strace -p 10725
strace: Process 10725 attached
--- stopped by SIGBUS ---
--- stopped by SIGBUS ---
--- stopped by SIGBUS ---
--- stopped by SIGBUS ---
+++ killed by SIGINT +++
+Oleg
jirka
>
>
> // autogenerated by syzkaller (https://github.com/google/syzkaller)
>
> #define _GNU_SOURCE
>
> #include <endian.h>
> #include <setjmp.h>
> #include <signal.h>
> #include <stdint.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <sys/syscall.h>
> #include <sys/types.h>
> #include <unistd.h>
>
> static __thread int skip_segv;
> static __thread jmp_buf segv_env;
>
> static void segv_handler(int sig, siginfo_t* info, void* ctx)
> {
> uintptr_t addr = (uintptr_t)info->si_addr;
> const uintptr_t prog_start = 1 << 20;
> const uintptr_t prog_end = 100 << 20;
> if (__atomic_load_n(&skip_segv, __ATOMIC_RELAXED) &&
> (addr < prog_start || addr > prog_end)) {
> _longjmp(segv_env, 1);
> }
> exit(sig);
> }
>
> static void install_segv_handler(void)
> {
> struct sigaction sa;
> memset(&sa, 0, sizeof(sa));
> sa.sa_handler = SIG_IGN;
> syscall(SYS_rt_sigaction, 0x20, &sa, NULL, 8);
> syscall(SYS_rt_sigaction, 0x21, &sa, NULL, 8);
> memset(&sa, 0, sizeof(sa));
> sa.sa_sigaction = segv_handler;
> sa.sa_flags = SA_NODEFER | SA_SIGINFO;
> sigaction(SIGSEGV, &sa, NULL);
> sigaction(SIGBUS, &sa, NULL);
> }
>
> int main(void)
> {
> syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0);
> install_segv_handler();
> int tid = syscall(__NR_gettid);
> *(uint64_t*)0x20000000 = 0;
> *(uint32_t*)0x20000008 = 7;
> *(uint32_t*)0x2000000c = 4;
> *(uint32_t*)0x20000010 = tid;
> syscall(__NR_timer_create, 0, 0x20000000, 0x20000080);
> *(uint64_t*)0x2004a000 = 0;
> *(uint64_t*)0x2004a008 = 1;
> *(uint64_t*)0x2004a010 = 7;
> *(uint64_t*)0x2004a018 = 0xe4c;
> syscall(__NR_timer_settime, 0, 3, 0x2004a000, 0);
> return 0;
> }
next prev parent reply other threads:[~2019-02-02 18:36 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-01 16:48 perf_event_open+clone = unkillable process Dmitry Vyukov
2019-02-01 17:06 ` Dmitry Vyukov
2019-02-02 18:30 ` Jiri Olsa [this message]
2019-02-03 15:21 ` Jiri Olsa
2019-02-04 9:27 ` Thomas Gleixner
2019-02-04 9:38 ` Dmitry Vyukov
2019-02-04 17:38 ` Thomas Gleixner
2019-02-05 3:00 ` Eric W. Biederman
2019-02-05 4:27 ` Eric W. Biederman
2019-02-05 6:07 ` Eric W. Biederman
2019-02-05 15:26 ` [RFC][PATCH] signal: Store pending signal exit in tsk.jobctl not in tsk.pending Eric W. Biederman
2019-02-06 12:09 ` Dmitry Vyukov
2019-02-06 21:47 ` Eric W. Biederman
2019-02-06 18:07 ` Oleg Nesterov
2019-02-06 22:25 ` Eric W. Biederman
2019-02-07 6:42 ` [PATCH 0/2]: Fixing unkillable processes caused by SIGHUP timers Eric W. Biederman
2019-02-07 6:43 ` [PATCH 1/2] signal: Always notice exiting tasks Eric W. Biederman
2019-02-11 14:13 ` Oleg Nesterov
2019-02-12 0:42 ` Eric W. Biederman
2019-02-12 8:18 ` Eric W. Biederman
2019-02-12 16:50 ` Oleg Nesterov
2019-02-13 3:58 ` Eric W. Biederman
2019-02-13 4:09 ` [PATCH] signal: Restore the stop PTRACE_EVENT_EXIT Eric W. Biederman
2019-02-13 13:55 ` Oleg Nesterov
2019-02-13 14:38 ` Oleg Nesterov
2019-02-13 14:58 ` Eric W. Biederman
2019-02-07 6:44 ` [PATCH 2/2] signal: Better detection of synchronous signals Eric W. Biederman
2019-02-11 15:18 ` Oleg Nesterov
2019-02-12 0:01 ` Eric W. Biederman
2019-02-12 17:21 ` Oleg Nesterov
2019-02-07 11:46 ` [PATCH 0/2]: Fixing unkillable processes caused by SIGHUP timers 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=20190202183013.GA10522@krava \
--to=jolsa@redhat.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=dvyukov@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.abeni@santannapisa.it \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=syzkaller@googlegroups.com \
--cc=tglx@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.