linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Lamparter <chunkeey@web.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Artur Skawina <art.08.09@gmail.com>,
	linux-wireless@vger.kernel.org
Subject: Re: wireless-testing, p54 and sinus 154 data no longer works
Date: Fri, 16 Jan 2009 21:38:51 +0100	[thread overview]
Message-ID: <200901162138.51855.chunkeey@web.de> (raw)
In-Reply-To: <1232097187.3854.9.camel@johannes>

[-- Attachment #1: Type: text/plain, Size: 980 bytes --]

On Friday 16 January 2009 10:13:07 Johannes Berg wrote:
> On Thu, 2009-01-15 at 21:18 -0600, Larry Finger wrote:
> 
> > >>   Object 0xddec18d0:  >69< 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b ikkkkkkkkkkkkkkk
> 
> > I too have seen real single bit changes - in my case 6b went to 6a,
> > and my memory is fine. I wouldn't necessarily blame your hardware.
> 
> 6b to 6a is often the result of a refcounting bug that happens to unref
> a value _after_ it has been freed. But that doesn't explain 6b to 69,
> unless you happen to have _two_ refcounting bugs. Not that I necessarily
> think that memory is bad
Well, this idiotic debug patch (kref-kernel-debug-patch) could shed some light into
the problem who's using a freed skb. 
(and please, I _know_ there is already a better solution for this refcount-thing... but where?)

Of course, there's some sample code to test it... see refcount-test-module.c

BTW, & 0xfffffff0) == 0x6b6b6b60); can detect even more...

Regards,
	Chr

[-- Attachment #2: kref-kernel-debug.patch --]
[-- Type: text/x-patch, Size: 420 bytes --]

diff --git a/lib/kref.c b/lib/kref.c
index 9ecd6e8..e143fd8 100644
--- a/lib/kref.c
+++ b/lib/kref.c
@@ -64,6 +64,8 @@ int kref_put(struct kref *kref, void (*release)(struct kref *kref))
 	WARN_ON(release == NULL);
 	WARN_ON(release == (void (*)(struct kref *))kfree);
 
+	WARN_ON((atomic_read(&kref->refcount) & 0xffffffff) == 0x6b6b6b6b);
+
 	if (atomic_dec_and_test(&kref->refcount)) {
 		release(kref);
 		return 1;

[-- Attachment #3: refcount-test-module.c --]
[-- Type: text/x-csrc, Size: 1346 bytes --]

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/kref.h>

static void reftst_release(struct kref *ref)
{
	printk(KERN_INFO "released %p\n", ref);
}

static void reftst_static_simple_test(void)
{
	struct kref test;
	printk(KERN_INFO "RefTest - Static\n");
	kref_init(&test);
	kref_get(&test);
	kref_put(&test, reftst_release);
	kref_put(&test, reftst_release);
}

static void reftst_static_watermark_test(void)
{
	struct kref test;
	printk(KERN_INFO "RefTest - Watermark test\n");
	kref_init(&test);
	kref_set(&test, 0x6b6b6b6b);
	kref_put(&test, reftst_release);
}

struct reftst_struct {
	u8 redzone[32];	/* or just 8 */
	struct kref ref;
	u8 redzone2[32];
};

static void reftst_static_poison_test(void)
{
	struct reftst_struct *test = kzalloc(sizeof(*test), GFP_KERNEL);

	if (!test)
		return;

	printk(KERN_INFO "RefTest - slXb poison test\n");
	kref_init(&test->ref);
	
	kfree(test);

	/* this is illegal, "test" is already freed... so it could oops here */
	kref_put(&test->ref, reftst_release);
}

static int __init reftst_init(void)
{
	printk(KERN_INFO "RefTest\n");
	reftst_static_simple_test();
	reftst_static_watermark_test();
	reftst_static_poison_test();
	
	return 0;
}

static void __exit reftst_exit(void)
{
	
}

module_init(reftst_init);
module_exit(reftst_exit);
MODULE_LICENSE("GPL");

  reply	other threads:[~2009-01-16 20:38 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-15 17:49 wireless-testing, p54 and sinus 154 data no longer works Artur Skawina
2008-12-15 18:41 ` Larry Finger
2008-12-15 19:43   ` Christian Lamparter
2008-12-15 20:20     ` Artur Skawina
2008-12-15 23:03       ` Artur Skawina
2008-12-15 23:24         ` Christian Lamparter
     [not found]           ` <49477A2A.7030406@gmail.com>
     [not found]             ` <200812161415.09365.chunkeey@web.de>
2008-12-16 13:49               ` Artur Skawina
2008-12-16 14:10                 ` Christian Lamparter
2009-01-12 17:09                   ` Artur Skawina
2009-01-13 13:49                     ` Christian Lamparter
2009-01-13 16:45                       ` Artur Skawina
2009-01-13 18:06                         ` Christian Lamparter
2009-01-13 19:02                           ` Artur Skawina
2009-01-13 21:39                             ` Artur Skawina
2009-01-13 22:31                               ` Artur Skawina
2009-01-15 17:55                                 ` Artur Skawina
2009-01-15 18:53                                   ` Christian Lamparter
2009-01-15 19:12                                     ` Artur Skawina
2009-01-15 19:42                                       ` Christian Lamparter
2009-01-15 20:06                                         ` Artur Skawina
2009-01-15 22:41                                           ` Christian Lamparter
2009-01-15 23:59                                             ` Artur Skawina
2009-01-16  3:18                                               ` Larry Finger
2009-01-16  3:31                                                 ` Artur Skawina
2009-01-16  9:13                                                 ` Johannes Berg
2009-01-16 20:38                                                   ` Christian Lamparter [this message]
2009-01-16 22:10                                                     ` Artur Skawina
2009-01-16 22:52                                                       ` Christian Lamparter
2009-01-16 23:46                                                         ` Artur Skawina
2009-01-18 23:27                                                       ` Artur Skawina
2009-01-19  0:26                                                         ` Christian Lamparter
2009-01-19  1:17                                                           ` Artur Skawina
2009-01-19 18:15                                                           ` Artur Skawina
2009-01-19 18:48                                                             ` Christian Lamparter
2009-01-19 21:53                                                               ` Artur Skawina
2009-01-19 22:38                                                                 ` Christian Lamparter
2009-01-19 22:54                                                                   ` Artur Skawina
2009-01-19 23:17                                                                     ` Artur Skawina
2009-01-19 23:32                                                                       ` Christian Lamparter
2009-01-20 20:18                                                                         ` Artur Skawina
2009-01-20 20:50                                                                           ` Christian Lamparter
2009-01-20 21:18                                                                             ` Artur Skawina
2009-01-19 18:52                                                             ` Artur Skawina
2009-01-15 20:07                                         ` [PATCH] p54: set_tim must be atomic Artur Skawina
2009-01-15 18:56                                   ` wireless-testing, p54 and sinus 154 data no longer works Artur Skawina
2009-01-13 22:47                               ` Christian Lamparter
2009-01-13 19:59                           ` Larry Finger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200901162138.51855.chunkeey@web.de \
    --to=chunkeey@web.de \
    --cc=Larry.Finger@lwfinger.net \
    --cc=art.08.09@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).