From: Michal Simek <michal.simek@petalogix.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: LTP <ltp-list@lists.sourceforge.net>,
Linux Kernel list <linux-kernel@vger.kernel.org>,
Grant Likely <grant.likely@secretlab.ca>,
Paul Mundt <lethal@linux-sh.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>,
John Williams <john.williams@petalogix.com>
Subject: Re: [LTP] mmap syscall problem
Date: Mon, 06 Jul 2009 17:19:46 +0200 [thread overview]
Message-ID: <4A521612.3030607@petalogix.com> (raw)
In-Reply-To: <200907061705.50308.arnd@arndb.de>
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
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
WARNING: multiple messages have this Message-ID (diff)
From: Michal Simek <michal.simek@petalogix.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Paul Mundt <lethal@linux-sh.org>,
Linux Kernel list <linux-kernel@vger.kernel.org>,
LTP <ltp-list@lists.sourceforge.net>,
John Williams <john.williams@petalogix.com>,
Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Grant Likely <grant.likely@secretlab.ca>,
subrata@linux.vnet.ibm.com
Subject: Re: mmap syscall problem
Date: Mon, 06 Jul 2009 17:19:46 +0200 [thread overview]
Message-ID: <4A521612.3030607@petalogix.com> (raw)
In-Reply-To: <200907061705.50308.arnd@arndb.de>
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
next prev parent reply other threads:[~2009-07-06 15:19 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-03 12:37 [LTP] mmap syscall problem Michal Simek
2009-07-03 12:37 ` Michal Simek
2009-07-03 15:02 ` [LTP] " Arnd Bergmann
2009-07-03 15:02 ` Arnd Bergmann
2009-07-06 6:32 ` [LTP] " Michal Simek
2009-07-06 6:32 ` Michal Simek
2009-07-06 8:05 ` [LTP] " Arnd Bergmann
2009-07-06 8:05 ` Arnd Bergmann
2009-07-06 12:07 ` [LTP] " Michal Simek
2009-07-06 12:07 ` Michal Simek
2009-07-06 12:14 ` [LTP] " Paul Mundt
2009-07-06 12:14 ` Paul Mundt
2009-07-06 12:54 ` [LTP] " Michal Simek
2009-07-06 12:54 ` Michal Simek
2009-07-06 14:16 ` [LTP] " Arnd Bergmann
2009-07-06 14:16 ` Arnd Bergmann
2009-07-06 14:43 ` [LTP] " Michal Simek
2009-07-06 14:43 ` Michal Simek
2009-07-06 15:05 ` [LTP] " Arnd Bergmann
2009-07-06 15:05 ` Arnd Bergmann
2009-07-06 15:19 ` Michal Simek [this message]
2009-07-06 15:19 ` Michal Simek
2009-07-07 0:44 ` [LTP] " Valdis.Kletnieks
2009-07-07 0:44 ` Valdis.Kletnieks
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=4A521612.3030607@petalogix.com \
--to=michal.simek@petalogix.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=grant.likely@secretlab.ca \
--cc=john.williams@petalogix.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ltp-list@lists.sourceforge.net \
--cc=mingo@elte.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.