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] [thread-next>] [day] [month] [year] [list]
Message-ID: <18438.39737.921541.359469@cargo.ozlabs.ibm.com>
Date:	Thu, 17 Apr 2008 10:35:05 +1000
From:	Paul Mackerras <paulus@...ba.org>
To:	Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
Cc:	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	Rusty Russell <rusty@...tcorp.com.au>,
	Christoph Hellwig <hch@...radead.org>
Subject: Re: [RFC patch 23/27] Immediate Values - Powerpc Optimization NMI
	MCE support

Mathieu Desnoyers writes:

> * Paul Mackerras (paulus@...ba.org) wrote:
> > Mathieu Desnoyers writes:
> > 
> > > Use an atomic update for immediate values.
> > 
> > What is meant by an "atomic" update in this context?  AFAICS you are
> > using memcpy, which is not in any way guaranteed to be atomic.
> > 
> > Paul.
> 
> I expect memcpy to perform the copy in one memory access, given I put a 
> 
>   .align 2
> 
> before the 2 bytes instruction. It makes sure the instruction modified
> fits in a single, aligned, memory write.

My original question was in the context of the powerpc architecture,
where instructions are always 4 bytes long and aligned.  So that's not
an issue.

> Or maybe am I expecting too much from memcpy ?

I don't think memcpy gives you any such guarantees.  It would be quite
within its rights to say "it's only a few bytes, I'll do it byte by
byte".

If you really want it to be atomic (which I agree is probably a good
idea), I think the best way to do it is to use an asm to generate a
sth (store halfword) instruction to the immediate field (instruction
address + 2).  That's on powerpc of course; I don't know what you
would do on other architectures.

Paul.
--
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