Andi Kleen <ak@muc.de> wrote:
>
> Andrew Morton <akpm@digeo.com> writes:
>
> > foo_readdir()
> > {
> > loff_t pos = file->f_pos;
> >
> > ....
> > <code which doesn't touch file->f_pos, but which modifies pos>
> > ...
> >
> > file->f_pos = pos;
> > }
>
> At least for alpha this will require an rmb_depends() between the read
> and the write. Probably on x86 an rmb() wouldn't hurt neither.
>
> Otherwise there is no guarantee other CPUs see that intended memory
> modification order
>
Won't the atomic operations in down() and up() do that?
It's all a bit moot really. If two user threads or processes are fighting
over the value of f_pos at the same time in this manner then they're buggy
anyway. All we need to do here is to ensure that the kernel doesn't do
anything grossly wrong or insecure.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sat Mar 15 2003 - 22:00:44 EST