[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A521612.3030607@petalogix.com>
Date: Mon, 06 Jul 2009 17:19:46 +0200
From: Michal Simek <michal.simek@...alogix.com>
To: Arnd Bergmann <arnd@...db.de>
CC: Paul Mundt <lethal@...ux-sh.org>,
Linux Kernel list <linux-kernel@...r.kernel.org>,
LTP <ltp-list@...ts.sourceforge.net>,
John Williams <john.williams@...alogix.com>,
Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Grant Likely <grant.likely@...retlab.ca>,
subrata@...ux.vnet.ibm.com
Subject: Re: mmap syscall problem
Arnd Bergmann wrote:
> On Monday 06 July 2009, Michal Simek wrote:
>
>>> *p1 = 0xaa; *p2 = 0x55;
>>>
>>>
>> I closed fd too.
>> close(fd);
>>
>>> return *p1; /* returns 0xaa if broken, 0x55 if correct */
>>> }
>>>
>
> If you close the fd between the assignment and reading
> from the pointer again, the test case becomes invalid because of
> timing. Closing the fd before the '*p1 = 0xaa' should be fine,
> but unnecessary.
>
> I also realized that you might need to mark the pointers
> as 'volatile' so that the compiler has to do the operations
> in order.
>
>
The result are the same. I tried to run mmap test which are in LTP and
only first one failed.
Do you have any ideas what buffer could caused that problems?
>>>
>>>
>> # ls -la existing-4k-file
>> -rw-rw-r-- 1 monstr monstr 4096 Jul 6 2009 existing-4k-file
>>
>> # ./test-arnd
>> # echo $?
>> 85
>>
>
> Ok, so inside a single task, this does not happen.
>
I print output in that task and there is 0x55 too.
>
>> # dd if=existing-4k-file of=/dev/console count=1 2>/dev/null
>> U#
>>
>> in file is first char U (0x55) which is IMO correct.
>>
>
> Right, though that was not part of the test, I'd expect this in
> the file even if the return value was broken.
>
Not in case that mmap is completely broken. This test confirm that mmap
map that fd and is possible to write there.
Thanks,
Michal
> Arnd <><
>
--
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663
--
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