mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Vegard Nossum" <vegard.nossum@gmail.com>
To: "Alan Cox" <alan@lxorguk.ukuu.org.uk>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: 2.6.25.11-97.fc9 (P): idr_remove called for id=236 which is not allocated
Date: Fri, 15 Aug 2008 17:50:43 +0200	[thread overview]
Message-ID: <19f34abd0808150850v5ae5a1aneaa3e5182e0032c@mail.gmail.com> (raw)
In-Reply-To: <20080815162848.08ff793c@lxorguk.ukuu.org.uk>

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

On Fri, Aug 15, 2008 at 5:28 PM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
>> ida_remove called for id=112 which is not allocated.
>> ida_remove called for id=67 which is not allocated.
>> ida_remove called for id=191 which is not allocated.
>> ida_remove called for id=23 which is not allocated.
>>
>> ..and with no backtrace, so I guess it means "not harmful". Sorry for the noise.
>
> Thats definitely not good and wants digging into further.
>

Okay!

I've attached my program. On 2.6.27-rc3 the message appears at least a
couple of times per second, so you should have no trouble in
reproducing it. On the 2.6.25 I get it maybe once a minute.

Compile with: gcc -std=gnu99


Vegard

-- 
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
	-- E. W. Dijkstra, EWD1036

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: mknod.c --]
[-- Type: text/x-csrc; name=mknod.c, Size: 1804 bytes --]

#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>

#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>

#ifdef CONFIG_LOGGING
static FILE *logfile;
#endif

static const char *devname = "/tmp/dev";

static void do_one(mode_t mode, unsigned int maj, unsigned int min)
{
#if CONFIG_LOGGING
	fprintf(logfile, "%d, %d\n", maj, min);
	fflush(logfile);
	fsync(fileno(logfile));
#endif

	if (mknod(devname, mode | 0644, makedev(maj, min)) == -1)
		return;

	int fd = open(devname, O_RDONLY, 0644);
	if (fd == -1)
		goto ret_mknod;

	char *ptr = mmap(NULL, getpagesize(), PROT_READ, MAP_SHARED | MAP_ANONYMOUS, fd, 0);
	if (ptr == MAP_FAILED)
		goto ret_open;

	munmap(ptr, getpagesize());

ret_open:
	close(fd);
ret_mknod:
	unlink(devname);
}

static void do_both(unsigned int maj, unsigned int min)
{
	do_one(S_IFCHR, maj, min);
	do_one(S_IFBLK, maj, min);
}

static int blacklisted(unsigned int maj, unsigned int min)
{
	/* Watchdog; will kill the system anyway */
	if (maj == 10) {
		if (min == 130)
			return 1;
		if (min >= 212 && min <= 215)
			return 1;
	}

	return 0;
}

int
main(int argc, char *argv[])
{
#ifdef CONFIG_LOGGING
	logfile = fopen("mknod-logfile.txt", "w");
	if (!logfile)
		exit(EXIT_FAILURE);
#endif

	unlink(devname);

// XXX
#ifndef CONFIG_RANDOMIZE
	srand(time(NULL));
	srand(getpid() * rand());

	while (1) {
		unsigned int i = rand() % 256;
		unsigned int j = rand() % 256;

		if (blacklisted(i, j))
			continue;

		do_both(i, j);
	}
#else
	for (unsigned int i = 0; i < 128; ++i) {
		printf("maj: %d\n", i);

		for (unsigned int j = 0; j < 128; ++j) {
			if (blacklisted(i, j))
				continue;

			do_both(i, j);
		}
	}
	doit(S_IFCHR, 10, 130);
#endif

#ifdef CONFIG_LOGGING
	fclose(logfile);
#endif
	return EXIT_SUCCESS;
}

  reply	other threads:[~2008-08-15 15:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-15 15:11 Vegard Nossum
2008-08-15 15:26 ` Alan Cox
2008-08-15 15:27 ` Vegard Nossum
2008-08-15 15:28   ` Alan Cox
2008-08-15 15:50     ` Vegard Nossum [this message]
2008-08-15 21:26     ` Vegard Nossum
2008-08-18 22:15       ` Alan Cox
2008-08-19  6:53         ` Vegard Nossum
2008-08-19  8:29           ` Alan Cox

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=19f34abd0808150850v5ae5a1aneaa3e5182e0032c@mail.gmail.com \
    --to=vegard.nossum@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®