* [gentoo-commits] linux-patches r2842 - genpatches-2.6/trunk/3.14
@ 2014-06-18 15:46 Mike Pagano (mpagano)
0 siblings, 0 replies; only message in thread
From: Mike Pagano (mpagano) @ 2014-06-18 15:46 UTC (permalink / raw
To: gentoo-commits
Author: mpagano
Date: 2014-06-18 15:46:02 +0000 (Wed, 18 Jun 2014)
New Revision: 2842
Added:
genpatches-2.6/trunk/3.14/1007_linux-3.14.8.patch
Removed:
genpatches-2.6/trunk/3.14/4400_fs-userns-change-inode_capable-to-capable_wrt_inode_uidgid.patch
Modified:
genpatches-2.6/trunk/3.14/0000_README
Log:
Linux patch 3.14.8. Removal of redundant patch
Modified: genpatches-2.6/trunk/3.14/0000_README
===================================================================
--- genpatches-2.6/trunk/3.14/0000_README 2014-06-18 15:38:10 UTC (rev 2841)
+++ genpatches-2.6/trunk/3.14/0000_README 2014-06-18 15:46:02 UTC (rev 2842)
@@ -70,6 +70,10 @@
From: http://www.kernel.org
Desc: Linux 3.14.7
+Patch: 1007_linux-3.14.8.patch
+From: http://www.kernel.org
+Desc: Linux 3.14.8
+
Patch: 1500_XATTR_USER_PREFIX.patch
From: https://bugs.gentoo.org/show_bug.cgi?id=470644
Desc: Support for namespace user.pax.* on tmpfs.
@@ -98,10 +102,6 @@
From: http://dev.gentoo.org/~spock
Desc: Bootsplash successor by Michal Januszewski ported by Jeremy (bug #452574)
-Patch: 4400_fs-userns-change-inode_capable-to-capable_wrt_inode_uidgid.patch
-From: https://bugs.gentoo.org/show_bug.cgi?id=512980
-Desc: Change inode_capable to capable_wrt_inode_uidgid, fixes CVE-2014-4014
-
Patch: 4500_support-for-pogoplug-e02.patch
From: Cristoph Junghans <ottxor@gentoo.org>
Desc: Support for Pogoplug e02 (bug #460350), adjusted to be opt-in by TomWij.
Added: genpatches-2.6/trunk/3.14/1007_linux-3.14.8.patch
===================================================================
--- genpatches-2.6/trunk/3.14/1007_linux-3.14.8.patch (rev 0)
+++ genpatches-2.6/trunk/3.14/1007_linux-3.14.8.patch 2014-06-18 15:46:02 UTC (rev 2842)
@@ -0,0 +1,550 @@
+diff --git a/Makefile b/Makefile
+index f2d1225828c2..ef1d59b750ea 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ VERSION = 3
+ PATCHLEVEL = 14
+-SUBLEVEL = 7
++SUBLEVEL = 8
+ EXTRAVERSION =
+ NAME = Remembering Coco
+
+diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
+index 24846f9053fe..e80ae50cae80 100644
+--- a/arch/mips/include/asm/thread_info.h
++++ b/arch/mips/include/asm/thread_info.h
+@@ -136,7 +136,8 @@ static inline struct thread_info *current_thread_info(void)
+ #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
+
+ #define _TIF_WORK_SYSCALL_ENTRY (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \
+- _TIF_SYSCALL_AUDIT | _TIF_SYSCALL_TRACEPOINT)
++ _TIF_SYSCALL_AUDIT | \
++ _TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP)
+
+ /* work to do in syscall_trace_leave() */
+ #define _TIF_WORK_SYSCALL_EXIT (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \
+diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
+index 8f18342540d8..9aa42998d757 100644
+--- a/drivers/ata/ahci.c
++++ b/drivers/ata/ahci.c
+@@ -446,10 +446,14 @@ static const struct pci_device_id ahci_pci_tbl[] = {
+ .driver_data = board_ahci_yes_fbs }, /* 88se9172 */
+ { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9192),
+ .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */
++ { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a0),
++ .driver_data = board_ahci_yes_fbs },
+ { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x91a3),
+ .driver_data = board_ahci_yes_fbs },
+ { PCI_DEVICE(PCI_VENDOR_ID_MARVELL_EXT, 0x9230),
+ .driver_data = board_ahci_yes_fbs },
++ { PCI_DEVICE(PCI_VENDOR_ID_TTI, 0x0642),
++ .driver_data = board_ahci_yes_fbs },
+
+ /* Promise */
+ { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */
+diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
+index b7794792760d..091169152f77 100644
+--- a/drivers/infiniband/ulp/isert/ib_isert.c
++++ b/drivers/infiniband/ulp/isert/ib_isert.c
+@@ -489,6 +489,14 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
+ struct ib_device *ib_dev = cma_id->device;
+ int ret = 0;
+
++ spin_lock_bh(&np->np_thread_lock);
++ if (!np->enabled) {
++ spin_unlock_bh(&np->np_thread_lock);
++ pr_debug("iscsi_np is not enabled, reject connect request\n");
++ return rdma_reject(cma_id, NULL, 0);
++ }
++ spin_unlock_bh(&np->np_thread_lock);
++
+ pr_debug("Entering isert_connect_request cma_id: %p, context: %p\n",
+ cma_id, cma_id->context);
+
+diff --git a/drivers/media/dvb-core/dvb-usb-ids.h b/drivers/media/dvb-core/dvb-usb-ids.h
+index f19a2ccd1e4b..80643ef9183f 100644
+--- a/drivers/media/dvb-core/dvb-usb-ids.h
++++ b/drivers/media/dvb-core/dvb-usb-ids.h
+@@ -257,6 +257,7 @@
+ #define USB_PID_TERRATEC_T5 0x10a1
+ #define USB_PID_NOXON_DAB_STICK 0x00b3
+ #define USB_PID_NOXON_DAB_STICK_REV2 0x00e0
++#define USB_PID_NOXON_DAB_STICK_REV3 0x00b4
+ #define USB_PID_PINNACLE_EXPRESSCARD_320CX 0x022e
+ #define USB_PID_PINNACLE_PCTV2000E 0x022c
+ #define USB_PID_PINNACLE_PCTV_DVB_T_FLASH 0x0228
+@@ -360,6 +361,7 @@
+ #define USB_PID_FRIIO_WHITE 0x0001
+ #define USB_PID_TVWAY_PLUS 0x0002
+ #define USB_PID_SVEON_STV20 0xe39d
++#define USB_PID_SVEON_STV20_RTL2832U 0xd39d
+ #define USB_PID_SVEON_STV22 0xe401
+ #define USB_PID_SVEON_STV22_IT9137 0xe411
+ #define USB_PID_AZUREWAVE_AZ6027 0x3275
+@@ -374,4 +376,5 @@
+ #define USB_PID_CTVDIGDUAL_V2 0xe410
+ #define USB_PID_PCTV_2002E 0x025c
+ #define USB_PID_PCTV_2002E_SE 0x025d
++#define USB_PID_SVEON_STV27 0xd3af
+ #endif
+diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+index fda5c64ba0e8..fd1312d0b078 100644
+--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
++++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+@@ -1382,6 +1382,7 @@ static const struct dvb_usb_device_properties rtl2832u_props = {
+ };
+
+ static const struct usb_device_id rtl28xxu_id_table[] = {
++ /* RTL2831U devices: */
+ { DVB_USB_DEVICE(USB_VID_REALTEK, USB_PID_REALTEK_RTL2831U,
+ &rtl2831u_props, "Realtek RTL2831U reference design", NULL) },
+ { DVB_USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_FREECOM_DVBT,
+@@ -1389,6 +1390,7 @@ static const struct usb_device_id rtl28xxu_id_table[] = {
+ { DVB_USB_DEVICE(USB_VID_WIDEVIEW, USB_PID_FREECOM_DVBT_2,
+ &rtl2831u_props, "Freecom USB2.0 DVB-T", NULL) },
+
++ /* RTL2832U devices: */
+ { DVB_USB_DEVICE(USB_VID_REALTEK, 0x2832,
+ &rtl2832u_props, "Realtek RTL2832U reference design", NULL) },
+ { DVB_USB_DEVICE(USB_VID_REALTEK, 0x2838,
+@@ -1401,6 +1403,8 @@ static const struct usb_device_id rtl28xxu_id_table[] = {
+ &rtl2832u_props, "TerraTec NOXON DAB Stick", NULL) },
+ { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK_REV2,
+ &rtl2832u_props, "TerraTec NOXON DAB Stick (rev 2)", NULL) },
++ { DVB_USB_DEVICE(USB_VID_TERRATEC, USB_PID_NOXON_DAB_STICK_REV3,
++ &rtl2832u_props, "TerraTec NOXON DAB Stick (rev 3)", NULL) },
+ { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_TREKSTOR_TERRES_2_0,
+ &rtl2832u_props, "Trekstor DVB-T Stick Terres 2.0", NULL) },
+ { DVB_USB_DEVICE(USB_VID_DEXATEK, 0x1101,
+@@ -1429,7 +1433,16 @@ static const struct usb_device_id rtl28xxu_id_table[] = {
+ &rtl2832u_props, "Leadtek WinFast DTV Dongle mini", NULL) },
+ { DVB_USB_DEVICE(USB_VID_GTEK, USB_PID_CPYTO_REDI_PC50A,
+ &rtl2832u_props, "Crypto ReDi PC 50 A", NULL) },
+-
++ { DVB_USB_DEVICE(USB_VID_KYE, 0x707f,
++ &rtl2832u_props, "Genius TVGo DVB-T03", NULL) },
++ { DVB_USB_DEVICE(USB_VID_KWORLD_2, 0xd395,
++ &rtl2832u_props, "Peak DVB-T USB", NULL) },
++ { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV20_RTL2832U,
++ &rtl2832u_props, "Sveon STV20", NULL) },
++ { DVB_USB_DEVICE(USB_VID_KWORLD_2, USB_PID_SVEON_STV27,
++ &rtl2832u_props, "Sveon STV27", NULL) },
++
++ /* RTL2832P devices: */
+ { DVB_USB_DEVICE(USB_VID_HANFTEK, 0x0131,
+ &rtl2832u_props, "Astrometa DVB-T2", NULL) },
+ { }
+diff --git a/drivers/misc/mei/hw-me.c b/drivers/misc/mei/hw-me.c
+index 6f656c053b14..fbc4a7bbdfa9 100644
+--- a/drivers/misc/mei/hw-me.c
++++ b/drivers/misc/mei/hw-me.c
+@@ -164,6 +164,9 @@ static void mei_me_hw_reset_release(struct mei_device *dev)
+ hcsr |= H_IG;
+ hcsr &= ~H_RST;
+ mei_hcsr_set(hw, hcsr);
++
++ /* complete this write before we set host ready on another CPU */
++ mmiowb();
+ }
+ /**
+ * mei_me_hw_reset - resets fw via mei csr register.
+@@ -183,8 +186,21 @@ static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable)
+ else
+ hcsr &= ~H_IE;
+
++ dev->recvd_hw_ready = false;
+ mei_me_reg_write(hw, H_CSR, hcsr);
+
++ /*
++ * Host reads the H_CSR once to ensure that the
++ * posted write to H_CSR completes.
++ */
++ hcsr = mei_hcsr_read(hw);
++
++ if ((hcsr & H_RST) == 0)
++ dev_warn(&dev->pdev->dev, "H_RST is not set = 0x%08X", hcsr);
++
++ if ((hcsr & H_RDY) == H_RDY)
++ dev_warn(&dev->pdev->dev, "H_RDY is not cleared 0x%08X", hcsr);
++
+ if (intr_enable == false)
+ mei_me_hw_reset_release(dev);
+
+@@ -201,6 +217,7 @@ static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable)
+ static void mei_me_host_set_ready(struct mei_device *dev)
+ {
+ struct mei_me_hw *hw = to_me_hw(dev);
++ hw->host_hw_state = mei_hcsr_read(hw);
+ hw->host_hw_state |= H_IE | H_IG | H_RDY;
+ mei_hcsr_set(hw, hw->host_hw_state);
+ }
+@@ -233,10 +250,7 @@ static bool mei_me_hw_is_ready(struct mei_device *dev)
+ static int mei_me_hw_ready_wait(struct mei_device *dev)
+ {
+ int err;
+- if (mei_me_hw_is_ready(dev))
+- return 0;
+
+- dev->recvd_hw_ready = false;
+ mutex_unlock(&dev->device_lock);
+ err = wait_event_interruptible_timeout(dev->wait_hw_ready,
+ dev->recvd_hw_ready,
+@@ -491,14 +505,13 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)
+ /* check if we need to start the dev */
+ if (!mei_host_is_ready(dev)) {
+ if (mei_hw_is_ready(dev)) {
++ mei_me_hw_reset_release(dev);
+ dev_dbg(&dev->pdev->dev, "we need to start the dev.\n");
+
+ dev->recvd_hw_ready = true;
+ wake_up_interruptible(&dev->wait_hw_ready);
+ } else {
+-
+- dev_dbg(&dev->pdev->dev, "Reset Completed.\n");
+- mei_me_hw_reset_release(dev);
++ dev_dbg(&dev->pdev->dev, "Spurious Interrupt\n");
+ }
+ goto end;
+ }
+diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
+index 955ab7990c5b..fb02fc2fb034 100644
+--- a/drivers/pci/msi.c
++++ b/drivers/pci/msi.c
+@@ -414,7 +414,7 @@ static void free_msi_irqs(struct pci_dev *dev)
+ if (dev->msi_irq_groups) {
+ sysfs_remove_groups(&dev->dev.kobj, dev->msi_irq_groups);
+ msi_attrs = dev->msi_irq_groups[0]->attrs;
+- list_for_each_entry(entry, &dev->msi_list, list) {
++ while (msi_attrs[count]) {
+ dev_attr = container_of(msi_attrs[count],
+ struct device_attribute, attr);
+ kfree(dev_attr->attr.name);
+diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
+index 86b92d95ac10..39a34da5260f 100644
+--- a/drivers/target/iscsi/iscsi_target.c
++++ b/drivers/target/iscsi/iscsi_target.c
+@@ -460,6 +460,7 @@ int iscsit_del_np(struct iscsi_np *np)
+ spin_lock_bh(&np->np_thread_lock);
+ np->np_exports--;
+ if (np->np_exports) {
++ np->enabled = true;
+ spin_unlock_bh(&np->np_thread_lock);
+ return 0;
+ }
+diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h
+index 48f7b3bf4e8c..1d4a8c86551f 100644
+--- a/drivers/target/iscsi/iscsi_target_core.h
++++ b/drivers/target/iscsi/iscsi_target_core.h
+@@ -773,6 +773,7 @@ struct iscsi_np {
+ int np_ip_proto;
+ int np_sock_type;
+ enum np_thread_state_table np_thread_state;
++ bool enabled;
+ enum iscsi_timer_flags_table np_login_timer_flags;
+ u32 np_exports;
+ enum np_flags_table np_flags;
+diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c
+index 369ef10e8077..cad6fdcc64da 100644
+--- a/drivers/target/iscsi/iscsi_target_login.c
++++ b/drivers/target/iscsi/iscsi_target_login.c
+@@ -981,6 +981,7 @@ int iscsi_target_setup_login_socket(
+ }
+
+ np->np_transport = t;
++ np->enabled = true;
+ return 0;
+ }
+
+diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c
+index 44a5471de00f..d875f7972325 100644
+--- a/drivers/target/iscsi/iscsi_target_tpg.c
++++ b/drivers/target/iscsi/iscsi_target_tpg.c
+@@ -184,6 +184,8 @@ static void iscsit_clear_tpg_np_login_thread(
+ return;
+ }
+
++ if (shutdown)
++ tpg_np->tpg_np->enabled = false;
+ iscsit_reset_np_thread(tpg_np->tpg_np, tpg_np, tpg, shutdown);
+ }
+
+diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c
+index c3d9df6aaf5f..f0f0cc0e5752 100644
+--- a/drivers/target/target_core_alua.c
++++ b/drivers/target/target_core_alua.c
+@@ -564,7 +564,16 @@ static inline int core_alua_state_standby(
+ case REPORT_LUNS:
+ case RECEIVE_DIAGNOSTIC:
+ case SEND_DIAGNOSTIC:
++ case READ_CAPACITY:
+ return 0;
++ case SERVICE_ACTION_IN:
++ switch (cdb[1] & 0x1f) {
++ case SAI_READ_CAPACITY_16:
++ return 0;
++ default:
++ *alua_ascq = ASCQ_04H_ALUA_TG_PT_STANDBY;
++ return 1;
++ }
+ case MAINTENANCE_IN:
+ switch (cdb[1] & 0x1f) {
+ case MI_REPORT_TARGET_PGS:
+diff --git a/fs/attr.c b/fs/attr.c
+index 5d4e59d56e85..6530ced19697 100644
+--- a/fs/attr.c
++++ b/fs/attr.c
+@@ -50,14 +50,14 @@ int inode_change_ok(const struct inode *inode, struct iattr *attr)
+ if ((ia_valid & ATTR_UID) &&
+ (!uid_eq(current_fsuid(), inode->i_uid) ||
+ !uid_eq(attr->ia_uid, inode->i_uid)) &&
+- !inode_capable(inode, CAP_CHOWN))
++ !capable_wrt_inode_uidgid(inode, CAP_CHOWN))
+ return -EPERM;
+
+ /* Make sure caller can chgrp. */
+ if ((ia_valid & ATTR_GID) &&
+ (!uid_eq(current_fsuid(), inode->i_uid) ||
+ (!in_group_p(attr->ia_gid) && !gid_eq(attr->ia_gid, inode->i_gid))) &&
+- !inode_capable(inode, CAP_CHOWN))
++ !capable_wrt_inode_uidgid(inode, CAP_CHOWN))
+ return -EPERM;
+
+ /* Make sure a caller can chmod. */
+@@ -67,7 +67,7 @@ int inode_change_ok(const struct inode *inode, struct iattr *attr)
+ /* Also check the setgid bit! */
+ if (!in_group_p((ia_valid & ATTR_GID) ? attr->ia_gid :
+ inode->i_gid) &&
+- !inode_capable(inode, CAP_FSETID))
++ !capable_wrt_inode_uidgid(inode, CAP_FSETID))
+ attr->ia_mode &= ~S_ISGID;
+ }
+
+@@ -160,7 +160,7 @@ void setattr_copy(struct inode *inode, const struct iattr *attr)
+ umode_t mode = attr->ia_mode;
+
+ if (!in_group_p(inode->i_gid) &&
+- !inode_capable(inode, CAP_FSETID))
++ !capable_wrt_inode_uidgid(inode, CAP_FSETID))
+ mode &= ~S_ISGID;
+ inode->i_mode = mode;
+ }
+diff --git a/fs/inode.c b/fs/inode.c
+index 4bcdad3c9361..e846a32e8d6e 100644
+--- a/fs/inode.c
++++ b/fs/inode.c
+@@ -1840,14 +1840,18 @@ EXPORT_SYMBOL(inode_init_owner);
+ * inode_owner_or_capable - check current task permissions to inode
+ * @inode: inode being checked
+ *
+- * Return true if current either has CAP_FOWNER to the inode, or
+- * owns the file.
++ * Return true if current either has CAP_FOWNER in a namespace with the
++ * inode owner uid mapped, or owns the file.
+ */
+ bool inode_owner_or_capable(const struct inode *inode)
+ {
++ struct user_namespace *ns;
++
+ if (uid_eq(current_fsuid(), inode->i_uid))
+ return true;
+- if (inode_capable(inode, CAP_FOWNER))
++
++ ns = current_user_ns();
++ if (ns_capable(ns, CAP_FOWNER) && kuid_has_mapping(ns, inode->i_uid))
+ return true;
+ return false;
+ }
+diff --git a/fs/namei.c b/fs/namei.c
+index 4a3c105cf703..8274c8d39b03 100644
+--- a/fs/namei.c
++++ b/fs/namei.c
+@@ -332,10 +332,11 @@ int generic_permission(struct inode *inode, int mask)
+
+ if (S_ISDIR(inode->i_mode)) {
+ /* DACs are overridable for directories */
+- if (inode_capable(inode, CAP_DAC_OVERRIDE))
++ if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE))
+ return 0;
+ if (!(mask & MAY_WRITE))
+- if (inode_capable(inode, CAP_DAC_READ_SEARCH))
++ if (capable_wrt_inode_uidgid(inode,
++ CAP_DAC_READ_SEARCH))
+ return 0;
+ return -EACCES;
+ }
+@@ -345,7 +346,7 @@ int generic_permission(struct inode *inode, int mask)
+ * at least one exec bit set.
+ */
+ if (!(mask & MAY_EXEC) || (inode->i_mode & S_IXUGO))
+- if (inode_capable(inode, CAP_DAC_OVERRIDE))
++ if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE))
+ return 0;
+
+ /*
+@@ -353,7 +354,7 @@ int generic_permission(struct inode *inode, int mask)
+ */
+ mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
+ if (mask == MAY_READ)
+- if (inode_capable(inode, CAP_DAC_READ_SEARCH))
++ if (capable_wrt_inode_uidgid(inode, CAP_DAC_READ_SEARCH))
+ return 0;
+
+ return -EACCES;
+@@ -2370,7 +2371,7 @@ static inline int check_sticky(struct inode *dir, struct inode *inode)
+ return 0;
+ if (uid_eq(dir->i_uid, fsuid))
+ return 0;
+- return !inode_capable(inode, CAP_FOWNER);
++ return !capable_wrt_inode_uidgid(inode, CAP_FOWNER);
+ }
+
+ /*
+diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
+index bcfe61202115..78e62cc471c5 100644
+--- a/fs/xfs/xfs_ioctl.c
++++ b/fs/xfs/xfs_ioctl.c
+@@ -1241,7 +1241,7 @@ xfs_ioctl_setattr(
+ * cleared upon successful return from chown()
+ */
+ if ((ip->i_d.di_mode & (S_ISUID|S_ISGID)) &&
+- !inode_capable(VFS_I(ip), CAP_FSETID))
++ !capable_wrt_inode_uidgid(VFS_I(ip), CAP_FSETID))
+ ip->i_d.di_mode &= ~(S_ISUID|S_ISGID);
+
+ /*
+diff --git a/include/linux/capability.h b/include/linux/capability.h
+index a6ee1f9a5018..84b13ad67c1c 100644
+--- a/include/linux/capability.h
++++ b/include/linux/capability.h
+@@ -210,7 +210,7 @@ extern bool has_ns_capability_noaudit(struct task_struct *t,
+ struct user_namespace *ns, int cap);
+ extern bool capable(int cap);
+ extern bool ns_capable(struct user_namespace *ns, int cap);
+-extern bool inode_capable(const struct inode *inode, int cap);
++extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap);
+ extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap);
+
+ /* audit system wants to get cap info from files as well */
+diff --git a/kernel/auditsc.c b/kernel/auditsc.c
+index 3b29605ea1b2..37e621606807 100644
+--- a/kernel/auditsc.c
++++ b/kernel/auditsc.c
+@@ -720,6 +720,22 @@ static enum audit_state audit_filter_task(struct task_struct *tsk, char **key)
+ return AUDIT_BUILD_CONTEXT;
+ }
+
++static int audit_in_mask(const struct audit_krule *rule, unsigned long val)
++{
++ int word, bit;
++
++ if (val > 0xffffffff)
++ return false;
++
++ word = AUDIT_WORD(val);
++ if (word >= AUDIT_BITMASK_SIZE)
++ return false;
++
++ bit = AUDIT_BIT(val);
++
++ return rule->mask[word] & bit;
++}
++
+ /* At syscall entry and exit time, this filter is called if the
+ * audit_state is not low enough that auditing cannot take place, but is
+ * also not high enough that we already know we have to write an audit
+@@ -737,11 +753,8 @@ static enum audit_state audit_filter_syscall(struct task_struct *tsk,
+
+ rcu_read_lock();
+ if (!list_empty(list)) {
+- int word = AUDIT_WORD(ctx->major);
+- int bit = AUDIT_BIT(ctx->major);
+-
+ list_for_each_entry_rcu(e, list, list) {
+- if ((e->rule.mask[word] & bit) == bit &&
++ if (audit_in_mask(&e->rule, ctx->major) &&
+ audit_filter_rules(tsk, &e->rule, ctx, NULL,
+ &state, false)) {
+ rcu_read_unlock();
+@@ -761,20 +774,16 @@ static enum audit_state audit_filter_syscall(struct task_struct *tsk,
+ static int audit_filter_inode_name(struct task_struct *tsk,
+ struct audit_names *n,
+ struct audit_context *ctx) {
+- int word, bit;
+ int h = audit_hash_ino((u32)n->ino);
+ struct list_head *list = &audit_inode_hash[h];
+ struct audit_entry *e;
+ enum audit_state state;
+
+- word = AUDIT_WORD(ctx->major);
+- bit = AUDIT_BIT(ctx->major);
+-
+ if (list_empty(list))
+ return 0;
+
+ list_for_each_entry_rcu(e, list, list) {
+- if ((e->rule.mask[word] & bit) == bit &&
++ if (audit_in_mask(&e->rule, ctx->major) &&
+ audit_filter_rules(tsk, &e->rule, ctx, n, &state, false)) {
+ ctx->current_state = state;
+ return 1;
+diff --git a/kernel/capability.c b/kernel/capability.c
+index 34019c57888d..1191a44786df 100644
+--- a/kernel/capability.c
++++ b/kernel/capability.c
+@@ -433,23 +433,19 @@ bool capable(int cap)
+ EXPORT_SYMBOL(capable);
+
+ /**
+- * inode_capable - Check superior capability over inode
++ * capable_wrt_inode_uidgid - Check nsown_capable and uid and gid mapped
+ * @inode: The inode in question
+ * @cap: The capability in question
+ *
+- * Return true if the current task has the given superior capability
+- * targeted at it's own user namespace and that the given inode is owned
+- * by the current user namespace or a child namespace.
+- *
+- * Currently we check to see if an inode is owned by the current
+- * user namespace by seeing if the inode's owner maps into the
+- * current user namespace.
+- *
++ * Return true if the current task has the given capability targeted at
++ * its own user namespace and that the given inode's uid and gid are
++ * mapped into the current user namespace.
+ */
+-bool inode_capable(const struct inode *inode, int cap)
++bool capable_wrt_inode_uidgid(const struct inode *inode, int cap)
+ {
+ struct user_namespace *ns = current_user_ns();
+
+- return ns_capable(ns, cap) && kuid_has_mapping(ns, inode->i_uid);
++ return ns_capable(ns, cap) && kuid_has_mapping(ns, inode->i_uid) &&
++ kgid_has_mapping(ns, inode->i_gid);
+ }
+-EXPORT_SYMBOL(inode_capable);
++EXPORT_SYMBOL(capable_wrt_inode_uidgid);
+diff --git a/net/ipv4/netfilter/nf_defrag_ipv4.c b/net/ipv4/netfilter/nf_defrag_ipv4.c
+index 12e13bd82b5b..f40f321b41fc 100644
+--- a/net/ipv4/netfilter/nf_defrag_ipv4.c
++++ b/net/ipv4/netfilter/nf_defrag_ipv4.c
+@@ -22,7 +22,6 @@
+ #endif
+ #include <net/netfilter/nf_conntrack_zones.h>
+
+-/* Returns new sk_buff, or NULL */
+ static int nf_ct_ipv4_gather_frags(struct sk_buff *skb, u_int32_t user)
+ {
+ int err;
+@@ -33,8 +32,10 @@ static int nf_ct_ipv4_gather_frags(struct sk_buff *skb, u_int32_t user)
+ err = ip_defrag(skb, user);
+ local_bh_enable();
+
+- if (!err)
++ if (!err) {
+ ip_send_check(ip_hdr(skb));
++ skb->local_df = 1;
++ }
+
+ return err;
+ }
Deleted: genpatches-2.6/trunk/3.14/4400_fs-userns-change-inode_capable-to-capable_wrt_inode_uidgid.patch
===================================================================
--- genpatches-2.6/trunk/3.14/4400_fs-userns-change-inode_capable-to-capable_wrt_inode_uidgid.patch 2014-06-18 15:38:10 UTC (rev 2841)
+++ genpatches-2.6/trunk/3.14/4400_fs-userns-change-inode_capable-to-capable_wrt_inode_uidgid.patch 2014-06-18 15:46:02 UTC (rev 2842)
@@ -1,160 +0,0 @@
---- a/fs/attr.c 2014-06-11 19:56:10.729668444 -0400
-+++ b/fs/attr.c 2014-06-11 20:19:09.719657538 -0400
-@@ -50,14 +50,14 @@ int inode_change_ok(const struct inode *
- if ((ia_valid & ATTR_UID) &&
- (!uid_eq(current_fsuid(), inode->i_uid) ||
- !uid_eq(attr->ia_uid, inode->i_uid)) &&
-- !inode_capable(inode, CAP_CHOWN))
-+ !capable_wrt_inode_uidgid(inode, CAP_CHOWN))
- return -EPERM;
-
- /* Make sure caller can chgrp. */
- if ((ia_valid & ATTR_GID) &&
- (!uid_eq(current_fsuid(), inode->i_uid) ||
- (!in_group_p(attr->ia_gid) && !gid_eq(attr->ia_gid, inode->i_gid))) &&
-- !inode_capable(inode, CAP_CHOWN))
-+ !capable_wrt_inode_uidgid(inode, CAP_CHOWN))
- return -EPERM;
-
- /* Make sure a caller can chmod. */
-@@ -67,7 +67,7 @@ int inode_change_ok(const struct inode *
- /* Also check the setgid bit! */
- if (!in_group_p((ia_valid & ATTR_GID) ? attr->ia_gid :
- inode->i_gid) &&
-- !inode_capable(inode, CAP_FSETID))
-+ !capable_wrt_inode_uidgid(inode, CAP_FSETID))
- attr->ia_mode &= ~S_ISGID;
- }
-
-@@ -160,7 +160,7 @@ void setattr_copy(struct inode *inode, c
- umode_t mode = attr->ia_mode;
-
- if (!in_group_p(inode->i_gid) &&
-- !inode_capable(inode, CAP_FSETID))
-+ !capable_wrt_inode_uidgid(inode, CAP_FSETID))
- mode &= ~S_ISGID;
- inode->i_mode = mode;
- }
---- a/fs/inode.c 2014-06-11 19:56:23.489668343 -0400
-+++ b/fs/inode.c 2014-06-11 20:06:19.049663633 -0400
-@@ -1840,14 +1840,18 @@ EXPORT_SYMBOL(inode_init_owner);
- * inode_owner_or_capable - check current task permissions to inode
- * @inode: inode being checked
- *
-- * Return true if current either has CAP_FOWNER to the inode, or
-- * owns the file.
-+ * Return true if current either has CAP_FOWNER in a namespace with the
-+ * inode owner uid mapped, or owns the file
- */
- bool inode_owner_or_capable(const struct inode *inode)
- {
-+ struct user_namespace *ns;
-+
- if (uid_eq(current_fsuid(), inode->i_uid))
- return true;
-- if (inode_capable(inode, CAP_FOWNER))
-+
-+ ns = current_user_ns();
-+ if (ns_capable(ns, CAP_FOWNER) && kuid_has_mapping(ns, inode->i_uid))
- return true;
- return false;
- }
---- a/fs/namei.c 2014-06-11 19:56:33.039668268 -0400
-+++ b/fs/namei.c 2014-06-11 20:10:37.189661592 -0400
-@@ -332,10 +332,11 @@ int generic_permission(struct inode *ino
-
- if (S_ISDIR(inode->i_mode)) {
- /* DACs are overridable for directories */
-- if (inode_capable(inode, CAP_DAC_OVERRIDE))
-+ if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE))
- return 0;
- if (!(mask & MAY_WRITE))
-- if (inode_capable(inode, CAP_DAC_READ_SEARCH))
-+ if (capable_wrt_inode_uidgid(inode,
-+ CAP_DAC_READ_SEARCH))
- return 0;
- return -EACCES;
- }
-@@ -345,7 +346,7 @@ int generic_permission(struct inode *ino
- * at least one exec bit set.
- */
- if (!(mask & MAY_EXEC) || (inode->i_mode & S_IXUGO))
-- if (inode_capable(inode, CAP_DAC_OVERRIDE))
-+ if (capable_wrt_inode_uidgid(inode, CAP_DAC_OVERRIDE))
- return 0;
-
- /*
-@@ -353,7 +354,7 @@ int generic_permission(struct inode *ino
- */
- mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
- if (mask == MAY_READ)
-- if (inode_capable(inode, CAP_DAC_READ_SEARCH))
-+ if (capable_wrt_inode_uidgid(inode, CAP_DAC_READ_SEARCH))
- return 0;
-
- return -EACCES;
-@@ -2370,7 +2371,7 @@ static inline int check_sticky(struct in
- return 0;
- if (uid_eq(dir->i_uid, fsuid))
- return 0;
-- return !inode_capable(inode, CAP_FOWNER);
-+ return !capable_wrt_inode_uidgid(inode, CAP_FOWNER);
- }
-
- /*
---- a/fs/xfs/xfs_ioctl.c 2014-06-11 19:57:03.309668028 -0400
-+++ b/fs/xfs/xfs_ioctl.c 2014-06-11 20:11:15.719661287 -0400
-@@ -1241,7 +1241,7 @@ xfs_ioctl_setattr(
- * cleared upon successful return from chown()
- */
- if ((ip->i_d.di_mode & (S_ISUID|S_ISGID)) &&
-- !inode_capable(VFS_I(ip), CAP_FSETID))
-+ !capable_wrt_inode_uidgid(VFS_I(ip), CAP_FSETID))
- ip->i_d.di_mode &= ~(S_ISUID|S_ISGID);
-
- /*
---- a/include/linux/capability.h 2014-06-11 19:57:21.319667886 -0400
-+++ b/include/linux/capability.h 2014-06-11 20:11:52.129660999 -0400
-@@ -210,7 +210,7 @@ extern bool has_ns_capability_noaudit(st
- struct user_namespace *ns, int cap);
- extern bool capable(int cap);
- extern bool ns_capable(struct user_namespace *ns, int cap);
--extern bool inode_capable(const struct inode *inode, int cap);
-+extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap);
- extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap);
-
- /* audit system wants to get cap info from files as well */
---- a/kernel/capability.c 2014-06-11 20:00:58.389666169 -0400
-+++ b/kernel/capability.c 2014-06-11 20:13:46.629660094 -0400
-@@ -433,23 +433,19 @@ bool capable(int cap)
- EXPORT_SYMBOL(capable);
-
- /**
-- * inode_capable - Check superior capability over inode
-+ * capable_wrt_inode_uidgid - Check nsown_capable and uid and gid mapped
- * @inode: The inode in question
- * @cap: The capability in question
- *
-- * Return true if the current task has the given superior capability
-- * targeted at it's own user namespace and that the given inode is owned
-- * by the current user namespace or a child namespace.
-- *
-- * Currently we check to see if an inode is owned by the current
-- * user namespace by seeing if the inode's owner maps into the
-- * current user namespace.
-- *
-+ * Return true if the current task has the given capability targeted at
-+ * its own user namespace and that the given inode's uid and gid are
-+ * mapped into the current user namespace
- */
--bool inode_capable(const struct inode *inode, int cap)
-+bool capable_wrt_inode_uidgid(const struct inode *inode, int cap)
- {
- struct user_namespace *ns = current_user_ns();
-
-- return ns_capable(ns, cap) && kuid_has_mapping(ns, inode->i_uid);
-+ return ns_capable(ns, cap) && kuid_has_mapping(ns, inode->i_uid) &&
-+ kgid_has_mapping(ns, inode->i_gid);
- }
--EXPORT_SYMBOL(inode_capable);
-+EXPORT_SYMBOL(capable_wrt_inode_uidgid);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-06-18 15:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-18 15:46 [gentoo-commits] linux-patches r2842 - genpatches-2.6/trunk/3.14 Mike Pagano (mpagano)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox