MODSIGN: Don't use enum-type bitfields in module signature info block

Don't use enum-type bitfields in the module signature info block as we can't be
certain how the compiler will handle them.  As I understand it, it is arch
dependent, and it is possible for the compiler to rearrange them based on
endianness and to insert a byte of padding to pad the three enums out to four
bytes.

Instead use u8 fields for these, which the compiler should emit in the right
order without padding.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
David Howells 2012-10-22 15:05:48 +01:00 коммит произвёл Rusty Russell
Родитель df2fc246c8
Коммит 12e130b045
1 изменённых файлов: 7 добавлений и 7 удалений

Просмотреть файл

@ -27,13 +27,13 @@
* - Information block * - Information block
*/ */
struct module_signature { struct module_signature {
enum pkey_algo algo : 8; /* Public-key crypto algorithm */ u8 algo; /* Public-key crypto algorithm [enum pkey_algo] */
enum pkey_hash_algo hash : 8; /* Digest algorithm */ u8 hash; /* Digest algorithm [enum pkey_hash_algo] */
enum pkey_id_type id_type : 8; /* Key identifier type */ u8 id_type; /* Key identifier type [enum pkey_id_type] */
u8 signer_len; /* Length of signer's name */ u8 signer_len; /* Length of signer's name */
u8 key_id_len; /* Length of key identifier */ u8 key_id_len; /* Length of key identifier */
u8 __pad[3]; u8 __pad[3];
__be32 sig_len; /* Length of signature data */ __be32 sig_len; /* Length of signature data */
}; };
/* /*