All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Address translation
@ 2000-11-22 21:39 Keir Fraser
  2000-11-23  0:49 ` Pavel Machek
  2000-11-23 20:23 ` Andreas Bombe
  0 siblings, 2 replies; 19+ messages in thread
From: Keir Fraser @ 2000-11-22 21:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: Keir.Fraser

> The reason that everyone else uses copy_{to,from}_user is that there
> is no way to guarantee that the userspace pointer is valid. That
> memory may have been swapped out. The copy macros are prepared to
> fault the memory in. The rest of the kernel is not.
>
> Jeff

I may be wrong on this, but I thought that copy_{to,from}_user are
only necessary if the address range you are accessing might cause a
fault which Linux cannot handle (ie. one which would cause the
application to segfault if it accessed that memory). If it is only a
matter of paging the memory in (and you are _sure_ the address range is
otherwise valid) I think the access macros are unnecessary. I would be
*very* glad if someone could confirm this, or shoot me down. :)

For instance, a kernel module I am writing allocates some memory in
the current process's address space as follows:

    down(&mm->mmap_sem);
    s->table = (void **)get_unmapped_area(0, SIZEOF_TABLE);
    if ( s->table != NULL )
        do_brk((unsigned long)s->table, SIZEOF_TABLE);
    up(&mm->mmap_sem);

Some questions:
 (1) In a "top half" thread, can I now access this memory without the
     access macros (since I know the address range is valid)?
 (2) Can I also access this memory from an interrupt/exception
     context, or must I lock it? (ie. can faults be handled from such
     a context) 
 (3) Is the above code sensible at all, or barking? It took me a while
     to figure that the above would work, and I think/hope it is the
     most elegant way to share memory between kernel and a process.

 Thanks in advance for any info!
 -- Keir Fraser

PS. Please cc me directly (kaf24@cl.cam.ac.uk) with any replies.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 19+ messages in thread
* address translation
@ 2005-04-12 10:47 mani kandan
  2005-04-12 12:25 ` Henrik Nordstrom
  0 siblings, 1 reply; 19+ messages in thread
From: mani kandan @ 2005-04-12 10:47 UTC (permalink / raw)
  To: netfilter-devel

hello,

i am doing a project on  TCP connection passing.
where the socket is migrated from one server to
another.
the work was actually done by MR. Werner Almesberger.
http://tcpcp.sourceforge.net
here tcp connection details of a socket at server 1 is
dumped into file and, 
the socket created at second server is set with these
connection details.
now the packets destined to the first server has to be
redirected to second server. so i thought of using 
NAT and studied LVS and found that it is not helping 
me.
so i went for iptables.
i need to change the source and destination address of
a packet. so that the packets from the client are
re-routed to second server from  first server. at the
first server i want to change src address as first
server and dest address as second server of the packet
from client.

with iptables i was able to change the address from
the 
start of the connection. ie only for the connection as
whole. but i want to change address of the packet
sometime after the connection is established.is it
possible to do it and how to do it.
  
In documentation i found that address translation 
can only done for the first packet of the connection
and the following packets of that connection   

my question is whether it is possible to do address
translation in the intermediate state of connection.
i added the rule at the middle of the connection but
the address translation did not take place.

please can anyone help me in this


		
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 

^ permalink raw reply	[flat|nested] 19+ messages in thread
* address translation
@ 2003-05-15 11:29 Trevor Woerner
  2003-05-15 11:46 ` Gary Thomas
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Trevor Woerner @ 2003-05-15 11:29 UTC (permalink / raw)
  To: linuxppc-dev


I want to setup a mapping so that when anything tries to read/write the
16 bytes at 0x1f0 - 0x1ff the actual physical memory that gets accessed
is 0xf7000000 - 0xf700000f.

I can't figure out what I need to call to get this done.

ioremap() is the exact opposite of what I want.

remap_page_range() comes very close but aligns everything to the page
boundary. In other words, after I do the mapping with either 0x1f0 or
0x0 as the virtual address, accessing 0x1f0 gives me 0xf70001f0 instead
of 0xf7000000. I don't want *page* translation, I need
*address-for-address* translation (if such a thing is possible). I
tried setting the physical address to 0xf7000000 - 0x1f0 but that
didn't work (I didn't think it would :-)

I think resetting _IO_BASE is just another page translation trick.

I also tried using io_block_mapping(), which I use in my platform io
setup routine, but the MMU crashed with one of those '###A' reports.

any suggestions, please?

        Trevor

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 19+ messages in thread
* address translation
@ 2003-05-15  3:50 Trevor Woerner
  0 siblings, 0 replies; 19+ messages in thread
From: Trevor Woerner @ 2003-05-15  3:50 UTC (permalink / raw)
  To: linuxppc-embedded


I want to setup a mapping so that when anything tries to read/write the
16 bytes of 0x1f0 - 0x1ff the actual physical memory that gets accessed
is 0xf7000000 - 0xf700000f.

I can't figure out what I need to call to get this done.

ioremap() is the exact opposite of what I want, and remap_page_range()
comes very close but aligns everything to the page boundary (in other
words, after I do the mapping, accessing 0x1f0 gives me 0xf70001f0
instead of 0xf7000000). I also tried using io_block_mapping(), which I
use in my platform io setup routine, but the MMU crashed with one of
those '###A' thingies. :-)

any suggestions, please?

	Trevor

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 19+ messages in thread
* Address translation
@ 2000-11-21 14:41 Rubén Gallardo Fructuoso
  2000-11-21 17:20 ` Jeff Dike
  0 siblings, 1 reply; 19+ messages in thread
From: Rubén Gallardo Fructuoso @ 2000-11-21 14:41 UTC (permalink / raw)
  To: Linux-Kernel

	Hi everybody!

	I'm developing a module of file system filter and I have a question about
it. Does anybody know a function or method in order to translate an user
space pointer into a valid pointer in kernel mode?

	I'd like to avoid copying data (such as the 'copy_to_user' and
'copy_from_user' functions do) because it slows down my system.

	Thanks in advance,
	Rubén.



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

end of thread, other threads:[~2005-04-12 12:25 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-11-22 21:39 Address translation Keir Fraser
2000-11-23  0:49 ` Pavel Machek
2000-11-23 20:23 ` Andreas Bombe
2000-11-23 21:04   ` Bjorn Wesen
2000-11-24 23:28     ` Andreas Bombe
  -- strict thread matches above, loose matches on Subject: below --
2005-04-12 10:47 address translation mani kandan
2005-04-12 12:25 ` Henrik Nordstrom
2003-05-15 11:29 Trevor Woerner
2003-05-15 11:46 ` Gary Thomas
2003-05-16  3:13   ` Trevor Woerner
2003-05-15 12:13 ` Magnus Damm
2003-05-16  3:14   ` Trevor Woerner
2003-05-15 14:05 ` Benjamin Herrenschmidt
2003-05-16  4:02   ` Trevor Woerner
2003-05-16  8:35     ` Geert Uytterhoeven
2003-05-16  9:00     ` Benjamin Herrenschmidt
2003-05-15  3:50 Trevor Woerner
2000-11-21 14:41 Address translation Rubén Gallardo Fructuoso
2000-11-21 17:20 ` Jeff Dike

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.