lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191217142515.GB23152@redhat.com>
Date:   Tue, 17 Dec 2019 15:25:15 +0100
From:   Oleg Nesterov <oleg@...hat.com>
To:     chenqiwu <qiwuchen55@...il.com>
Cc:     Christian Brauner <christian.brauner@...ntu.com>,
        peterz@...radead.org, mingo@...nel.org, kernel-team@...roid.com,
        linux-kernel@...r.kernel.org, chenqiwu@...omi.com
Subject: Re: [PATCH v2] kernel/exit: do panic earlier to get coredump if
 global init task exit

On 12/17, chenqiwu wrote:
>
> @@ -728,6 +724,15 @@ void __noreturn do_exit(long code)
>                 panic("Attempted to kill the idle task!");
>
>         /*
> +        * If all threads of global init have exited, do panic imeddiately
> +        * to get the coredump to find any clue for init task in userspace.
> +        */
> +       if (unlikely(is_global_init(tsk) &&
> +               (atomic_read(&tsk->signal->live) == 1)))

Well, I guess this will work in practice, but in theory this is racy.

Suppose that signal->live == 2 and both threads exit in parallel. They
both can see tsk->signal->live == 2 before atomic_dec_and_test().

If you are fine with this race I won't object, but please add a comment.

But why can't you simply do

	--- x/kernel/exit.c
	+++ x/kernel/exit.c
	@@ -786,6 +786,8 @@ void __noreturn do_exit(long code)
		acct_update_integrals(tsk);
		group_dead = atomic_dec_and_test(&tsk->signal->live);
		if (group_dead) {
	+		if (unlikely(is_global_init(tsk)
	+			panic(...);
	 #ifdef CONFIG_POSIX_TIMERS
			hrtimer_cancel(&tsk->signal->real_timer);
			exit_itimers(tsk->signal);

?

Oleg.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ