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: <20101004095606.GB1867@silverbox.local>
Date:	Mon, 4 Oct 2010 11:56:06 +0200
From:	"Hans J. Koch" <hjk@...utronix.de>
To:	"Eric W. Biederman" <ebiederm@...ssion.com>
Cc:	Greg KH <greg@...ah.com>, Greg KH <gregkh@...e.de>,
	"Hans J. Koch" <hjk@...utronix.de>, linux-kernel@...r.kernel.org,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 4/5] libunload: A library to help remove open files

On Sun, Sep 26, 2010 at 03:48:44PM -0700, Eric W. Biederman wrote:

This doesn't build, see below.

Thanks,
Hans

[...]
> +}
> +EXPORT_SYMBOL_GPL(unload_release_unlock);
> +
> +
> +void unload_barrier(struct unload *unload)
> +{
> +	struct unload_barrier barrier;
> +	struct unload_file *ufile;
> +	struct hlist_node *pos;
> +
> +	/* Guarantee that when this function returns I am not
> +	 * executing any code protected by the unload_lock or
> +	 * unload_releas_lock, and that I will never again execute
> +	 * code protected by those locks.
> +	 *
> +	 * Also guarantee the file count for every file remaining on
> +	 * the unload ufiles list has been incremented.  The increment
> +	 * of the file count guarantees __fput will not be called.
> +	 */
> +	init_completion(&barrier.completion);
> +	barrier.releasers = 0;
> +
> +	spin_lock(&unload->lock);
> +	unload->barrier = &barrier;
> +
> +	hlist_for_each_entry(ufile, pos, &unload->ufiles, list)
> +		if (!atomic_long_inc_not_zero(&ufile->file->f_count))
> +			barrier.releasers++;
> +	unload->active--;
> +	if (unload->active || barrier.releasers) {
> +		spin_unlock(&unload->lock);
> +		wait_for_completion(&barrier.completion);
> +		spin_lock(&unload->lock);
> +	}
> +	spin_unlock(&unload->lock);
> +}

There's an EXPORT_SYMBOL_GPL(unload_barrier) missing here...

> diff --git a/include/linux/unload.h b/include/linux/unload.h
> new file mode 100644
> index 0000000..fc1b4f6
> --- /dev/null
> +++ b/include/linux/unload.h
> @@ -0,0 +1,33 @@
> +#ifndef _LINUX_UNLOAD_H
> +#define _LINUX_UNLOAD_H
> +
> +#include <linux/list.h>
> +
> +struct file;
> +struct vm_operations_struct;
> +struct unload_barrier;
> +
> +struct unload {
> +	struct hlist_head	ufiles;
> +	struct unload_barrier	*barrier;
> +	spinlock_t		lock;
> +	int			active;
> +};
> +
> +struct unload_file {
> +	struct unload		*unload;
> +	struct hlist_node	list;
> +	struct file 		*file;
> +};
> +
> +void unload_init(struct unload *unload);
> +void unload_file_init(struct unload_file *ufile, struct file *file, struct unload *unload);
> +bool unload_trylock(struct unload *unload);
> +void unload_unlock(struct unload *unload);
> +bool unload_release_trylock(struct unload_file *ufile);
> +void unload_release_unlock(struct unload_file *ufile);
> +void unload_file_attach(struct unload_file *ufile, struct unload *unload);
> +void unload_file_detach(struct unload_file *ufile);
> +struct unload_file *find_unload_file(struct unload *unload, struct file *file);
> +void unload_barrier(struct unload *unload);
> +#endif /* _LINUX_UNLOAD_H */
> -- 
> 1.7.2.2
--
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