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: <alpine.LFD.1.10.0808290854000.3300@nehalem.linux-foundation.org>
Date:	Fri, 29 Aug 2008 09:05:16 -0700 (PDT)
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Yinghai Lu <yhlu.kernel@...il.com>
cc:	Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jesse Barnes <jbarnes@...tuousgeek.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86: split e820 reserved entries record to late v4 -
 fix



On Fri, 29 Aug 2008, Yinghai Lu wrote:
>
> try to insert_resource second time, by expand the resource...

I would hold off on this unless it's shown to actually be needed. And _if_ 
it is needed, I would just make a new function for doing this all: 
"insert_resource_expand_to_fit()"

That said, I think the insert_resource()/__insert_resource() change is 
pretty ok. However, it doesn't follow the rules, and is racy. The rules 
for resources are:

 - the "internal" version (with the "__" prepended) is static to 
   resource.c, because it must not be called from outside, which is in 
   turn because:

 - it must be called with the lock taken by the caller, because otherwise 
   returning a "struct resource *" is racy - the resource is not protected
   by anything!

So the "insert_resource_expand_to_fit()" thing would look something like 
this:

	void insert_resource_expand_to_fit(struct resource *root, struct resource *new)
	{
		write_lock(&resource_lock);
		while (new->start && new->parent) {
			struct resource *conflict;

			conflict = __insert_resource(root, new);
			if (!conflict)
				break;
			if (conflict->start < new->start)
				new->start = conflict->start;
			if (conflict->end > new->end)
				new->end = conflict->end;
		}
		write_unlock(&resource_lock);
	}

but the above is obviously _totally_ untested.

		Linus
--
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