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 observabl
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 perfor
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 il
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 fun
>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 kn
>Even if optimizer throws out the call to memset function the
>compiler shall create code to fill the pwd array before it's
>freed. Otherwise I consider the optimizer behaving wrong.
If the compiler is 'smart' enough to know what memset() does,
what's from preventing it from also knowing what free
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
> 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 thes
1)
}
}
or would the compiler see that we read just first char
and zero only that and force us to check every
char of pwd?
Ciao,
Tito
> -Original Message-
> From: busybox-boun...@busybox.net [mailto:busybox-boun...@busybox.net] On
> Behalf Of Denys Vlasenko
> Sent: Wednesday,
y
what I say." It's an overlarge hammer in this case, though.
-- Jim
-Original Message-
From: busybox-boun...@busybox.net [mailto:busybox-boun...@busybox.net] On
Behalf Of Denys Vlasenko
Sent: Wednesday, April 16, 2014 10:52 AM
To: Tito
Cc: busybox
Subject: Re: [PATCH] memset
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
On Wed, Apr 16, 2014 at 6:47 PM, Tito 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 string_checker(const char *p
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 replace
On Wednesday 16 April 2014 19:28:27 Rich Felker wrote:
> 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 optim
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 a
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 whic
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 thin
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 opti
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;
/* chec
20 matches
Mail list logo