On 11/16/09, Daniel Borkmann <d.borkmann@xxxxxxxxx> wrote: > Example: > > Within my device driver code I have the following table ... > > typedef struct foobar_entry { > char foo[1024]; > char bar[1024]; > uint32_t x; > uint32_t y; > } foobar_entry_t; > > foobar_entry_t foobar_table[] = > { > { "foo1", "bar1", 232, 0 }, > { "foo2", "bar2", 233, 1 }, > { "foo3", "bar3", 234, 0 }, > { "foo4", "bar4", 235, 1 }, > }; > EXPORT_SYMBOL(foobar_table); > > ... and I'd like this to be memory mappped as read-only into user space. > I tried things with 'remap_pfn_range', but without success. Do you have > any idea/code example how to manage this? Hm, what do you mean by "without success"? Do you get segmentation fault? I guess the basic problem here is fundamental: you're accessing kernel data from ring 3. And to be honest, I am not sure whether remap_pfn_range would change the privilege level protection so they are accessible from user space. I think, you could do it by providing /proc or /debugfs entry that read (or possible write) to this array. Robert PJ Day's Linux.com kernel article series could give you a nice howto on this topic. NB: Well, maybe they are not {k,v}malloc-ed, but it doesn't matter, since I bet they are statically allocated (thus resides in .data section). -- regards, Mulyadi Santosa Freelance Linux trainer and consultant blog: the-hydra.blogspot.com training: mulyaditraining.blogspot.com -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ