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]
Date:   Wed, 10 Mar 2021 16:13:06 -0600
From:   ebiederm@...ssion.com (Eric W. Biederman)
To:     Oleg Nesterov <oleg@...hat.com>
Cc:     qianli zhao <zhaoqianligood@...il.com>, christian@...uner.io,
        axboe@...nel.dk, Thomas Gleixner <tglx@...utronix.de>,
        Peter Collingbourne <pcc@...gle.com>,
        linux-kernel@...r.kernel.org, Qianli Zhao <zhaoqianli@...omi.com>
Subject: Re: [PATCH] exit: trigger panic when init process is set to SIGNAL_GROUP_EXIT

Oleg Nesterov <oleg@...hat.com> writes:

> On 03/10, Eric W. Biederman wrote:
>>
>> 	/* If global init has exited,
>>          * panic immediately to get a useable coredump.
>>          */
>> 	if (unlikely(is_global_init(tsk) &&
>> 	    (thread_group_empty(tsk) ||
>>             (tsk->signal->flags & SIGNAL_GROUP_EXIT)))) {
>> 		panic("Attempted to kill init!	exitcode=0x%08x\n",
>>                 	tsk->signal->group_exit_code ?: (int)code);
>> 	}
>>
>> The thread_group_empty test is needed to handle single threaded
>> inits.
>
> But we can't rely on thread_group_empty(). Just suppose that the main
> thread exit first, then the 2nd (last) thread exits too.

It took me a minute.  I think you are pointing out that there is a case
where we do not set SIGNAL_GROUP_EXIT and that init actually exits.

The case where all of the threads do pthread_exit() aka do_exit().

I think that implies that to have a comprehensive test would
need to do:

	group_dead = atomic_dec_and_test(&tsk->signal->live);

	/* If global init has exited,
	 * panic immediately to get a useable coredump.
	*/
	if (unlikely(is_global_init(tsk) &&
	    (group_dead || thread_group_empty(tsk) ||
             (tsk->signal->flags & SIGNAL_GROUP_EXIT)))) {
		panic("Attempted to kill init!	exitcode=0x%08x\n",
		tsk->signal->group_exit_code ?: (int)code);
	}

Leaving the test where it is.  Yes.  I think that should work.


Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ