Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1404602
| From | David Miller <davem@davemloft.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3.12 69/76] net: fix infoleak in rtnetlink |
| Date | 2016-05-20 18:50 +0200 |
| Message-ID | <rAVMB-7RU-9@gated-at.bofh.it> (permalink) |
| References | <rAs7T-6aN-9@gated-at.bofh.it> <rAshz-6ee-5@gated-at.bofh.it> <rARpE-5ki-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Vegard Nossum <vegard.nossum@gmail.com>
Date: Fri, 20 May 2016 14:04:54 +0200
> Just out of curiosity, was this observed in practice? I could be
> wrong, but I was under the impression that using designated
> initializers would zero the rest of the struct, including padding.
I compiled testcases and found that the compiler does not zero out
padding when using designated initializers.
You can do the same.
For example, on sparc 32-bit, this code:
struct foo {
int a;
short b;
int c;
};
extern void foo(struct foo *);
void bar(void)
{
struct foo f = { .a = 1, .b = 2, .c = 3 };
foo(&f);
}
gives:
mov 1, %g1
st %g1, [%fp-12]
mov 2, %g1
sth %g1, [%fp-8]
mov 3, %g1
st %g1, [%fp-4]
It does not initialize the padding between 'b' and 'c'.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 3.12 69/76] net: fix infoleak in rtnetlink Jiri Slaby <jslaby@suse.cz> - 2016-05-19 11:20 +0200
Re: [PATCH 3.12 69/76] net: fix infoleak in rtnetlink Vegard Nossum <vegard.nossum@gmail.com> - 2016-05-20 14:10 +0200
Re: [PATCH 3.12 69/76] net: fix infoleak in rtnetlink Vegard Nossum <vegard.nossum@gmail.com> - 2016-05-20 16:30 +0200
Re: [PATCH 3.12 69/76] net: fix infoleak in rtnetlink David Miller <davem@davemloft.net> - 2016-05-20 18:50 +0200
Re: [PATCH 3.12 69/76] net: fix infoleak in rtnetlink Hannes Frederic Sowa <hannes@stressinduktion.org> - 2016-05-21 02:50 +0200
csiph-web