lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 31 Aug 2007 17:08:07 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	"anon... anon.al" <anon.asdf@...il.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: memory barrier to ensure copy_to_user() completes

> Which memory barrier do I require if I need to ensure that a
> copy_to_user(dest, src, len) completes before the next statement?

Define "completes"

> 
> copy_to_user(dest, src, len) ;
> //rmb(); OR wmb(); OR barrier(); OR mb(); ??????

Usually none of them

> If I'm writing to hardware, and need to ensure the correct order, I'll
> use wmb(), right?

No

> e.g.:
> 
> #define HW_address1 20
> #define HW_address2 40
> 
> *((int *)HW_address1) = 0x00000001;
> wmb();  // is this good???
> *((int *)HW_address2) = 0x00000010;

Linux doesn't define directly poking kernel addresses to hit hardware as
valid (and on many platforms it doesn't work). Use readl/writel and their
ordering is defined.

Read Documentation/io_ordering.txt and Docuemntation/pci.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ