From: Thomas Sachau Date: Tue, 22 Jun 2010 16:58:38 +0000 (+0000) Subject: Fix bug 321653, bug 323029 and a compile error with hardened-sources X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=649c6fde7f2bfa18c0da4fa8607beb60cb2308e7;p=gentoo.git Fix bug 321653, bug 323029 and a compile error with hardened-sources Package-Manager: portage-2.2_rc67-r8/cvs/Linux x86_64 --- diff --git a/sys-fs/aufs2/ChangeLog b/sys-fs/aufs2/ChangeLog index ecc4580a3946..844c3735026a 100644 --- a/sys-fs/aufs2/ChangeLog +++ b/sys-fs/aufs2/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for sys-fs/aufs2 # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/aufs2/ChangeLog,v 1.22 2010/06/05 22:55:07 tommy Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/aufs2/ChangeLog,v 1.23 2010/06/22 16:58:38 tommy Exp $ + + 22 Jun 2010; Thomas Sachau (Tommy[D]) + aufs2-0_p20100524.ebuild, +files/pax.patch: + Fix bug 321653, bug 323029 and a compile error with hardened-sources 05 Jun 2010; Thomas Sachau (Tommy[D]) aufs2-0_p20100524.ebuild: diff --git a/sys-fs/aufs2/Manifest b/sys-fs/aufs2/Manifest index 02c467fa14cd..05d3e5c58126 100644 --- a/sys-fs/aufs2/Manifest +++ b/sys-fs/aufs2/Manifest @@ -17,19 +17,20 @@ AUX aufs2-standalone-31.patch 8573 RMD160 62ccf355504e99a4bdcc2e66eb4ef6426a6bce AUX aufs2-standalone-32.patch 8573 RMD160 47958e632664dd24dab86102b11cd897dc1a3e43 SHA1 72bb326aa6dfd166f09d4f180dd0d3704e0a6743 SHA256 aea4df11245b7f6cc9fa981840c7ebcc7f21d27e20fd0e569c249a08a8b7ceef AUX aufs2-standalone-33.patch 8629 RMD160 948926f2067e122a075a5aa03d5a4d5b2d3cf11a SHA1 510fc63ab879377227f036f73841f69b411f79ad SHA256 ce3414ac7976ac2a357d0a20ccd0c5a0d5d1a4a1154b4c24f017ded3aebb8341 AUX aufs2-standalone-34.patch 8602 RMD160 c39575d284e355d98148907689ca115b23cbf492 SHA1 9dd81c20ab21f35e544c5e966b6eb7423199fc78 SHA256 185f7948c4fdefa0687edfcc7de73836690a3bfae5c28ab06e7fbf4101cb4139 +AUX pax.patch 4821 RMD160 9576b969b6c5d893b40c76e4bb297a34bcbf13e9 SHA1 bd06819d7b01959a8ed5756c78d29255923287c6 SHA256 c82946d79fd3826803aacf5533aa398c8c7e7516a0c8c88a56aa75e27af3c7ad AUX utils-2.6.31.patch 444 RMD160 b89f0373c7d9537cc3124e7d8beaa0eda411a6f3 SHA1 8dcb097c0ddb4a325aef7f043db6809dcbef4035 SHA256 d10f948b03dd47cf2e5635a064c02231d4b7af2c28d45e0368fb0470b15cae62 DIST aufs2-0_p20100405.tar.bz2 7105573 RMD160 69c638543e247730cb6be3de3741d18db20be08b SHA1 ccbe21cab7bf67c63e9986d620f2d037557242ea SHA256 8d09d5c101186f01a49bd40acf83f97c9161b5c26e307f0592f55fd0b88a5701 DIST aufs2-0_p20100524.tar.bz2 9050579 RMD160 68babff24c29ecebfe8b412a63fe08c5f22be5c5 SHA1 2305c0f58d8057d13f8ecbe1376a570c53d087af SHA256 be7974855c79d2bb9e3f6f69763151d18aeea040d892cb2d71f51e74def0ee2d EBUILD aufs2-0_p20100405.ebuild 3098 RMD160 ab217a1e1c3f2d97b8f510928749638ef9c38924 SHA1 0b9897f7a20d6491c305ba1950d4a55b98322ec2 SHA256 396557502b782ceeb1c0f7c26e501a1e8ef4c7eec4f91f479109ee2424d247b9 -EBUILD aufs2-0_p20100524.ebuild 3160 RMD160 07caea53f9f59ffb49dc8625886bc6ce1f18f9de SHA1 dcb66e265d4a5ea8499b4b88a1b052d9c6222abe SHA256 312d26f3e1d42a9797b6289f5db92306eb51647066d4a877f0024494183b0cb0 -MISC ChangeLog 5035 RMD160 7e4a0950d57d00c35bfe37e34f6e02fc4b4c40ea SHA1 71f74385be455808622cbfb2cf9157c30c582acb SHA256 744d62ee811f6d4b54f435d280cb6d91d0915f7033177f56516a8b8ea01febc1 +EBUILD aufs2-0_p20100524.ebuild 3245 RMD160 dc4c163b47689e44a6fb0fc91bdb5e41b92cd5bf SHA1 fa96ba1215d6639c500c34f60e4a93da45bb2093 SHA256 886efed512a66c236e9531db02323f0d353e6c9cdb3bd80e8a38702d21831640 +MISC ChangeLog 5212 RMD160 cdc9cfbf65aea759bb10c82a9f8f4d81b848cee7 SHA1 3a4b98cd1f466107dfa9afe8b1e9af520d91cfe9 SHA256 92289a8496393c96e0f0d0b2369bdd3e70379882e5de7b9f4888ae97c4fafad1 MISC metadata.xml 550 RMD160 7269bc138013ec091e6025c4cb09148bd7740db5 SHA1 18b669d81765a665d50d3df22d14d77b576a89c1 SHA256 e9ea661a4a691f3c119d65ebab8ee933df91862f63a8cbfb8a1591307e49fc03 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.15 (GNU/Linux) -iJwEAQECAAYFAkwK1d0ACgkQG7kqcTWJkGfq3AP9E4pvnGW7DM0oBkbk1aao3ggs -bt/SJMLIK7ASVId//yRuPgA+B1PfWW6bZXlkGkYsmPIuylKRagfbHJFPdVgeoIWx -EN+X+YUjZpMBByvOspinjbXCef6EIS4NmdCFwPkO4YnYH57e1Tr5XU455i7WkDLl -NoEZrCvhQxzjvuTwFqs= -=olbx +iJwEAQECAAYFAkwg68kACgkQG7kqcTWJkGc6SgP+MoTixnjUn8N9oIdmc4MKb6ej +31218WiXoFBnXKMdxwJFnsSdpCAa4+tibPYAaDJVgBvisdUVNyx/fJsaD3EVMPOm +9XoJp4bzwkyOtzyNLtacR27a7ig2Lb1rR2cwTdu1IRp9H0Duvuw633cmcehFYN2+ +NW3RuYLYq/2tET3ViTE= +=+T3U -----END PGP SIGNATURE----- diff --git a/sys-fs/aufs2/aufs2-0_p20100524.ebuild b/sys-fs/aufs2/aufs2-0_p20100524.ebuild index 866165127999..d968ae862c1a 100644 --- a/sys-fs/aufs2/aufs2-0_p20100524.ebuild +++ b/sys-fs/aufs2/aufs2-0_p20100524.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/aufs2/aufs2-0_p20100524.ebuild,v 1.2 2010/06/05 22:55:07 tommy Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/aufs2/aufs2-0_p20100524.ebuild,v 1.3 2010/06/22 16:58:38 tommy Exp $ EAPI="2" @@ -13,7 +13,7 @@ SRC_URI="mirror://gentoo/${P}.tar.bz2" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" -IUSE="debug inotify kernel-patch nfs ramfs" +IUSE="debug inotify hardened kernel-patch nfs ramfs" DEPEND="dev-vcs/git" RDEPEND="!sys-fs/aufs" @@ -65,6 +65,9 @@ src_prepare() { if use ramfs; then sed -i "s:RAMFS =:RAMFS = y:g" config.mk || die fi + if use hardened ; then + epatch "${FILESDIR}"/pax.patch + fi cd "${WORKDIR}"/${PN}-util sed -i "/LDFLAGS += -static -s/d" Makefile || die @@ -86,7 +89,7 @@ src_install() { docinto design dodoc design/*.txt || die cd "${WORKDIR}"/${PN}-util - emake DESTDIR="${D}" install || die + emake DESTDIR="${D}" KDIR=${KV_DIR} install || die docinto newdoc README README-utils || die } diff --git a/sys-fs/aufs2/files/pax.patch b/sys-fs/aufs2/files/pax.patch new file mode 100644 index 000000000000..df53004daddb --- /dev/null +++ b/sys-fs/aufs2/files/pax.patch @@ -0,0 +1,135 @@ +commit 584bf002ec62a333840b87193b93ee5a521063f7 +Author: J. R. Okajima +Date: Thu May 27 11:28:41 2010 +0900 + + aufs: dynop supports grsec/pax patch + + The grsec/pax patches make member of struct brabra_operation 'const.' + I don't understand why they need these 'const'. They modifies some of + structures, but other structures. + What do they want to protect from what? + + The keyword 'const' is essentially a feature of C language and it never + modifes the behaviour of software. It just prohibits the assignment (or + modification) to a variable which is expected not to be modified. + In other word, it is a feature for programmers and doesn't enhance the + security level. Actually programmers can bypass 'const' easily by + indirect assignment as this patch does. + + Also the grsec/pax patches modifies some assignments to the member + of struct brabra_operation in mainline kernel, but they don't make the + confirmation fot that. For example, they replaced these assignments by + declaring a structure statically. + + - /* inherit and extend fuse_dev_operations */ + - cuse_channel_fops = fuse_dev_operations; + - cuse_channel_fops.owner = THIS_MODULE; + - cuse_channel_fops.open = cuse_channel_open; + - cuse_channel_fops.release = cuse_channel_release; + + +static const struct file_operations cuse_channel_fops = { + + .owner = THIS_MODULE, + + .llseek = no_llseek, + + .read = do_sync_read, + + .aio_read = fuse_dev_read, + + .write = do_sync_write, + + .aio_write = fuse_dev_write, + + .poll = fuse_dev_poll, + + .open = cuse_channel_open, + + .release = cuse_channel_release, + + .fasync = fuse_dev_fasync, + +}; + + By this modification, there exists major possible future problem I am + afraid. _If_ fuse_dev_operations is modified, then this code needs to + follow the change. But it is hard to detect such modification since + there is no trick to do so. Generally it is recommended to put code such + like this. + + ---------------------------------------------------------------------- + int n; + n++; + BUG_ON(super.member != derive.member); + } while (0); + + n++; /* owner */ + MakeSure(fuse_dev_operations, cuse_channel_fops, llseek); + MakeSure(fuse_dev_operations, cuse_channel_fops, read); + ::: + BUG_ON(n != sizeof(cuse_channel_fops)/sizeof(cuse_channel_fops.owner)); + ---------------------------------------------------------------------- + + This piece of code ensures two things. + - cuse_channel_fops correctly inherits fuse_dev_operations, eg. all + members are equivalent except the overrided ones. + - if some members are added or deleted from struct file_operations, it + should be detected by a debugging feature, the variable 'n'. + + Without such trick, I am afraid the simple modification is a regression. + + Signed-off-by: J. R. Okajima + +diff --git a/fs/aufs/dynop.c b/fs/aufs/dynop.c +index 12ea894..109d3bb 100644 +--- a/fs/aufs/dynop.c ++++ b/fs/aufs/dynop.c +@@ -146,11 +146,22 @@ void au_dy_put(struct au_dykey *key) + #define DyDbgInc(cnt) do {} while (0) + #endif + ++#define AuGrsecPaxPtr(func, dst, src) do { \ ++ union { \ ++ const void *o; \ ++ char **p; \ ++ } u; \ ++ BUILD_BUG_ON(sizeof(u.o) != sizeof(&dst.func)); \ ++ BUILD_BUG_ON(sizeof(*u.p) != sizeof(src.func)); \ ++ u.o = (void *)&dst.func; \ ++ *u.p = (void *)src.func; \ ++} while (0) ++ + #define DySet(func, dst, src, h_op, h_sb) do { \ + DyDbgInc(cnt); \ + if (h_op->func) { \ + if (src.func) \ +- dst.func = src.func; \ ++ AuGrsecPaxPtr(func, dst, src); \ + else \ + AuDbg("%s %s\n", au_sbtype(h_sb), #func); \ + } \ +@@ -159,7 +170,7 @@ void au_dy_put(struct au_dykey *key) + #define DySetForce(func, dst, src) do { \ + AuDebugOn(!src.func); \ + DyDbgInc(cnt); \ +- dst.func = src.func; \ ++ AuGrsecPaxPtr(func, dst, src); \ + } while (0) + + #define DySetAop(func) \ +@@ -297,14 +308,21 @@ out: + */ + static void dy_adx(struct au_dyaop *dyaop, int do_dx) + { ++ union { ++ void *direct_IO, *get_xip_mem; ++ } grsec_pax_dummy = { ++ .get_xip_mem = NULL ++ }; ++ + if (!do_dx) { +- dyaop->da_op.direct_IO = NULL; +- dyaop->da_op.get_xip_mem = NULL; ++ AuGrsecPaxPtr(direct_IO, dyaop->da_op, grsec_pax_dummy); ++ AuGrsecPaxPtr(get_xip_mem, dyaop->da_op, grsec_pax_dummy); + } else { +- dyaop->da_op.direct_IO = aufs_aop.direct_IO; +- dyaop->da_op.get_xip_mem = aufs_aop.get_xip_mem; ++ AuGrsecPaxPtr(direct_IO, dyaop->da_op, aufs_aop); ++ AuGrsecPaxPtr(get_xip_mem, dyaop->da_op, aufs_aop); + if (!dyaop->da_get_xip_mem) +- dyaop->da_op.get_xip_mem = NULL; ++ AuGrsecPaxPtr(get_xip_mem, dyaop->da_op, ++ grsec_pax_dummy); + } + } +