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-next>] [day] [month] [year] [list]
Message-Id: <200905252221.44082.arnd@arndb.de>
Date:	Mon, 25 May 2009 22:21:43 +0000
From:	Arnd Bergmann <arnd@...db.de>
To:	monstr@...str.eu, linux-arch@...r.kernel.org
Cc:	John Williams <john.williams@...alogix.com>,
	linux-kernel@...r.kernel.org, Arnd Bergmann <arnd@...db.de>
Subject: Re: ipc64_perm - generic

On Monday 25 May 2009 18:54:42 Michal Simek wrote:
> 
> Hi Arnd, cc: John
> 
> From asm-generic/posix_types.h
> 
> 17 #ifndef __kernel_mode_t
> 18 typedef unsigned int    __kernel_mode_t;
> 19 #endif
> 
> This structure is not aligned properly because of pad2.
> 
> 19 struct ipc64_perm {
> 20         __kernel_key_t          key;
> 21         __kernel_uid32_t        uid;
> 22         __kernel_gid32_t        gid;
> 23         __kernel_uid32_t        cuid;
> 24         __kernel_gid32_t        cgid;
> 25         __kernel_mode_t         mode;
> 26         unsigned short          __pad1;
> 27         unsigned short          seq;
> 28         unsigned short          __pad2;
> 29         unsigned long           __unused1;
> 30         unsigned long           __unused2;
> 31 };
> 
> I think we should remove __pad1.
> What do you think?

Right, well spotted.

I'd like to keep the struct ipc64_perm compatible with most architectures, so
maybe we can play a little trick here:

> Here is proposed struct.
>  struct ipc64_perm {
>          __kernel_key_t          key;
>          __kernel_uid32_t        uid;
>          __kernel_gid32_t        gid;
>          __kernel_uid32_t        cuid;
>          __kernel_gid32_t        cgid;
>          __kernel_mode_t         mode;

+	unsigned char __pad1[4 - sizeof(__kernel_mode_t)];

>          unsigned short          seq;
>          unsigned short          __pad2;
>          unsigned long           __unused1;
>          unsigned long           __unused2;
>  };

If that's too much of a hack, we could also change the default __kernel_mode_t
in asm-generic/posix_types.h to unsigned short, which it is on all 32-bit architectures
except mips and xtensa. For some reason, all 64 bit architechtures use unsigned
int for mode_t, but I couldn't find out why. Glibc uses unsigned int externally.

	Arnd <><
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ