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:	Thu, 24 Oct 2013 16:48:41 +0200 (CEST)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Sebastian Andrzej Siewior <bigeasy@...utronix.de>
cc:	linux-kernel@...r.kernel.org, jic23@...nel.org, lars@...afoo.de,
	gregkh@...uxfoundation.org
Subject: Re: [RFC PATCH] debugobject: add support for kref

On Thu, 24 Oct 2013, Sebastian Andrzej Siewior wrote:
>  
>  struct kref {
>  	atomic_t refcount;
> @@ -32,6 +33,9 @@ struct kref {
>  static inline void kref_init(struct kref *kref)
>  {
>  	atomic_set(&kref->refcount, 1);
> +#ifdef CONFIG_DEBUG_OBJECTS_KREF
> +	debug_object_init(kref, NULL);

I rather prefer to have a debug_obj_descr handed in. It also should
activate the object, because then you can catch freeing of an active
kref as well. With state INIT the free checks are not triggering.

>  /**
> @@ -70,6 +74,12 @@ static inline int kref_sub(struct kref *kref, unsigned int count,
>  {
>  	WARN_ON(release == NULL);
>  
> +#ifdef CONFIG_DEBUG_OBJECTS_KREF
> +	if (!debug_object_is_tracked(kref)) {
> +		debugobj_kref_splat(kref, release);
> +		return 0;

Why can't you use debug_object_active_state(kref, descr, 0, 0)? All it
needs is a return value which tells you whether the object is tracked
and its state is ACTIVE.

> +	}
> +#endif
>  	if (atomic_sub_and_test((int) count, &kref->refcount)) {
>  		release(kref);
>  		return 1;

What calls debug_object_free() for the kref? You seem to add tracking
objects without ever releasing them. Are you relying on kfree removing
the inactive object from the debugobjects tracking list?

Not really a good idea. There might be some different release function
than kfree. And it relies on DEBUG_OBJECTS_FREE being enabled.

So an explicit call to debug_objects_free() before release(kref) is
required. Otherwise your new check is going to fail even when the kref
is gone already.

Thanks,

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