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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 21 Jan 2014 00:13:56 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	James Hogan <james.hogan@...tec.com>
Cc:	Chen Gang <gang.chen.5i5j@...il.com>, devel@...verdev.osuosl.org,
	andreas.dilger@...el.com, Greg KH <gregkh@...uxfoundation.org>,
	bergwolf@...il.com,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	oleg.drokin@...el.com, jacques-charles.lafoucriere@....fr,
	jinshan.xiong@...el.com, linux-metag@...r.kernel.org
Subject: Re: [PATCH] drivers: staging: lustre: lustre: include: add
 "__attribute__((packed))" for the related union

I made a quick and dirty sparse patch to check for this.  I don't think
I will bother trying to send it to sparse upstream, but you can if you
want to.

It found 289 unions which might need a __packed added.  The lustre
unions were not in my allmodconfig so they're not listed.

Perhaps there could be a command line option or a pragma so that unions
will work in the kernel.  We don't care about linking to outside
libraries.

regards,
dan carpenter

diff --git a/symbol.c b/symbol.c
index ebba56deaf94..596e47883aad 100644
--- a/symbol.c
+++ b/symbol.c
@@ -187,6 +187,12 @@ static struct symbol * examine_struct_union_type(struct symbol *sym, int advance
 		bit_size = (bit_size + bit_align) & ~bit_align;
 	}
 	sym->bit_size = bit_size;
+
+	if (!advance && (info.bit_size / 8) % 4) {
+		int pad = 4 - (info.bit_size / 8) % 4;
+		warning(sym->pos, "'%s' union will be padded with %d bytes unless __attribute__((packed)).",  sym->ident ? sym->ident->name: "<null>", pad);
+	}
+
 	return sym;
 }
 

View attachment "err-list" of type "text/plain" (37473 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ