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: <20070225104612.GM2045@elf.ucw.cz>
Date:	Sun, 25 Feb 2007 11:46:12 +0100
From:	Pavel Machek <pavel@....cz>
To:	"Rafael J. Wysocki" <rjw@...k.pl>
Cc:	LKML <linux-kernel@...r.kernel.org>, paulmck@...ux.vnet.ibm.com,
	ego@...ibm.com, akpm@...l.org, mingo@...e.hu, vatsa@...ibm.com,
	dipankar@...ibm.com, venkatesh.pallipadi@...el.com,
	Aneesh Kumar <aneesh.kumar@...il.com>
Subject: Re: [RFC][PATCH 4/7] Freezer: Fix vfork problem

Hi!

> Currently try_to_freeze_tasks() has to wait until all of the vforked processes
> exit and for this reason every user can make it fail.  To fix this problem
> we can introduce the additional process flag PF_FREEZER_SKIP to be used by tasks
> that do not want to be counted as freezable by the freezer and want to have
> TIF_FREEZE set nevertheless.  Then, this flag can be set by tasks using
> sys_vfork() before they call wait_for_completion() and cleared after they have
> woken up and called try_to_freeze().  In case such a task freezes with
> PF_FREEZER_SKIP set, refrigerator() clears this flag for the current task before
> calling frozen_process(current) to avoid having both PF_FREEZER_SKIP and
> PF_FROZEN set at the same time.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@...k.pl>

> @@ -1393,7 +1394,9 @@ long do_fork(unsigned long clone_flags,
>  		tracehook_report_clone_complete(clone_flags, nr, p);
>  
>  		if (clone_flags & CLONE_VFORK) {
> +			freezer_do_not_count();
>  			wait_for_completion(&vfork);
> +			freezer_count();
>  			tracehook_report_vfork_done(p, nr);
>  		}
>  	} else {

All the infrastructure for this...Would it be easier to introduce

void fastcall __sched wait_for_completion_freezeable(struct completion *x)
{
        might_sleep();

        spin_lock_irq(&x->wait.lock);
        if (!x->done) {
                DECLARE_WAITQUEUE(wait, current);

                wait.flags |= WQ_FLAG_EXCLUSIVE;
                __add_wait_queue_tail(&x->wait, &wait);
                do {
                        __set_current_state(TASK_UNINTERRUPTIBLE);
                        spin_unlock_irq(&x->wait.lock);
                        schedule();
try_to_freeze(); /* HERE */
                        spin_lock_irq(&x->wait.lock);
                } while (!x->done);
                __remove_wait_queue(&x->wait, &wait);
        }
        x->done--;
        spin_unlock_irq(&x->wait.lock);
}

...and be done with that, in a very obvious way? (Ok, you probably do
not want to duplicate the function, but you get the idea).
								Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ