Am Samstag, 1. Oktober 2022, 21:48:39 CEST schrieb Bernhard Reutner-Fischer:
> On Wed, 16 Apr 2014 20:25:39 -0400
>
> > That's exactly the situation here. The lifetime of the object being
> > cleared by memset ends sufficiently close to the memset that the
> > compiler is able to achieve the same
On Sat, 1 Oct 2022 21:48:39 +0200
Bernhard Reutner-Fischer wrote:
> On Wed, 16 Apr 2014 20:25:39 -0400
>
> > That's exactly the situation here. The lifetime of the object being
> > cleared by memset ends sufficiently close to the memset that the
> > compiler is able to achieve the same
On Wed, 16 Apr 2014 20:25:39 -0400
> That's exactly the situation here. The lifetime of the object being
> cleared by memset ends sufficiently close to the memset that the
> compiler is able to achieve the same observable effects that would be
> seen in the abstract machine without actually
Hi,
while reading some interesting stuff about memset being optimized
away by compilers if the variable is not read after the memset call
I recalled there was something similar in libbb/obscure.c file:
static int string_checker(const char *p1, const char *p2)
{
int size, i;
/*
Hi Tito !
I've tried to find out if memset is really optimized away in
this case with some test code that I've compiled with :
What is wrong with optimization of code, e.g. replacing call to
memset by a quick loop which does same thing even faster than a
function call? ... beside that such
On Wednesday 16 April 2014 19:14:05 you wrote:
Hi Tito !
I've tried to find out if memset is really optimized away in
this case with some test code that I've compiled with :
What is wrong with optimization of code, e.g. replacing call to
memset by a quick loop which does same thing even
On Wed, Apr 16, 2014 at 07:14:05PM +0200, Harald Becker wrote:
Hi Tito !
I've tried to find out if memset is really optimized away in
this case with some test code that I've compiled with :
What is wrong with optimization of code, e.g. replacing call to
memset by a quick loop which does
Hi Rich !
The quick loop will equally be optimized away, as neither it nor
the memset have any observable effect.
What do you call observable? Replacing the content of a memory
region by a constant value is an observable effect by itself. The
only case I know is, filling an automatic variable at
Hi Tito !
my fear is/was that the call to memset is totally
optimized away when optimization is turned on
and therefore the memory containing the password
strings is not zeroed at all.
This would be a completely ill behavior of compiler optimization.
Normally such things as memset are replaced
On Wed, Apr 16, 2014 at 6:47 PM, Tito farmat...@tiscali.it wrote:
Hi,
while reading some interesting stuff about memset being optimized
away by compilers if the variable is not read after the memset call
I recalled there was something similar in libbb/obscure.c file:
static int
Hi Rich !
I got a mail error, saying dal...@libc.org has no valid mail
exchanger??? What's wrong?
--
Harald
___
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
Generally C compilers assume that an address
passed to a function (free(p)) _might_ be dereferenced,
and so would not optimize away the memset(p,...)
If a particular C compiler thinks it knows what
free() is, and that it doesn't dereference its argument,
then it might think it was justified in
On Wednesday 16 April 2014 20:01:38 Cathey, Jim wrote:
Generally C compilers assume that an address
passed to a function (free(p)) _might_ be dereferenced,
and so would not optimize away the memset(p,...)
If a particular C compiler thinks it knows what
free() is, and that it doesn't
char pwd[64];
memset(pwd, 0, sizeof(pwd));
if (pwd[0] != '\0') {
printf(memory not zeroed);
or would the compiler see that we read just first char
and zero only that and force us to check every
char of pwd?
If CC knows what memset does (and I believe they
generally do these days),
Hi Tito !
void getPassword(void)
{
char pwd[64];
if (GetPassword(pwd, sizeof(pwd))) {
/* checking of password, secure operations, etc */
}
memset(pwd, 0, sizeof(pwd));
if (pwd[0] != '\0') {
printf(memory not zeroed);
exit(1)
}
}
just out of curiosity and for me to
What do you call observable?
C has a pretty exact definition of this.
Replacing the content of a memory region by a constant value is
an observable effect by itself.
No, it's not. Where did you _get_ the address to observe?
That's the essence of the observability question.
The C compiler
Hi Jim !
Mind you, I don't think I like my compiler being quite that
'smart'. I would hope there was a knob someplace to tell it not
to be quite so, umm, _free_ with free()!
That knob is part of the function definition. on a standard
function definition like:
void free( void* ptr );
with
On Wed, Apr 16, 2014 at 07:51:42PM +0200, Harald Becker wrote:
Hi Tito !
my fear is/was that the call to memset is totally
optimized away when optimization is turned on
and therefore the memory containing the password
strings is not zeroed at all.
This would be a completely ill behavior
18 matches
Mail list logo