[linux] 01/01: aufs: Fix regression due to "mm: make sendfile(2) killable" (Closes: #812207)
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Tue Jan 26 01:39:06 UTC 2016
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch benh/bug812207
in repository linux.
commit b0ad1283fe9712b19b2af511c36d0e4665fdc9fb
Author: Ben Hutchings <ben at decadent.org.uk>
Date: Tue Jan 26 01:06:43 2016 +0000
aufs: Fix regression due to "mm: make sendfile(2) killable" (Closes: #812207)
- tiny, extract a new func xino_fwrite_wkq()
- XINO handles EINTR from the dying process
---
debian/changelog | 4 ++
...3-xino-handles-eintr-from-the-dying-proce.patch | 66 ++++++++++++++++++
...s-tiny-extract-a-new-func-xino_fwrite_wkq.patch | 81 ++++++++++++++++++++++
debian/patches/series | 2 +
4 files changed, 153 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 80b1aaf..7d2f45e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,10 @@
linux (3.16.7-ckt20-1+deb8u4) UNRELEASED; urgency=medium
* fuse: break infinite loop in fuse_fill_write_pages() (CVE-2015-8785)
+ * aufs: Fix regression due to "mm: make sendfile(2) killable"
+ (Closes: #812207)
+ - tiny, extract a new func xino_fwrite_wkq()
+ - XINO handles EINTR from the dying process
-- Ben Hutchings <ben at decadent.org.uk> Sat, 23 Jan 2016 22:53:58 +0000
diff --git a/debian/patches/bugfix/all/aufs-for-4.3-xino-handles-eintr-from-the-dying-proce.patch b/debian/patches/bugfix/all/aufs-for-4.3-xino-handles-eintr-from-the-dying-proce.patch
new file mode 100644
index 0000000..b6f5b00
--- /dev/null
+++ b/debian/patches/bugfix/all/aufs-for-4.3-xino-handles-eintr-from-the-dying-proce.patch
@@ -0,0 +1,66 @@
+From: "J. R. Okajima" <hooanon05g at gmail.com>
+Date: Mon, 4 Jan 2016 23:33:09 +0900
+Subject: aufs: for 4.3, XINO handles EINTR from the dying process
+Origin: https://github.com/sfjro/aufs4-standalone/commit/5e439ff30c92143d9a9ee3401a84e34c9852533b
+Bug-Debian: https://bugs.debian.org/812207
+
+By the commit
+ 296291c 2015-10-23 mm: make sendfile(2) killable
+new_sync_write() (or ->write()) may return EINTR ealier even if it can
+succeed the operation. It causes an endless loop in aufs
+do_xino_fwrite().
+Here is a dirty workaround to retry do_xino_fwrite() in another context
+(workqueue).
+
+Reported-by: Akihiro Suda <suda.kyoto at gmail.com>
+Tested-by: Akihiro Suda <suda.kyoto at gmail.com>
+See-also: http://www.mail-archive.com/aufs-users@lists.sourceforge.net/msg05231.html
+Signed-off-by: J. R. Okajima <hooanon05g at gmail.com>
+[bwh: Backported to aufs3.16: s/vfs_writef_t/au_writef_t/]
+---
+ fs/aufs/xino.c | 19 +++++++++++++++++--
+ 1 file changed, 17 insertions(+), 2 deletions(-)
+
+diff --git a/fs/aufs/xino.c b/fs/aufs/xino.c
+index cde6ce7..e3cab07 100644
+--- a/fs/aufs/xino.c
++++ b/fs/aufs/xino.c
+@@ -53,6 +53,9 @@ ssize_t xino_fread(vfs_readf_t func, struct file *file, void *kbuf, size_t size,
+
+ /* ---------------------------------------------------------------------- */
+
++static ssize_t xino_fwrite_wkq(au_writef_t func, struct file *file, void *buf,
++ size_t size, loff_t *pos);
++
+ static ssize_t do_xino_fwrite(au_writef_t func, struct file *file, void *kbuf,
+ size_t size, loff_t *pos)
+ {
+@@ -62,14 +65,26 @@ static ssize_t do_xino_fwrite(vfs_writef_t func, struct file *file, void *kbuf,
+ void *k;
+ const char __user *u;
+ } buf;
++ int i;
++ const int prevent_endless = 10;
+
++ i = 0;
+ buf.k = kbuf;
+ oldfs = get_fs();
+ set_fs(KERNEL_DS);
+ do {
+- /* todo: signal_pending? */
+ err = func(file, buf.u, size, pos);
+- } while (err == -EAGAIN || err == -EINTR);
++ if (err == -EINTR
++ && !au_wkq_test()
++ && fatal_signal_pending(current)) {
++ set_fs(oldfs);
++ err = xino_fwrite_wkq(func, file, kbuf, size, pos);
++ BUG_ON(err == -EINTR);
++ oldfs = get_fs();
++ set_fs(KERNEL_DS);
++ }
++ } while (i++ < prevent_endless
++ && (err == -EAGAIN || err == -EINTR));
+ set_fs(oldfs);
+
+ #if 0 /* reserved for future use */
diff --git a/debian/patches/bugfix/all/aufs-tiny-extract-a-new-func-xino_fwrite_wkq.patch b/debian/patches/bugfix/all/aufs-tiny-extract-a-new-func-xino_fwrite_wkq.patch
new file mode 100644
index 0000000..03b1f07
--- /dev/null
+++ b/debian/patches/bugfix/all/aufs-tiny-extract-a-new-func-xino_fwrite_wkq.patch
@@ -0,0 +1,81 @@
+From: "J. R. Okajima" <hooanon05g at gmail.com>
+Date: Mon, 4 Jan 2016 23:31:56 +0900
+Subject: aufs: tiny, extract a new func xino_fwrite_wkq()
+Origin: https://github.com/sfjro/aufs4-standalone/commit/44c72b4050c2563cc6053b91c47885e0409943a5
+Bug-Debian: https://bugs.debian.org/812207
+
+Signed-off-by: J. R. Okajima <hooanon05g at gmail.com>
+[bwh: Backported to aufs3.16:
+ - s/vfs_writef_t/au_writef_t/
+ - Adjust context]
+---
+ fs/aufs/xino.c | 47 +++++++++++++++++++++++++++--------------------
+ 1 file changed, 27 insertions(+), 20 deletions(-)
+
+diff --git a/fs/aufs/xino.c b/fs/aufs/xino.c
+index 44bbede..cde6ce7 100644
+--- a/fs/aufs/xino.c
++++ b/fs/aufs/xino.c
+@@ -95,35 +95,42 @@ static void call_do_xino_fwrite(void *args)
+ *a->errp = do_xino_fwrite(a->func, a->file, a->buf, a->size, a->pos);
+ }
+
++static ssize_t xino_fwrite_wkq(au_writef_t func, struct file *file, void *buf,
++ size_t size, loff_t *pos)
++{
++ ssize_t err;
++ int wkq_err;
++ struct do_xino_fwrite_args args = {
++ .errp = &err,
++ .func = func,
++ .file = file,
++ .buf = buf,
++ .size = size,
++ .pos = pos
++ };
++
++ /*
++ * it breaks RLIMIT_FSIZE and normal user's limit,
++ * users should care about quota and real 'filesystem full.'
++ */
++ wkq_err = au_wkq_wait(call_do_xino_fwrite, &args);
++ if (unlikely(wkq_err))
++ err = wkq_err;
++
++ return err;
++}
++
+ ssize_t xino_fwrite(au_writef_t func, struct file *file, void *buf, size_t size,
+ loff_t *pos)
+ {
+ ssize_t err;
+
+- /* todo: signal block and no wkq? */
+ if (rlimit(RLIMIT_FSIZE) == RLIM_INFINITY) {
+ lockdep_off();
+ err = do_xino_fwrite(func, file, buf, size, pos);
+ lockdep_on();
+- } else {
+- /*
+- * it breaks RLIMIT_FSIZE and normal user's limit,
+- * users should care about quota and real 'filesystem full.'
+- */
+- int wkq_err;
+- struct do_xino_fwrite_args args = {
+- .errp = &err,
+- .func = func,
+- .file = file,
+- .buf = buf,
+- .size = size,
+- .pos = pos
+- };
+-
+- wkq_err = au_wkq_wait(call_do_xino_fwrite, &args);
+- if (unlikely(wkq_err))
+- err = wkq_err;
+- }
++ } else
++ err = xino_fwrite_wkq(func, file, buf, size, pos);
+
+ return err;
+ }
diff --git a/debian/patches/series b/debian/patches/series
index dbd99ec..1a0bc9d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -677,3 +677,5 @@ bugfix/all/unix-properly-account-for-FDs-passed-over-unix-socke.patch
debian/unix-fix-abi-change-for-cve-2013-4312-fix.patch
bugfix/all/KEYS-Fix-keyring-ref-leak-in-join_session_keyring.patch
bugfix/all/fuse-break-infinite-loop-in-fuse_fill_write_pages.patch
+bugfix/all/aufs-tiny-extract-a-new-func-xino_fwrite_wkq.patch
+bugfix/all/aufs-for-4.3-xino-handles-eintr-from-the-dying-proce.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git
More information about the Kernel-svn-changes
mailing list