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:	Mon, 1 Jun 2009 22:27:30 +0900
From:	Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To:	serue@...ibm.com
Cc:	linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] TOMOYO: Add garbage collector support. (v2)

Hello.

Serge E. Hallyn wrote:
> So yes, you might be able to get more review of your patch
> if you split it up into:
> 
> 	1. move allocations outside of semaphore
> 	2. add proper refcounting
> 	3. get rid of ->is_deleted

I'm ready to post part (1) and part (2).
But I'm not sure whether part (3) is worth to implement or not.

If we don't use is_deleted flag, we will need two "struct list_head"s,
one is for readers and writers, the other is for GC.

struct something {
	struct {
		struct list_head list;
		atomic_t users;
	} entry;
	int data;
	bool is_deleted;
} *p;

If we remove p from the list using list_del() (or list_del_rcu()) instead of
setting p->is_deleted to true, we have to somehow remember the element pointed
by p so that that element is reachable from the GC's list.
We can't wait for p->entry.users to become 0 inside writer function (which is
called only when modifying lists). Only GC function (which is called
repeatedly) can check whether p->entry.users == 0 or not because the element
pointed by p is long-lived. We need to remember the location of the element
pointed by p .

We can allocate memory when adding p to GC's list, but allocating memory at
list_del() (or list_del_rcu()) time could fail. It is not a good thing that
removing an element from the reader's list fails because of -ENOMEM. We already
have a way (i.e. is_deleted flag) to avoid -ENOMEM.

We can add another "struct list_head" to each element which is used by GC.
But that approach consumes more memory than is_deleted flag.

Regards.
--
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