mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luis Henriques <luis.henriques@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel-team@lists.ubuntu.com
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Luis Henriques <luis.henriques@canonical.com>
Subject: [PATCH 3.11 139/141] mnt: Move the test for MNT_LOCK_READONLY from change_mount_flags into do_remount
Date: Wed, 20 Aug 2014 17:56:30 +0100	[thread overview]
Message-ID: <1408553792-25134-2-git-send-email-luis.henriques@canonical.com> (raw)
In-Reply-To: <1408354398-10226-1-git-send-email-luis.henriques@canonical.com>

From: "Eric W. Biederman" <ebiederm@xmission.com>

commit 07b645589dcda8b7a5249e096fece2a67556f0f4 upstream.

There are no races as locked mount flags are guaranteed to never change.

Moving the test into do_remount makes it more visible, and ensures all
filesystem remounts pass the MNT_LOCK_READONLY permission check.  This
second case is not an issue today as filesystem remounts are guarded
by capable(CAP_DAC_ADMIN) and thus will always fail in less privileged
mount namespaces, but it could become an issue in the future.

Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 fs/namespace.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index c98baa23e4d8..343158cb021c 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1764,9 +1764,6 @@ static int change_mount_flags(struct vfsmount *mnt, int ms_flags)
 	if (readonly_request == __mnt_is_readonly(mnt))
 		return 0;
 
-	if (mnt->mnt_flags & MNT_LOCK_READONLY)
-		return -EPERM;
-
 	if (readonly_request)
 		error = mnt_make_readonly(real_mount(mnt));
 	else
@@ -1792,6 +1789,16 @@ static int do_remount(struct path *path, int flags, int mnt_flags,
 	if (path->dentry != path->mnt->mnt_root)
 		return -EINVAL;
 
+	/* Don't allow changing of locked mnt flags.
+	 *
+	 * No locks need to be held here while testing the various
+	 * MNT_LOCK flags because those flags can never be cleared
+	 * once they are set.
+	 */
+	if ((mnt->mnt.mnt_flags & MNT_LOCK_READONLY) &&
+	    !(mnt_flags & MNT_READONLY)) {
+		return -EPERM;
+	}
 	err = security_sb_remount(sb, data);
 	if (err)
 		return err;
-- 
1.9.1


  parent reply	other threads:[~2014-08-20 16:56 UTC|newest]

Thread overview: 146+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18  9:31 [3.11.y.z extended stable] Linux 3.11.10.15 stable review Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 001/137] Bluetooth: Ignore H5 non-link packets in non-active state Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 002/137] mwifiex: fix Tx timeout issue Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 003/137] perf/x86/intel: ignore CondChgd bit to avoid false NMI handling Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 004/137] xen/manage: fix potential deadlock when resuming the console Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 005/137] iwlwifi: dvm: don't enable CTS to self Luis Henriques
2014-08-31 12:04   ` Grumbach, Emmanuel
2014-09-01  8:46     ` Luis Henriques
2014-09-01  8:50       ` Grumbach, Emmanuel
2014-08-18  9:31 ` [PATCH 3.11 006/137] fuse: timeout comparison fix Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 007/137] fuse: ignore entry-timeout on LOOKUP_REVAL Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 008/137] fuse: handle large user and group ID Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 009/137] alarmtimer: Fix bug where relative alarm timers were treated as absolute Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 010/137] irqchip: gic: Add support for cortex a7 compatible string Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 011/137] net: mvneta: fix operation in 10 Mbit/s mode Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 012/137] igb: do a reset on SR-IOV re-init if device is down Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 013/137] hwmon: (da9052) Don't use dash in the name attribute Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 014/137] hwmon: (da9055) " Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 015/137] net/l2tp: don't fall back on UDP [get|set]sockopt Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 016/137] PM / sleep: Fix request_firmware() error at resume Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 017/137] tracing: Add ftrace_trace_stack into __trace_puts/__trace_bputs Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 018/137] tracing: Fix graph tracer with stack tracer on other archs Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 019/137] tracing: Add TRACE_ITER_PRINTK flag check in __trace_puts/__trace_bputs Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 020/137] dm thin metadata: do not allow the data block size to change Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 021/137] dm cache " Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 022/137] ring-buffer: Fix polling on trace_pipe Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 023/137] sched: Fix possible divide by zero in avg_atom() calculation Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 024/137] drm/qxl: return IRQ_NONE if it was not our irq Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 025/137] hwmon: (adt7470) Fix writes to temperature limit registers Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 026/137] drm/radeon: avoid leaking edid data Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 027/137] drm/radeon: set default bl level to something reasonable Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 028/137] usb: chipidea: udc: Disable auto ZLP generation on ep0 Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 029/137] usb: Check if port status is equal to RxDetect Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 030/137] irqchip: gic: Fix core ID calculation when topology is read from DT Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 031/137] Drivers: hv: util: Fix a bug in the KVP code Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 032/137] shmem: fix faulting into a hole while it's punched Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 033/137] shmem: fix faulting into a hole, not taking i_mutex Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 034/137] shmem: fix splicing from a hole while it's punched Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 035/137] ip_tunnel: fix ip_tunnel_lookup Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 036/137] tcp: fix tcp_match_skb_to_sack() for unaligned SACK at end of an skb Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 037/137] net: sctp: check proc_dointvec result in proc_sctp_do_auth Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 038/137] 8021q: fix a potential memory leak Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 039/137] ipv4: fix dst race in sk_dst_get() Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 040/137] ipv4: irq safe sk_dst_[re]set() and ipv4_sk_update_pmtu() fix Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 041/137] net: fix sparse warning in sk_dst_set() Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 042/137] bnx2x: fix possible panic under memory stress Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 043/137] tcp: Fix divide by zero when pushing during tcp-repair Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 044/137] ipv4: icmp: Fix pMTU handling for rare case Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 045/137] net: qmi_wwan: Add ID for Telewell TW-LTE 4G v2 Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 046/137] net: qmi_wwan: add two Sierra Wireless/Netgear devices Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 047/137] igmp: fix the problem when mc leave group Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 048/137] tcp: fix false undo corner cases Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 049/137] appletalk: Fix socket referencing in skb Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 050/137] net: mvneta: Fix big endian issue in mvneta_txq_desc_csum() Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 051/137] netlink: Fix handling of error from netlink_dump() Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 052/137] be2net: set EQ DB clear-intr bit in be_open() Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 053/137] tipc: clear 'next'-pointer of message fragments before reassembly Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 054/137] net: sctp: fix information leaks in ulpevent layer Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 055/137] net: pppoe: use correct channel MTU when using Multilink PPP Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 056/137] sunvnet: clean up objects created in vnet_new() on vnet_exit() Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 057/137] dns_resolver: assure that dns_query() result is null-terminated Luis Henriques
2014-08-18  9:31 ` [PATCH 3.11 058/137] dns_resolver: Null-terminate the right string Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 059/137] ipv4: fix buffer overflow in ip_options_compile() Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 060/137] slab_common: Do not check for duplicate slab names Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 061/137] slab_common: fix the " Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 062/137] [media] hdpvr: fix two audio bugs Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 063/137] block: don't assume last put of shared tags is for the host Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 064/137] blkcg: don't call into policy draining if root_blkg is already gone Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 065/137] block: provide compat ioctl for BLKZEROOUT Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 066/137] libata: support the ata host which implements a queue depth less than 32 Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 067/137] [media] tda10071: force modulation to QPSK on DVB-S Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 068/137] [media] gspca_pac7302: Add new usb-id for Genius i-Look 317 Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 069/137] s390/ptrace: fix PSW mask check Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 070/137] ahci: add support for the Promise FastTrak TX8660 SATA HBA (ahci mode) Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 071/137] Input: fix defuzzing logic Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 072/137] tracing: Fix wraparound problems in "uptime" trace clock Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 073/137] x86_32, entry: Store badsys error code in %eax Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 074/137] libata: introduce ata_host->n_tags to avoid oops on SAS controllers Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 075/137] drm/radeon: fix irq ring buffer overflow handling Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 076/137] coredump: fix the setting of PF_DUMPCORE Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 077/137] hwmon: (smsc47m192) Fix temperature limit and vrm write operations Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 078/137] parisc: Remove SA_RESTORER define Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 079/137] Fix gcc-4.9.0 miscompilation of load_balance() in scheduler Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 080/137] x86/efi: Include a .bss section within the PE/COFF headers Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 081/137] scsi: handle flush errors properly Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 082/137] cfg80211: fix mic_failure tracing Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 083/137] iio: buffer: Fix demux table creation Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 084/137] powerpc/perf: Fix MMCR2 handling for EBB Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 085/137] staging: vt6655: Fix Warning on boot handle_irq_event_percpu Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 086/137] staging: vt6655: Fix disassociated messages every 10 seconds Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 087/137] can: c_can_platform: Fix raminit, use devm_ioremap() instead of devm_ioremap_resource() Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 088/137] net: sendmsg: fix NULL pointer dereference Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 089/137] mm, thp: do not allow thp faults to avoid cpuset restrictions Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 090/137] rapidio/tsi721_dma: fix failure to obtain transaction descriptor Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 091/137] crypto: af_alg - properly label AF_ALG socket Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 092/137] dm cache: fix race affecting dirty block count Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 093/137] mm: kmemleak: avoid false negatives on vmalloc'ed objects Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 094/137] net: mvneta: increase the 64-bit rx/tx stats out of the hot path Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 095/137] net: mvneta: use per_cpu stats to fix an SMP lock up Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 096/137] net: mvneta: do not schedule in mvneta_tx_timeout Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 097/137] net: mvneta: add missing bit descriptions for interrupt masks and causes Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 098/137] net: mvneta: replace Tx timer with a real interrupt Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 099/137] net: sctp: inherit auth_capable on INIT collisions Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 100/137] ipv6: reallocate addrconf router for ipv6 address when lo device up Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 101/137] vfs: allow umount to handle mountpoints without revalidating them Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 102/137] Revert "mac80211: move "bufferable MMPDU" check to fix AP mode scan" Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 103/137] ARM: 8115/1: LPAE: reduce damage caused by idmap to virtual memory layout Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 104/137] printk: rename printk_sched to printk_deferred Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 105/137] timer: Fix lock inversion between hrtimer_bases.lock and scheduler locks Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 106/137] Revert "x86-64, modify_ldt: Make support for 16-bit segments a runtime option" Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 107/137] x86-64, espfix: Don't leak bits 31:16 of %esp returning to 16-bit stack Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 108/137] x86, espfix: Move espfix definitions into a separate header file Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 109/137] x86, espfix: Fix broken header guard Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 110/137] x86, espfix: Make espfix64 a Kconfig option, fix UML Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 111/137] x86, espfix: Make it possible to disable 16-bit support Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 112/137] x86_64/entry/xen: Do not invoke espfix64 on Xen Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 113/137] x86/espfix/xen: Fix allocation of pages for paravirt page tables Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 114/137] lib/btree.c: fix leak of whole btree nodes Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 115/137] fs: umount on symlink leaks mnt count Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 116/137] sparc64: Fix argument sign extension for compat_sys_futex() Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 117/137] sparc64: Make itc_sync_lock raw Luis Henriques
2014-08-18  9:32 ` [PATCH 3.11 118/137] sparc64: Handle 32-bit tasks properly in compute_effective_address() Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 119/137] sparc64: Fix top-level fault handling bugs Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 120/137] sparc64: Don't bark so loudly about 32-bit tasks generating 64-bit fault addresses Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 121/137] sparc64: Fix huge TSB mapping on pre-UltraSPARC-III cpus Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 122/137] sparc64: Add membar to Niagara2 memcpy code Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 123/137] sparc64: Do not insert non-valid PTEs into the TSB hash table Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 124/137] sparc64: Guard against flushing openfirmware mappings Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 125/137] bbc-i2c: Fix BBC I2C envctrl on SunBlade 2000 Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 126/137] sunsab: Fix detection of BREAK on sunsab serial console Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 127/137] sparc64: ldc_connect() should not return EINVAL when handshake is in progress Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 128/137] arch/sparc/math-emu/math_32.c: drop stray break operator Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 129/137] bnx2x: fix crash during TSO tunneling Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 130/137] inetpeer: get rid of ip_id_count Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 131/137] ip: make IP identifiers less predictable Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 132/137] tcp: Fix integer-overflows in TCP veno Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 133/137] tcp: Fix integer-overflow in TCP vegas Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 134/137] macvlan: Initialize vlan_features to turn on offload support Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 135/137] net: Correctly set segment mac_len in skb_segment() Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 136/137] iovec: make sure the caller actually wants anything in memcpy_fromiovecend Luis Henriques
2014-08-18  9:33 ` [PATCH 3.11 137/137] sctp: fix possible seqlock seadlock in sctp_packet_transmit() Luis Henriques
2014-08-20 16:47 ` [3.11.y.z extended stable] Linux 3.11.10.15 stable review Luis Henriques
2014-08-20 16:56 ` [PATCH 3.11 138/141] mnt: Only change user settable mount flags in remount Luis Henriques
2014-08-20 16:56 ` Luis Henriques [this message]
2014-08-20 16:56 ` [PATCH 3.11 140/141] mnt: Correct permission checks in do_remount Luis Henriques
2014-08-20 16:56 ` [PATCH 3.11 141/141] mnt: Change the default remount atime from relatime to the existing value Luis Henriques

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1408553792-25134-2-git-send-email-luis.henriques@canonical.com \
    --to=luis.henriques@canonical.com \
    --cc=ebiederm@xmission.com \
    --cc=kernel-team@lists.ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®