lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAEfL3Kmr4Q43Kn=HsP2yfmLEM+r784oACuhxnVwjB9Cgpk6vtQ@mail.gmail.com>
Date:	Mon, 20 Jan 2014 15:20:05 +0530
From:	Sandeep Joshi <sanjos100@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: sigbus on memcpy despite calling mincore

Hi folks

I have a program which is trying to read a page from the page cache
for a certain file

it calls mmap (PROT_NONE, MAP_SHARED |MAP_LOCKED).

Then it calls mincore to check if the page is in memory

If it does exist, it remaps the same offset using mmap(PROT_READ,
MAP_SHARED|MAP_LOCKED)

After this, it is tries to do a read (memcpy) from the returned
address of the second mmap.

Unfortunately, I am getting a SIGBUS in cases where there is another
thread in the same process trying to write to the same file (though
not at the same offset)

when I look in /proc/<pid>/smaps, I see that the mapped address has
RSS=0 (not in memory) and LOCKED=0 (not locked) which is strange since
I have locked the page and called mincore on it.

I added checking for the filesize (fstat) before the first mmap but
still get a SIGBUS.  I also changed the second and first mmaps to do
MAP_PRIVATE hoping it would give a private copy of the page but that
didnt help either.

Is there some race condition which resets the vma_flags when another
thread in the same process is writing to the same file offset being
read ?

thanks
-Sandeep
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ