lkml.org 
[lkml]   [2008]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.6.25.11-97.fc9 (P): idr_remove called for id=236 which is not allocated
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
#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;
}
\
 
 \ /
  Last update: 2008-08-15 17:53    [W:1.610 / U:0.524 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site