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>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 06 Apr 2009 14:31:04 -0700
From:	Matt Klein <matt.klein@...ewerks.com>
To:	linux-kernel@...r.kernel.org
CC:	matt.klein@...ewerks.com
Subject: Cached IO Synchronization Question

(Please CC me on any responses)

Hi,

I am studying 2.6.27.21 to try to understand the IO synchronization
model used in the Linux kernel.

I have the following question:

How are cached reads/writes synchronized? I assume they are, but I can
not determine how it is done.

1) do_generic_file_read calls find_get_page to get the existing page
cache page if it exists (it uses RCU to prevent the page from being
blown away while reading takes place). Assuming it does, it performs
various checks to make sure the page is up to date before performing an
atomic copy to user mode. The read path does not take the page lock.

2) The write path takes both the inode lock and the page lock to prevent
multiple writers. It also does an atomic copy from user mode into the
page cache page.

>From my reading of the code, the atomic copies are atomic only on a
single processor, not across processors. Right?

If so, what is to prevent one CPU from starting a cached read into a
user mode buffer while another CPU has partially copied data into the
page cache page?

Thanks,
Matt

-- 
Matt Klein
Technical Specialist
Pikewerks
matt.klein@...ewerks.com / 206 327 4515
--
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