Re: [Bug? Report] kref problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2006-03-16 at 08:53 -0800, Greg KH wrote:
> On Thu, Mar 16, 2006 at 02:41:19PM +0300, Artem B. Bityutskiy wrote:
> > struct my_obj_a
> > {
> > 	struct kobject kobj;
> > } a;
> > 
> > struct my_obj_b
> > {
> > 	struct kobject kobj;
> > } b;
> 
> Don't statically create kobjects, it's not nice.  But the real problem
> is below...

This seems to be one of those top ten sysfs snafus.  Could we take the
definitions from include/asm-generic/sections.h, and make a kobject
verification function to put in the critical generic kernel functions
that deal with kobjects,  like kobject_init()?

Somthing like...

void verify_dynamic_kobject_allocation(struct kobject *kobj)
{
	if (kobj >= &_data && kobj < &_edata)
		goto warn;
	if (kobj >= &_bss_start && kobj < &_bss_end)
		goto warn;
	...
	return;
warn:
	printk(KERN_WARN "statically allocated kobject, you suck...\n");
}

I'm not sure that all of the architectures fill in all of the values,
but we could at least support the warnings for the ones that do.  That
includes at least i386, so it could be a relatively effective tool.

I'll cook up a real patch in a bit.

-- Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux