mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* copy_from_user / copy_to_user with no swap space
@ 2006-10-16 19:19 mfbaustx
  2006-10-16 19:28 ` Oliver Neukum
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: mfbaustx @ 2006-10-16 19:19 UTC (permalink / raw)
  To: linux-kernel

I've been trying to find or derive a definitive answer to this question  
for a while now but can't quite get over the hump.

I understand when/why copy_<to|from>_user (and siblings) are required  
(address validation, guaranteeing a process is paged in, etc...).  The  
question is: if you have no swap space (or virtual memory or whatever),  
can there ever be a case in which any valid pointer to a buffer in  
user-space would be incorrect as a result of another process's PTE being  
present?  Put another way: can a process be partially paged?

My reasoning (which I obviously have no confidence else I wouldn't be  
asking this question) is as follows:

All processes share the same logical address space starting at 0 and  
(usually) ending at 3GB, right?  Text sections start low and build up,  
stacks start high and grow down.  Somewhere in there you get your heap and  
shared memory regions.  Since noting about a logical address can identify  
a specific process, then copy_to/from_user can do nothing to guaruntee  
that the CORRECT process is paged in.  True?  So you're absolutely  
obligated to DO the copy at the time the kernel is executing on behalf of  
that process.  Once your process/thread is context swapped, you've lost  
the [correct] information on the address mapping.

So, IF you MUST copy_from/to_user when in the context of the process, AND  
IF you have no virtual memory/swapping, THEN must it not be true that you  
can ALWAYS dereferences your user space pointers?


TIA!



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-10-17 13:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-16 19:19 copy_from_user / copy_to_user with no swap space mfbaustx
2006-10-16 19:28 ` Oliver Neukum
2006-10-16 19:47   ` mfbaustx
2006-10-17 10:58     ` Horst H. von Brand
2006-10-17 12:00     ` Helge Hafting
2006-10-16 19:34 ` Al Viro
2006-10-16 19:39 ` Kyle Moffett
2006-10-16 20:26   ` mfbaustx
2006-10-16 20:21 ` Horst H. von Brand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome