* [PATCH 4.7 0/2] 4.7.9-stable review
@ 2016-10-19 18:31 ` Greg Kroah-Hartman
2016-10-19 18:31 ` [PATCH 4.7 1/2] Make __xfs_xattr_put_listen preperly report errors Greg Kroah-Hartman
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2016-10-19 18:31 UTC (permalink / raw)
To: linux-kernel
Cc: Greg Kroah-Hartman, torvalds, akpm, linux, shuah.kh, patches,
ben.hutchings, stable
This is the start of the stable review cycle for the 4.7.9 release.
There are 2 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Fri Oct 21 18:28:47 UTC 2016.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.7.9-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.7.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Linux 4.7.9-rc1
Linus Torvalds <torvalds@linux-foundation.org>
mm: remove gup_flags FOLL_WRITE games from __get_user_pages()
Artem Savkov <asavkov@redhat.com>
Make __xfs_xattr_put_listen preperly report errors.
-------------
Diffstat:
Makefile | 4 ++--
fs/xfs/xfs_xattr.c | 1 +
include/linux/mm.h | 1 +
mm/gup.c | 14 ++++++++++++--
4 files changed, 16 insertions(+), 4 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4.7 1/2] Make __xfs_xattr_put_listen preperly report errors.
2016-10-19 18:31 ` [PATCH 4.7 0/2] 4.7.9-stable review Greg Kroah-Hartman
@ 2016-10-19 18:31 ` Greg Kroah-Hartman
2016-10-19 18:31 ` [PATCH 4.7 2/2] mm: remove gup_flags FOLL_WRITE games from __get_user_pages() Greg Kroah-Hartman
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2016-10-19 18:31 UTC (permalink / raw)
To: linux-kernel
Cc: Greg Kroah-Hartman, stable, Artem Savkov, Dave Chinner,
Dave Chinner, Eric Sandeen
4.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Savkov <asavkov@redhat.com>
commit 791cc43b36eb1f88166c8505900cad1b43c7fe1a upstream.
Commit 2a6fba6 "xfs: only return -errno or success from attr ->put_listent"
changes the returnvalue of __xfs_xattr_put_listen to 0 in case when there is
insufficient space in the buffer assuming that setting context->count to -1
would be enough, but all of the ->put_listent callers only check seen_enough.
This results in a failed assertion:
XFS: Assertion failed: context->count >= 0, file: fs/xfs/xfs_xattr.c, line: 175
in insufficient buffer size case.
This is only reproducible with at least 2 xattrs and only when the buffer
gets depleted before the last one.
Furthermore if buffersize is such that it is enough to hold the last xattr's
name, but not enough to hold the sum of preceeding xattr names listxattr won't
fail with ERANGE, but will suceed returning last xattr's name without the
first character. The first character end's up overwriting data stored at
(context->alist - 1).
Signed-off-by: Artem Savkov <asavkov@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Cc: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/xfs/xfs_xattr.c | 1 +
1 file changed, 1 insertion(+)
--- a/fs/xfs/xfs_xattr.c
+++ b/fs/xfs/xfs_xattr.c
@@ -147,6 +147,7 @@ __xfs_xattr_put_listent(
arraytop = context->count + prefix_len + namelen + 1;
if (arraytop > context->firstu) {
context->count = -1; /* insufficient space */
+ context->seen_enough = 1;
return 0;
}
offset = (char *)context->alist + context->count;
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4.7 2/2] mm: remove gup_flags FOLL_WRITE games from __get_user_pages()
2016-10-19 18:31 ` [PATCH 4.7 0/2] 4.7.9-stable review Greg Kroah-Hartman
2016-10-19 18:31 ` [PATCH 4.7 1/2] Make __xfs_xattr_put_listen preperly report errors Greg Kroah-Hartman
@ 2016-10-19 18:31 ` Greg Kroah-Hartman
2016-10-19 22:29 ` [PATCH 4.7 0/2] 4.7.9-stable review Shuah Khan
2016-10-20 1:43 ` Guenter Roeck
3 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2016-10-19 18:31 UTC (permalink / raw)
To: linux-kernel
Cc: Greg Kroah-Hartman, stable, Hugh Dickins, Michal Hocko,
Andy Lutomirski, Kees Cook, Oleg Nesterov, Willy Tarreau,
Nick Piggin, Greg Thelen, Linus Torvalds
4.7-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <torvalds@linux-foundation.org>
commit 19be0eaffa3ac7d8eb6784ad9bdbc7d67ed8e619 upstream.
This is an ancient bug that was actually attempted to be fixed once
(badly) by me eleven years ago in commit 4ceb5db9757a ("Fix
get_user_pages() race for write access") but that was then undone due to
problems on s390 by commit f33ea7f404e5 ("fix get_user_pages bug").
In the meantime, the s390 situation has long been fixed, and we can now
fix it by checking the pte_dirty() bit properly (and do it better). The
s390 dirty bit was implemented in abf09bed3cce ("s390/mm: implement
software dirty bits") which made it into v3.9. Earlier kernels will
have to look at the page state itself.
Also, the VM has become more scalable, and what used a purely
theoretical race back then has become easier to trigger.
To fix it, we introduce a new internal FOLL_COW flag to mark the "yes,
we already did a COW" rather than play racy games with FOLL_WRITE that
is very fundamental, and then use the pte dirty flag to validate that
the FOLL_COW flag is still valid.
Reported-and-tested-by: Phil "not Paul" Oester <kernel@linuxace.com>
Acked-by: Hugh Dickins <hughd@google.com>
Reviewed-by: Michal Hocko <mhocko@suse.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Willy Tarreau <w@1wt.eu>
Cc: Nick Piggin <npiggin@gmail.com>
Cc: Greg Thelen <gthelen@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
include/linux/mm.h | 1 +
mm/gup.c | 14 ++++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2194,6 +2194,7 @@ static inline struct page *follow_page(s
#define FOLL_TRIED 0x800 /* a retry, previous pass started an IO */
#define FOLL_MLOCK 0x1000 /* lock present pages */
#define FOLL_REMOTE 0x2000 /* we are working on non-current tsk/mm */
+#define FOLL_COW 0x4000 /* internal GUP flag */
typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr,
void *data);
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -60,6 +60,16 @@ static int follow_pfn_pte(struct vm_area
return -EEXIST;
}
+/*
+ * 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)
{
@@ -95,7 +105,7 @@ retry:
}
if ((flags & FOLL_NUMA) && pte_protnone(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;
}
@@ -409,7 +419,7 @@ static int faultin_page(struct task_stru
* reCOWed by userspace write).
*/
if ((ret & VM_FAULT_WRITE) && !(vma->vm_flags & VM_WRITE))
- *flags &= ~FOLL_WRITE;
+ *flags |= FOLL_COW;
return 0;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 4.7 0/2] 4.7.9-stable review
2016-10-19 18:31 ` [PATCH 4.7 0/2] 4.7.9-stable review Greg Kroah-Hartman
2016-10-19 18:31 ` [PATCH 4.7 1/2] Make __xfs_xattr_put_listen preperly report errors Greg Kroah-Hartman
2016-10-19 18:31 ` [PATCH 4.7 2/2] mm: remove gup_flags FOLL_WRITE games from __get_user_pages() Greg Kroah-Hartman
@ 2016-10-19 22:29 ` Shuah Khan
2016-10-20 1:43 ` Guenter Roeck
3 siblings, 0 replies; 5+ messages in thread
From: Shuah Khan @ 2016-10-19 22:29 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-kernel
Cc: torvalds, akpm, linux, patches, ben.hutchings, stable, Shuah Khan
On 10/19/2016 12:31 PM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.7.9 release.
> There are 2 patches in this series, all will be posted as a response
> to this one. If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Fri Oct 21 18:28:47 UTC 2016.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.7.9-rc1.gz
> or in the git tree and branch at:
> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.7.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h
>
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America(Silicon Valley)
shuah.kh@samsung.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 4.7 0/2] 4.7.9-stable review
2016-10-19 18:31 ` [PATCH 4.7 0/2] 4.7.9-stable review Greg Kroah-Hartman
` (2 preceding siblings ...)
2016-10-19 22:29 ` [PATCH 4.7 0/2] 4.7.9-stable review Shuah Khan
@ 2016-10-20 1:43 ` Guenter Roeck
3 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2016-10-20 1:43 UTC (permalink / raw)
To: Greg Kroah-Hartman, linux-kernel
Cc: torvalds, akpm, shuah.kh, patches, ben.hutchings, stable
On 10/19/2016 11:31 AM, Greg Kroah-Hartman wrote:
> This is the start of the stable review cycle for the 4.7.9 release.
> There are 2 patches in this series, all will be posted as a response
> to this one. If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Fri Oct 21 18:28:47 UTC 2016.
> Anything received after that time might be too late.
>
Build results:
total: 149 pass: 149 fail: 0
Qemu test results:
total: 110 pass: 110 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-10-20 1:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20161019183123uscas1p2c754dd106fd0689b31230c3723a4d0c7@uscas1p2.samsung.com>
2016-10-19 18:31 ` [PATCH 4.7 0/2] 4.7.9-stable review Greg Kroah-Hartman
2016-10-19 18:31 ` [PATCH 4.7 1/2] Make __xfs_xattr_put_listen preperly report errors Greg Kroah-Hartman
2016-10-19 18:31 ` [PATCH 4.7 2/2] mm: remove gup_flags FOLL_WRITE games from __get_user_pages() Greg Kroah-Hartman
2016-10-19 22:29 ` [PATCH 4.7 0/2] 4.7.9-stable review Shuah Khan
2016-10-20 1:43 ` Guenter Roeck
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).