From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755638AbcJUN4S (ORCPT ); Fri, 21 Oct 2016 09:56:18 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:48911 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755505AbcJUN4Q (ORCPT ); Fri, 21 Oct 2016 09:56:16 -0400 Date: Fri, 21 Oct 2016 14:56:13 +0100 From: Ben Hutchings To: linux-kernel@vger.kernel.org, Andrew Morton , torvalds@linux-foundation.org, Jiri Slaby , stable@vger.kernel.org Cc: lwn@lwn.net Message-ID: <20161021135613.GB2697@decadent.org.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="VMt1DrMGOVs3KQwf" Content-Disposition: inline X-Mailer: LinuxStableQueue (scripts by bwh) User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: ben@decadent.org.uk Subject: Linux 3.16.38 X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on shadbolt.decadent.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --VMt1DrMGOVs3KQwf Content-Type: multipart/mixed; boundary="WplhKdTI2c8ulnbP" Content-Disposition: inline --WplhKdTI2c8ulnbP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I'm announcing the release of the 3.16.38 kernel. All users of the 3.16 kernel series should upgrade. The updated 3.16.y git tree can be found at: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-3.16.y and can be browsed at the normal kernel.org git web browser: https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git The diff from 3.16.37 is attached to this message. Ben. ------------ Makefile | 2 +- include/linux/mm.h | 1 + mm/gup.c | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) Ben Hutchings (1): Linux 3.16.38 Linus Torvalds (1): mm: remove gup_flags FOLL_WRITE games from __get_user_pages() --WplhKdTI2c8ulnbP Content-Type: text/x-diff; charset=UTF-8; name="linux-3.16.38.patch" Content-Disposition: attachment; filename="linux-3.16.38.patch" Content-Transfer-Encoding: quoted-printable diff --git a/Makefile b/Makefile index e49d13717d31..37083fbc8784 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION =3D 3 PATCHLEVEL =3D 16 -SUBLEVEL =3D 37 +SUBLEVEL =3D 38 EXTRAVERSION =3D NAME =3D Museum of Fishiegoodies =20 diff --git a/include/linux/mm.h b/include/linux/mm.h index 7ac72a725798..e648c24e8410 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2007,6 +2007,7 @@ static inline struct page *follow_page(struct vm_area= _struct *vma, #define FOLL_HWPOISON 0x100 /* check page is hwpoisoned */ #define FOLL_NUMA 0x200 /* force NUMA hinting page fault */ #define FOLL_MIGRATION 0x400 /* wait for page to replace migration entry */ +#define FOLL_COW 0x4000 /* internal GUP flag */ =20 typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, void *data); diff --git a/mm/gup.c b/mm/gup.c index 9cb1cfbe4677..2e4b9873b5aa 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -28,6 +28,16 @@ static struct page *no_page_table(struct vm_area_struct = *vma, return NULL; } =20 +/* + * FOLL_FORCE can write to even unwritable pte's, but only + * after we've gone through a COW cycle and they are dirty. + */ +static inline bool can_follow_write_pte(pte_t pte, unsigned int flags) +{ + return pte_write(pte) || + ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte)); +} + static struct page *follow_page_pte(struct vm_area_struct *vma, unsigned long address, pmd_t *pmd, unsigned int flags) { @@ -62,7 +72,7 @@ retry: } if ((flags & FOLL_NUMA) && pte_numa(pte)) goto no_page; - if ((flags & FOLL_WRITE) && !pte_write(pte)) { + if ((flags & FOLL_WRITE) && !can_follow_write_pte(pte, flags)) { pte_unmap_unlock(ptep, ptl); return NULL; } @@ -302,7 +312,7 @@ static int faultin_page(struct task_struct *tsk, struct= vm_area_struct *vma, * reCOWed by userspace write). */ if ((ret & VM_FAULT_WRITE) && !(vma->vm_flags & VM_WRITE)) - *flags &=3D ~FOLL_WRITE; + *flags |=3D FOLL_COW; return 0; } =20 --WplhKdTI2c8ulnbP-- --VMt1DrMGOVs3KQwf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUBWAoefee/yOyVhhEJAQpeARAAhKjbVtKn4wYcJdsRQomhVte0J/q30tbc 5pvz5el1e0PkFx45Ka9a+92cbHHAr6QUd2D6tjBG74qa5nDuJVF31ViJgUIe8FVk kfZ1x7PCYVZ9mmdJl4Gaqrln9qJiZNRBc7/smUQhjmHqB9IeN7Hr2VCSuIjOxlrU rrWuhG9LeSXHbBFqL2tbl+6UJokj9RnNZgiDSoeew6NFh5yj4H2BHYXmZNOCmfoc CL7V9LTMNCtGdj223AkPHLW3Xy3LPqhrriYQ0FinCE28tczNkzCp6npsV4BYjvtS rNE4v7Hc5kX/ngp2dsdAhHPaWZv0nUd5bl/iMqAatyYgrcnY5l9Xpt0a8HNQo9c+ xUkwsbr84J0hkiB3f5CL1GZWFoeAzv2XSsHJwwYUKp65ZRR24ULkwX3wXragHZqM 9lay1dhYnn+uR8dgTm3mcPYXPVBMTl3bse/CN/aBAjpdU9LXhLXU7npkoQNiSXo7 0Q7A64PrlNSOnS+XMucw5MHsof7Z+oFFvZHBtFlbGEFEcScgejmuIQaufGmqj7E8 brrlFoam/YrHTCJKu4yclVBpq4H2UWGZDzSXfAeseXTXME8flEX0O7U65tY0JZvZ XtnepRxt0VL8H8vvqY+j1Ga/6z0lLchQvsJZTv5Xg7SCUGvKxBkXtipuRZ7LdpKD Zcg9AmkZnSU= =s/oD -----END PGP SIGNATURE----- --VMt1DrMGOVs3KQwf--