~ubuntu-branches/ubuntu/trusty/linux-ppc/trusty

« back to all changes in this revision

Viewing changes to fs/namespace.c

  • Committer: Package Import Robot
  • Author(s): Ben Collins, Ubuntu: 3.8.0-17.27
  • Date: 2013-04-08 18:16:48 UTC
  • mfrom: (16.1.9 raring)
  • Revision ID: package-import@ubuntu.com-20130408181648-z7suubhgtq6k6zke
Tags: 3.8.0-8.14
[ Ubuntu: 3.8.0-17.27 ]

* SAUCE: (no-up) Bluetooth: Add support for 04ca:2007
  - LP: #1153448
* SAUCE: (no-up) Bluetooth: Add support for 105b:e065
  - LP: #1161261
* SAUCE: (no-up) tools/power turbostat: additional Haswell CPU-id
  - LP: #1083993
* Revert "SAUCE: (no-up) seccomp: forcing auditing of kill condition"
  Replaced by upstream patch.
* Release Tracking Bug
  - LP: #1165746
* rebase to v3.8.6
* Revert "brcmsmac: support 4313iPA"
  - LP: #1157190
* tools/power turbostat: support Haswell
  - LP: #1083993
* net: calxedaxgmac: fix rx ring handling when OOM
* cpufreq: check OF node /cpus presence before dereferencing it
* Input: cypress_ps2 - fix trackpadi found in Dell XPS12
  - LP: #1103594
* ARM: OMAP2+: Limit omap initcalls to omap only on multiplatform kernels
* ARM: OMAP2+: Use omap initcalls
* ARM: OMAP: Fix i2c cmdline initcall for multiplatform
* ARM: OMAP: Fix dmaengine init for multiplatform
* ARM: OMAP2+: Add multiplatform debug_ll support
* ARM: OMAP2+: Disable code that currently does not work with
  multiplaform
* ARM: OMAP2+: Enable ARCH_MULTIPLATFORM support
* ARM: OMAP2+: Add minimal support for booting vexpress
* ARM: OMAP2+: Remove now obsolete uncompress.h and debug-macro.S
* davinci: do not include mach/hardware.h
* clk: export __clk_get_name for re-use in imx-ipu-v3 and others
* [SCSI] storvsc: avoid usage of WRITE_SAME
  - LP: #1157952
* ACPICA: Fix possible memory leak in dispatcher error path.
* KVM: x86: fix for buffer overflow in handling of MSR_KVM_SYSTEM_TIME (CVE-2013-1796)
  - LP: #1158254
  - CVE-2013-1796
* SAUCE: (no-up) Bluetooth: Add a load_firmware callback to struct hci_dev
  - LP: #1065400
* SAUCE: (no-up) Bluetooth: Implement broadcom patchram firmware loader
  - LP: #1065400
* SAUCE: (no-up) Bluetooth: Add support for 13d3:3388 and 13d3:3389
  - LP: #1065400

Show diffs side-by-side

added added

removed removed

Lines of Context:
799
799
        }
800
800
 
801
801
        mnt->mnt.mnt_flags = old->mnt.mnt_flags & ~MNT_WRITE_HOLD;
 
802
        /* Don't allow unprivileged users to change mount flags */
 
803
        if ((flag & CL_UNPRIVILEGED) && (mnt->mnt.mnt_flags & MNT_READONLY))
 
804
                mnt->mnt.mnt_flags |= MNT_LOCK_READONLY;
 
805
 
802
806
        atomic_inc(&sb->s_active);
803
807
        mnt->mnt.mnt_sb = sb;
804
808
        mnt->mnt.mnt_root = dget(root);
1756
1760
        if (readonly_request == __mnt_is_readonly(mnt))
1757
1761
                return 0;
1758
1762
 
 
1763
        if (mnt->mnt_flags & MNT_LOCK_READONLY)
 
1764
                return -EPERM;
 
1765
 
1759
1766
        if (readonly_request)
1760
1767
                error = mnt_make_readonly(real_mount(mnt));
1761
1768
        else
2385
2392
        /* First pass: copy the tree topology */
2386
2393
        copy_flags = CL_COPY_ALL | CL_EXPIRE;
2387
2394
        if (user_ns != mnt_ns->user_ns)
2388
 
                copy_flags |= CL_SHARED_TO_SLAVE;
 
2395
                copy_flags |= CL_SHARED_TO_SLAVE | CL_UNPRIVILEGED;
2389
2396
        new = copy_tree(old, old->mnt.mnt_root, copy_flags);
2390
2397
        if (IS_ERR(new)) {
2391
2398
                up_write(&namespace_sem);
2778
2785
        return check_mnt(real_mount(mnt));
2779
2786
}
2780
2787
 
 
2788
bool current_chrooted(void)
 
2789
{
 
2790
        /* Does the current process have a non-standard root */
 
2791
        struct path ns_root;
 
2792
        struct path fs_root;
 
2793
        bool chrooted;
 
2794
 
 
2795
        /* Find the namespace root */
 
2796
        ns_root.mnt = &current->nsproxy->mnt_ns->root->mnt;
 
2797
        ns_root.dentry = ns_root.mnt->mnt_root;
 
2798
        path_get(&ns_root);
 
2799
        while (d_mountpoint(ns_root.dentry) && follow_down_one(&ns_root))
 
2800
                ;
 
2801
 
 
2802
        get_fs_root(current->fs, &fs_root);
 
2803
 
 
2804
        chrooted = !path_equal(&fs_root, &ns_root);
 
2805
 
 
2806
        path_put(&fs_root);
 
2807
        path_put(&ns_root);
 
2808
 
 
2809
        return chrooted;
 
2810
}
 
2811
 
 
2812
void update_mnt_policy(struct user_namespace *userns)
 
2813
{
 
2814
        struct mnt_namespace *ns = current->nsproxy->mnt_ns;
 
2815
        struct mount *mnt;
 
2816
 
 
2817
        down_read(&namespace_sem);
 
2818
        list_for_each_entry(mnt, &ns->list, mnt_list) {
 
2819
                switch (mnt->mnt.mnt_sb->s_magic) {
 
2820
                case SYSFS_MAGIC:
 
2821
                        userns->may_mount_sysfs = true;
 
2822
                        break;
 
2823
                case PROC_SUPER_MAGIC:
 
2824
                        userns->may_mount_proc = true;
 
2825
                        break;
 
2826
                }
 
2827
                if (userns->may_mount_sysfs && userns->may_mount_proc)
 
2828
                        break;
 
2829
        }
 
2830
        up_read(&namespace_sem);
 
2831
}
 
2832
 
2781
2833
static void *mntns_get(struct task_struct *task)
2782
2834
{
2783
2835
        struct mnt_namespace *ns = NULL;