* Updating variable shared between user and kernel space
@ 2009-03-26 14:00 Kristian Evensen
2009-03-26 14:26 ` Jan Engelhardt
0 siblings, 1 reply; 3+ messages in thread
From: Kristian Evensen @ 2009-03-26 14:00 UTC (permalink / raw)
To: netfilter-devel
Hello,
I have a value I would like to share between userspace and kernelspace
(it is store in my target struct and intialized in the user space part
of my module), but when I update it in kernel space it gets the wrong
value. When for example incrementing the value by 1 every time the
rule matches, the values are all messed up (but never larger than the
number of matches/increments). When creating and initializing the
value in the module, it behaves correctly.
I always though that if you try to accesses userspace varibles from
kernel space, you will get a seg. fault or similar, and am therefore a
little confused as to why this do not work. Does anybody know why
and/or how to share variables?
-Kristian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Updating variable shared between user and kernel space
2009-03-26 14:00 Updating variable shared between user and kernel space Kristian Evensen
@ 2009-03-26 14:26 ` Jan Engelhardt
2009-03-26 15:29 ` Kristian Evensen
0 siblings, 1 reply; 3+ messages in thread
From: Jan Engelhardt @ 2009-03-26 14:26 UTC (permalink / raw)
To: Kristian Evensen; +Cc: netfilter-devel
On Thursday 2009-03-26 15:00, Kristian Evensen wrote:
>
>I have a value I would like to share between userspace and kernelspace
>(it is store in my target struct and intialized in the user space part
>of my module), but when I update it in kernel space it gets the wrong
>value. When for example incrementing the value by 1 every time the
>rule matches, the values are all messed up (but never larger than the
>number of matches/increments). When creating and initializing the
>value in the module, it behaves correctly.
See the "Writing Netfilter Modules" e-book rev March 26 2009,
section 4.6 "SMP problems". I just updated this because xt_quota,
which serves as an example, was changed recently to account for
the RCU patches, and so the explanation needed to change too.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Updating variable shared between user and kernel space
2009-03-26 14:26 ` Jan Engelhardt
@ 2009-03-26 15:29 ` Kristian Evensen
0 siblings, 0 replies; 3+ messages in thread
From: Kristian Evensen @ 2009-03-26 15:29 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: netfilter-devel
> See the "Writing Netfilter Modules" e-book rev March 26 2009,
> section 4.6 "SMP problems". I just updated this because xt_quota,
> which serves as an example, was changed recently to account for
> the RCU patches, and so the explanation needed to change too.
Thank you, that was the chapter I was using a reference. Kmalloc here I come.
-Kristian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-03-26 15:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-26 14:00 Updating variable shared between user and kernel space Kristian Evensen
2009-03-26 14:26 ` Jan Engelhardt
2009-03-26 15:29 ` Kristian Evensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).