LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Jiri Slaby <jslaby@suse.cz>,
	John Paul Perry <john_paul.perry@alcatel-lucent.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 3.14 65/96] tty: fix up atime/mtime mess, take four
Date: Mon, 16 Mar 2015 15:09:36 +0100	[thread overview]
Message-ID: <20150316140858.137867311@linuxfoundation.org> (raw)
In-Reply-To: <20150316140855.186617380@linuxfoundation.org>

3.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jiri Slaby <jslaby@suse.cz>

commit f0bf0bd07943bfde8f5ac39a32664810a379c7d3 upstream.

This problem was taken care of three times already in
* b0de59b5733d18b0d1974a060860a8b5c1b36a2e (TTY: do not update
  atime/mtime on read/write),
* 37b7f3c76595e23257f61bd80b223de8658617ee (TTY: fix atime/mtime
  regression), and
* b0b885657b6c8ef63a46bc9299b2a7715d19acde (tty: fix up atime/mtime
  mess, take three)

But it still misses one point. As John Paul correctly points out, we
do not care about setting date. If somebody ever changes wall
time backwards (by mistake for example), tty timestamps are never
updated until the original wall time passes.

So check the absolute difference of times and if it large than "8
seconds or so", always update the time. That means we will update
immediatelly when changing time. Ergo, CAP_SYS_TIME can foul the
check, but it was always that way.

Thanks John for serving me this so nicely debugged.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-by: John Paul Perry <john_paul.perry@alcatel-lucent.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/tty/tty_io.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -996,8 +996,8 @@ EXPORT_SYMBOL(start_tty);
 /* We limit tty time update visibility to every 8 seconds or so. */
 static void tty_update_time(struct timespec *time)
 {
-	unsigned long sec = get_seconds() & ~7;
-	if ((long)(sec - time->tv_sec) > 0)
+	unsigned long sec = get_seconds();
+	if (abs(sec - time->tv_sec) & ~7)
 		time->tv_sec = sec;
 }
 



  parent reply	other threads:[~2015-03-16 14:23 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16 14:08 [PATCH 3.14 00/96] 3.14.36-stable review Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 01/96] pktgen: fix UDP checksum computation Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 02/96] rtnetlink: ifla_vf_policy: fix misuses of NLA_BINARY Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 03/96] ipv6: fix ipv6_cow_metrics for non DST_HOST case Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 04/96] rtnetlink: call ->dellink on failure when ->newlink exists Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 06/96] ipv4: ip_check_defrag should correctly check return value of skb_copy_bits Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 07/96] ipv4: ip_check_defrag should not assume that skb_network_offset is zero Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 08/96] net: phy: Fix verification of EEE support in phy_init_eee Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 10/96] net: reject creation of netdev names with colons Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 11/96] team: fix possible null pointer dereference in team_handle_frame Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 12/96] net: compat: Ignore MSG_CMSG_COMPAT in compat_sys_{send, recv}msg Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 13/96] macvtap: make sure neighbour code can push ethernet header Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 14/96] usb: plusb: Add support for National Instruments host-to-host cable Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 15/96] udp: only allow UFO for packets from SOCK_DGRAM sockets Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 16/96] net: ping: Return EAFNOSUPPORT when appropriate Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 17/96] team: dont traverse port list using rcu in team_set_mac_address Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 18/96] mm/hugetlb: add migration/hwpoisoned entry check in hugetlb_change_protection Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 19/96] mm/hugetlb: add migration entry check in __unmap_hugepage_range Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 20/96] mm: when stealing freepages, also take pages created by splitting buddy page Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 21/96] mm/mmap.c: fix arithmetic overflow in __vm_enough_memory() Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 22/96] mm/nommu.c: " Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 23/96] mm/compaction: fix wrong order check in compact_finished() Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 24/96] mm/memory.c: actually remap enough memory Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 27/96] drm/radeon: fix voltage setup on hawaii Greg Kroah-Hartman
2015-03-16 14:08 ` [PATCH 3.14 28/96] target: Fix PR_APTPL_BUF_LEN buffer size limitation Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 29/96] target: Add missing WRITE_SAME end-of-device sanity check Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 30/96] target: Check for LBA + sectors wrap-around in sbc_parse_cdb Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 31/96] x86/asm/entry/64: Remove a bogus ret_from_fork optimization Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 32/96] iio: mxs-lradc: fix iio channel map regression Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 33/96] iio: imu: adis16400: Fix sign extension Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 39/96] iio:adc:mcp3422 Fix incorrect scales table Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 40/96] mei: make device disabled on stop unconditionally Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 41/96] btrfs: fix lost return value due to variable shadowing Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 42/96] Btrfs: fix data loss in the fast fsync path Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 43/96] Btrfs:__add_inode_ref: out of bounds memory read when looking for extended ref Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 44/96] KVM: emulate: fix CMPXCHG8B on 32-bit hosts Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 45/96] KVM: MIPS: Fix trace event to save PC directly Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 46/96] USB: serial: cp210x: Adding Seletek device ids Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 47/96] USB: mxuport: fix null deref when used as a console Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 48/96] USB: usbfs: dont leak kernel data in siginfo Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 49/96] USB: ftdi_sio: add PIDs for Actisense USB devices Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 50/96] usb: ftdi_sio: Add jtag quirk support for Cyber Cortex AV boards Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 51/96] usb: dwc3: dwc3-omap: Fix disable IRQ Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 52/96] xhci: Allocate correct amount of scratchpad buffers Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 53/96] xhci: fix reporting of 0-sized URBs in control endpoint Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 54/96] mac80211: Send EAPOL frames at lowest rate Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 55/96] net: irda: fix wait_until_sent poll timeout Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 56/96] USB: serial: fix infinite wait_until_sent timeout Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 57/96] TTY: fix tty_wait_until_sent on 64-bit machines Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 58/96] USB: serial: fix potential use-after-free after failed probe Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 59/96] USB: serial: fix tty-device error handling at probe Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 60/96] autofs4 copy_dev_ioctl(): keep the value of ->size wed used for allocation Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 61/96] debugfs: leave freeing a symlink body until inode eviction Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 62/96] procfs: fix race between symlink removals and traversals Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 63/96] sunrpc: fix braino in ->poll() Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 64/96] ARC: Fix KSTK_ESP() Greg Kroah-Hartman
2015-03-16 14:09 ` Greg Kroah-Hartman [this message]
2015-03-16 14:09 ` [PATCH 3.14 66/96] ALSA: pcm: Dont leave PREPARED state after draining Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 67/96] ALSA: hda - Add pin configs for ASUS mobo with IDT 92HD73XX codec Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 68/96] ALSA: hda - Disable runtime PM for Panther Point again Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 69/96] sg: fix read() error reporting Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 70/96] IB/qib: Do not write EEPROM Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 71/96] IB/mlx4: Fix wrong usage of IPv4 protocol for multicast attach/detach Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 72/96] IB/core: Fix deadlock on uverbs modify_qp error flow Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 73/96] IB/core: When marshaling ucma path from user-space, clear unused fields Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 74/96] nilfs2: fix potential memory overrun on inode Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 75/96] fixed invalid assignment of 64bit mask to host dma_boundary for scatter gather segment boundary limit Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 76/96] clk: zynq: Force CPU_2X clock to be ungated Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 77/96] sunxi: clk: Set sun6i-pll1 n_start = 1 Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 78/96] clk: sunxi: Support factor clocks with N factor starting not from 0 Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 79/96] staging: comedi: comedi_compat32.c: fix COMEDI_CMD copy back Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 80/96] dm mirror: do not degrade the mirror on discard error Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 81/96] dm io: reject unsupported DISCARD requests with EOPNOTSUPP Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 82/96] dm: fix a race condition in dm_get_md Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 83/96] dm snapshot: fix a possible invalid memory access on unload Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 84/96] staging: comedi: cb_pcidas64: fix incorrect AI range code handling Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 85/96] HID: input: fix confusion on conflicting mappings Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 86/96] HID: fixup the conflicting keyboard mappings quirk Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 87/96] HID: wacom: Report ABS_MISC event for Cintiq Companion Hybrid Greg Kroah-Hartman
2015-03-16 14:09 ` [PATCH 3.14 88/96] drm/radeon: use drm_mode_vrefresh() rather than mode->vrefresh Greg Kroah-Hartman
2015-03-16 14:10 ` [PATCH 3.14 89/96] drm/radeon: fix 1 RB harvest config setup for TN/RL Greg Kroah-Hartman
2015-03-16 14:10 ` [PATCH 3.14 90/96] efi: Small leak on error in runtime map code Greg Kroah-Hartman
2015-03-16 14:10 ` [PATCH 3.14 91/96] ACPI / video: Load the module even if ACPI is disabled Greg Kroah-Hartman
2015-03-16 14:10 ` [PATCH 3.14 92/96] NFSv4: Dont call put_rpccred() under the rcu_read_lock() Greg Kroah-Hartman
2015-03-16 14:10 ` [PATCH 3.14 93/96] ASoC: omap-pcm: Correct dma mask Greg Kroah-Hartman
2015-03-16 14:10 ` [PATCH 3.14 94/96] ath5k: fix spontaneus AR5312 freezes Greg Kroah-Hartman
2015-03-16 14:10 ` [PATCH 3.14 95/96] ath6kl: fix struct hif_scatter_req list handling Greg Kroah-Hartman
2015-03-16 14:10 ` [PATCH 3.14 96/96] clk-gate: fix bit # check in clk_register_gate() Greg Kroah-Hartman
2015-03-16 19:58 ` [PATCH 3.14 00/96] 3.14.36-stable review Guenter Roeck
     [not found] ` <20150316140856.907657028@linuxfoundation.org>
2015-03-18 23:36   ` [PATCH 3.14 37/96] iio: mxs-lradc: only update the buffer when its conversions have finished Kristina Martšenko
2015-03-19 13:15     ` Greg Kroah-Hartman

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=20150316140858.137867311@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=john_paul.perry@alcatel-lucent.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --subject='Re: [PATCH 3.14 65/96] tty: fix up atime/mtime mess, take four' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).