mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: akpm@linux-foundation.org,
	"Martin Schwidefsky" <schwidefsky@de.ibm.com>,
	"Gerald Schaefer" <gerald.schaefer@de.ibm.com>
Subject: [PATCH 3.2 11/94] s390/mm: fix write access check in gup_huge_pmd()
Date: Thu, 28 Dec 2017 16:59:12 +0000	[thread overview]
Message-ID: <lsq.1514480352.431042096@decadent.org.uk> (raw)
In-Reply-To: <lsq.1514480348.981935392@decadent.org.uk>

3.2.97-rc1 review patch.  If anyone has any objections, please let me know.

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

From: Gerald Schaefer <gerald.schaefer@de.ibm.com>

commit ba385c0594e723d41790ecfb12c610e6f90c7785 upstream.

The check for the _SEGMENT_ENTRY_PROTECT bit in gup_huge_pmd() is the
wrong way around. It must not be set for write==1, and not be checked for
write==0. Fix this similar to how it was fixed for ptes long time ago in
commit 25591b070336 ("[S390] fix get_user_pages_fast").

One impact of this bug would be unnecessarily using the gup slow path for
write==0 on r/w mappings. A potentially more severe impact would be that
gup_huge_pmd() will succeed for write==1 on r/o mappings.

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
[bwh: Backported to 3.2:
 - Segment flag names are different
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 arch/s390/mm/gup.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--- a/arch/s390/mm/gup.c
+++ b/arch/s390/mm/gup.c
@@ -51,13 +51,12 @@ static inline int gup_pte_range(pmd_t *p
 static inline int gup_huge_pmd(pmd_t *pmdp, pmd_t pmd, unsigned long addr,
 		unsigned long end, int write, struct page **pages, int *nr)
 {
-	unsigned long mask, result;
 	struct page *head, *page, *tail;
+	unsigned long mask;
 	int refs;
 
-	result = write ? 0 : _SEGMENT_ENTRY_RO;
-	mask = result | _SEGMENT_ENTRY_INV;
-	if ((pmd_val(pmd) & mask) != result)
+	mask = (write ? _SEGMENT_ENTRY_RO : 0) | _SEGMENT_ENTRY_INV;
+	if ((pmd_val(pmd) & mask) != 0)
 		return 0;
 	VM_BUG_ON(!pfn_valid(pmd_val(pmd) >> PAGE_SHIFT));
 

  parent reply	other threads:[~2017-12-28 18:32 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-28 16:59 [PATCH 3.2 00/94] 3.2.97-rc1 review Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 82/94] MIPS: AR7: Ensure that serial ports are properly set up Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 22/94] KEYS: fix key refcount leak in keyctl_read_key() Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 74/94] l2tp: hold tunnel socket when handling control frames in l2tp_ip and l2tp_ip6 Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 50/94] scsi: libiscsi: fix shifting of DID_REQUEUE host byte Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 10/94] usb: pci-quirks.c: Corrected timeout values used in handshake Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 61/94] can: esd_usb2: Fix can_dlc value for received RTR, frames Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 30/94] packet: only test po->has_vnet_hdr once in packet_snd Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 35/94] l2tp: fix l2tp_eth module loading Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 52/94] KEYS: encrypted: fix dereference of NULL user_key_payload Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 59/94] usb: cdc_acm: Add quirk for Elatec TWN3 Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 42/94] lsm: fix smack_inode_removexattr and xattr_getsecurity memleak Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 87/94] USB: core: prevent malicious bNumInterfaces overflow Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 36/94] ALSA: usx2y: Suppress kernel warning at page allocation failures Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 76/94] ALSA: timer: Protect the whole snd_timer_close() with open race Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 54/94] ecryptfs: fix dereference of NULL user_key_payload Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 23/94] KEYS: prevent creating a different user's keyrings Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 75/94] l2tp: don't use l2tp_tunnel_find() in l2tp_ip and l2tp_ip6 Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 45/94] crypto: shash - Fix zero-length shash ahash digest crash Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 21/94] KEYS: fix key refcount leak in keyctl_assume_authority() Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 55/94] iommu/amd: Finish TLB flush in amd_iommu_unmap() Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 05/94] USB: serial: option: add support for TP-Link LTE module Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 65/94] ALSA: timer: Add missing mutex lock for compat ioctls Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 02/94] spi: uapi: spidev: add missing ioctl header Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 57/94] net: enable interface alias removal via rtnl Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 24/94] vfs: Return -ENXIO for negative SEEK_HOLE / SEEK_DATA offsets Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 71/94] KEYS: trusted: fix writing past end of buffer in trusted_read() Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 25/94] USB: dummy-hcd: fix infinite-loop resubmission bug Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 64/94] l2tp: hold tunnel in pppol2tp_connect() Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 94/94] KEYS: add missing permission check for request_key() destination Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 09/94] xhci: fix finding correct bus_state structure for USB 3.1 hosts Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 89/94] security: Fix mode test in selinux_ptrace_access_check() Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 33/94] kvm/x86: Handle async PF in RCU read-side critical sections Ben Hutchings
2017-12-28 16:59 ` Ben Hutchings [this message]
2017-12-28 16:59 ` [PATCH 3.2 18/94] USB: gadgetfs: Fix crash caused by inadequate synchronization Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 68/94] tun/tap: sanitize TUNSETSNDBUF input Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 86/94] Bluetooth: bnep: bnep_add_connection() should verify that it's dealing with l2cap socket Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 06/94] uwb: ensure that endpoint is interrupt Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 79/94] ALSA: seq: Avoid invalid lockdep class warning Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 53/94] FS-Cache: fix dereference of NULL user_key_payload Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 48/94] usb: renesas_usbhs: Fix DMAC sequence for receiving zero-length packet Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 58/94] scsi: zfcp: fix erp_action use-before-initialize in REC action trace Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 08/94] usb: Increase quirk delay for USB devices Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 67/94] macvtap: fix TUNSETSNDBUF values > 64k Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 88/94] KVM: VMX: remove I/O port 0x80 bypass on Intel hosts Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 72/94] ocfs2: fstrim: Fix start offset of first cluster group during fstrim Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 91/94] KVM: Fix stack-out-of-bounds read in write_mmio Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 41/94] Smack: remove unneeded NULL-termination from securtity label Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 37/94] scsi: sd: Implement blacklist option for WRITE SAME w/ UNMAP Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 26/94] USB: gadgetfs, dummy-hcd, net2280: fix locking for callbacks Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 27/94] USB: dummy-hcd: Fix erroneous synchronization change Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 78/94] ARM: 8720/1: ensure dump_instr() checks addr_limit Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 31/94] sched/sysctl: Check user input value of sysctl_sched_time_avg Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 14/94] Input: uinput - avoid FF flush when destroying device Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 77/94] ALSA: timer: Limit max instances per timer Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 15/94] usb-storage: unusual_devs entry to fix write-access regression for Seagate external drives Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 17/94] USB: gadgetfs: fix copy_to_user while holding spinlock Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 92/94] crypto: salsa20 - fix blkcipher_walk API usage Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 38/94] kernel/params.c: align add_sysfs_param documentation with code Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 04/94] USB: serial: ftdi_sio: add id for Cypress WICED dev board Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 62/94] ipsec: Fix aborted xfrm policy dump crash Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 07/94] uwb: properly check kthread_run return value Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 60/94] usb: quirks: add quirk for WORLDE MINI MIDI keyboard Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 44/94] ALSA: seq: Fix copy_from_user() call inside lock Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 80/94] ALSA: seq: Fix OSS sysex delivery in OSS emulation Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 66/94] ALSA: seq: Fix nested rwsem annotation for lockdep splat Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 01/94] tile: array underflow in setup_maxnodemem() Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 13/94] crypto: talitos - fix sha224 Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 49/94] ALSA: caiaq: Fix stray URB at probe error path Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 63/94] sctp: fix a type cast warnings that causes a_rwnd gets the wrong value Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 12/94] USB: serial: cp210x: add support for ELV TFD500 Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 29/94] usb: renesas_usbhs: fix usbhsf_fifo_clear() for RX direction Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 47/94] USB: dummy-hcd: Fix deadlock caused by disconnect detection Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 83/94] dccp: CVE-2017-8824: use-after-free in DCCP code Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 39/94] sh: sh7722: remove nonexistent GPIO_PTQ7 to fix pinctrl registration Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 90/94] ptrace: change __ptrace_unlink() to clear ->ptrace under ->siglock Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 69/94] tcp: fix tcp_mtu_probe() vs highest_sack Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 16/94] usb: gadget: fix spinlock dead lock in gadgetfs Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 43/94] kvm/x86: Avoid async PF preempting the kernel incorrectly Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 28/94] usb: renesas_usbhs: fix the BCLR setting condition for non-DCP pipe Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 03/94] scsi: lpfc: Don't return internal MBXERR_ERROR code from probe function Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 70/94] KEYS: trusted: sanitize all key material Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 19/94] KEYS: fix cred refcount leak in request_key_auth_new() Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 73/94] l2tp: hold socket before dropping lock in l2tp_ip{, 6}_recv() Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 20/94] KEYS: don't revoke uninstantiated key in request_key_auth_new() Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 84/94] Bluetooth: hidp: verify l2cap sockets Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 40/94] sh: sh7757: remove nonexistent GPIO_PT[JLNQ]7_RESV to fix pinctrl registration Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 34/94] staging: iio: ade7759: fix signed extension bug on shift of a u8 Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 46/94] more bio_map_user_iov() leak fixes Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 51/94] KVM: nVMX: fix guest CR4 loading when emulating L2 to L1 exit Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 56/94] l2tp: check ps->sock before running pppol2tp_session_ioctl() Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 81/94] x86/oprofile/ppro: Do not use __this_cpu*() in preemptible context Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 32/94] KVM: Do not take reference to mm during async #PF Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 93/94] crypto: hmac - require that the underlying hash algorithm is unkeyed Ben Hutchings
2017-12-28 16:59 ` [PATCH 3.2 85/94] Bluetooth: cmtp: cmtp_add_connection() should verify that it's dealing with l2cap socket Ben Hutchings
2017-12-28 19:26 ` [PATCH 3.2 00/94] 3.2.97-rc1 review Guenter Roeck

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=lsq.1514480352.431042096@decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=gerald.schaefer@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --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®