[Top] [All Lists]

Re: Is this a /proc or kernel bug? (more info...)

Subject: Re: Is this a /proc or kernel bug? (more info...)
From: Krishna Kondaka <>
Date: Mon, 13 May 2002 11:33:27 -0700 (PDT)
Reply-to: Krishna Kondaka <>
Thanks for the reply florian!

I think I was able to fix this problem by writing the code differently.
Initially I copied some code from the existing proc_read routines but they
are assuming a maximum of page size, in this case 4K.

I have modified the my proc read code as below, and it seem to work fine!

static int
mydriver_proc_read(char *page, char **start, off_t off, int count, int *eof
void *d)
        uint32_t pos, len, i;
        len = MIN(count, (SIZE-off));
        pos = (off & (PAGE_SIZE-1));

        if (len > 0) {
                for (i = 0; i < len; i++)
                        page[pos+i] = ' ' + i % 64;
                *start = page + (off & (PAGE_SIZE-1));
        } else {
                len = 0;
                *eof = 0;
I am assuming that (off & (PAGE_SIZE-1)) + count <= PAGE_SIZE, which seems
to be the case always during my testing.


>X-Authentication-Warning: mail owned process doing -bs
>X-Authentication-Warning: majordomo set sender to using -f
>Date: Sun, 12 May 2002 15:36:56 +0200
>From: Florian Lohoff <>
>To: Krishna Kondaka <>
>Subject: Re: Is this a /proc or kernel bug? (more info...)
>Mime-Version: 1.0
>Content-Disposition: inline
>User-Agent: Mutt/1.3.28i
>On Wed, May 08, 2002 at 08:28:32PM -0700, Krishna Kondaka wrote:
>> The above function works fine as long as the SIZE is lessthan 4K. If SIZE is
>> greater than 4K then some times I see the following kernel panic when
>> I try to do "cat /proc/<myfilename>"
>> Unhandled kernel unaligned access in unaligned.c:emulate_load_store_insn, 
>> 373:
>> $0 : 00000000 10009f00 8f20802c 48494a4b
>> $4 : 8f320988 00000001 00000000 00000116
>IIRC i386 has the same problem with reading more then a single page from 
>Retrieving more information should probably be a device driver with
>a char or block interface.
>Florian Lohoff                     +49-5201-669912
>                        Heisenberg may have been here.

<Prev in Thread] Current Thread [Next in Thread>