Linux ZFS port doesn't respect RLIMIT_FSIZE

Bug #1656259 reported by Colin Watson
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linux
Fix Released
Unknown
linux (Ubuntu)
Fix Released
High
Colin Ian King
Xenial
Fix Released
Undecided
Unassigned
Yakkety
Fix Released
Undecided
Unassigned
Zesty
Fix Released
High
Colin Ian King
zfs-linux (Ubuntu)
Fix Released
High
Colin Ian King
Xenial
Fix Released
Undecided
Unassigned
Yakkety
Fix Released
Undecided
Unassigned
Zesty
Fix Released
High
Colin Ian King

Bug Description

== SRU Request, Yakkety, Xenial ==

bash -c 'ulimit -f 1024; yes | head -n2097152' >/path/on/filesystem/under/test

On ext4, this test case prints something along the lines of:

  bash: line 1: 11274 Broken pipe yes
       11275 File size limit exceeded(core dumped) | head -n2097152

On ZFS, this test case incorrectly exits zero with no output, demonstrating that ZFS does not respect RLIMIT_FSIZE.

I asked a friend to run this on Solaris 5.10 and FreeBSD 10.0-CURRENT, and on those systems this test case correctly generates SIGXFSZ; so it seems that this is a bug in the Linux port of ZFS.

(This was discovered while tracking down Launchpad test suite failures under LXD on ZFS. Launchpad uses RLIMIT_FSIZE in one place to guard against bugs that cause debdiff to generate arbitrarily large amounts of output and fill the disk.)

== Fix ==

Upstream fix https://github.com/behlendorf/zfs/commit/230c03e59d3d13d9b60125f73cf3fff327b45c21

== Test case ==

With the fix:

bash -c 'ulimit -f 1024; yes | head -n2097152' >/path/on/filesystem/under/test

should report:

  bash: line 1: 11274 Broken pipe yes
       11275 File size limit exceeded(core dumped) | head -n2097152

== Regression Potential ==

Could break read/writes semantics to zfs

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

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: linux-image-4.4.0-57-generic 4.4.0-57.78
ProcVersionSignature: Ubuntu 4.4.0-57.78-generic 4.4.35
Uname: Linux 4.4.0-57-generic x86_64
NonfreeKernelModules: zfs zunicode zcommon znvpair zavl
ApportVersion: 2.20.1-0ubuntu2.4
Architecture: amd64
CurrentDesktop: Unity
Date: Fri Jan 13 10:01:36 2017
EcryptfsInUse: Yes
HibernationDevice: RESUME=UUID=139ad421-b014-4c34-ae8c-dd1d15205875
InstallationDate: Installed on 2013-03-01 (1413 days ago)
InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Alpha amd64 (20130223.1)
MachineType: LENOVO 20BXCTO1WW
ProcFB: 0 inteldrmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.4.0-57-generic.efi.signed root=UUID=12c52021-a1ab-4984-9dd7-63cf0dcaac16 ro quiet splash vt.handoff=7
RelatedPackageVersions:
 linux-restricted-modules-4.4.0-57-generic N/A
 linux-backports-modules-4.4.0-57-generic N/A
 linux-firmware 1.157.6
SourcePackage: linux
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 05/21/2015
dmi.bios.vendor: LENOVO
dmi.bios.version: JBET49WW (1.14 )
dmi.board.asset.tag: Not Available
dmi.board.name: 20BXCTO1WW
dmi.board.vendor: LENOVO
dmi.board.version: SDK0E50512 STD
dmi.chassis.asset.tag: No Asset Information
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: None
dmi.modalias: dmi:bvnLENOVO:bvrJBET49WW(1.14):bd05/21/2015:svnLENOVO:pn20BXCTO1WW:pvrThinkPadT450s:rvnLENOVO:rn20BXCTO1WW:rvrSDK0E50512STD:cvnLENOVO:ct10:cvrNone:
dmi.product.name: 20BXCTO1WW
dmi.product.version: ThinkPad T450s
dmi.sys.vendor: LENOVO

CVE References

Revision history for this message
Colin Watson (cjwatson) wrote :
Changed in linux (Ubuntu):
assignee: nobody → Colin Ian King (colin-king)
importance: Undecided → Medium
importance: Medium → High
Changed in linux:
status: Unknown → New
Revision history for this message
Colin Ian King (colin-king) wrote :
Changed in linux (Ubuntu):
status: New → In Progress
Changed in linux:
status: New → Fix Released
Revision history for this message
Colin Ian King (colin-king) wrote :

I've backported the fix to Ubuntu Zesty ZFS 0.6.5.8 and this patch solves the issues we're seeing. I've given it a soak test with various zfs specific tests and I don't see any regressions. I've asked upstream if this fix be merged into the main ZFS repo.

Revision history for this message
Colin Ian King (colin-king) wrote :

Fixed in Zesty 0.6.5.9

Revision history for this message
Andy Whitcroft (apw) wrote : Please test proposed package

Hello Colin, or anyone else affected,

Accepted zfs-linux into yakkety-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/zfs-linux/0.6.5.8-0ubuntu4.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in zfs-linux (Ubuntu Yakkety):
status: New → Fix Committed
Changed in zfs-linux (Ubuntu Zesty):
status: New → Fix Released
importance: Undecided → Medium
assignee: nobody → Colin Ian King (colin-king)
Changed in linux (Ubuntu Zesty):
status: In Progress → Fix Released
Changed in zfs-linux (Ubuntu Zesty):
importance: Medium → High
Changed in linux (Ubuntu Zesty):
status: Fix Released → Fix Committed
Revision history for this message
Andy Whitcroft (apw) wrote :

Hello Colin, or anyone else affected,

Accepted zfs-linux into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/zfs-linux/0.6.5.6-0ubuntu16 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in zfs-linux (Ubuntu Xenial):
status: New → Fix Committed
description: updated
Revision history for this message
Colin Ian King (colin-king) wrote :

Waiting for sync'd kernel fix to land in Xenial and Yakkety -proposed kernels so I can test userspace and kernel space together.

Brad Figg (brad-figg)
Changed in linux (Ubuntu Xenial):
status: New → Fix Committed
Brad Figg (brad-figg)
Changed in linux (Ubuntu Yakkety):
status: New → Invalid
status: Invalid → Fix Committed
Revision history for this message
Colin Ian King (colin-king) wrote :

tested and verified with 4.4.0-69-generic #90-Ubuntu on Xenial with ZFS 0.6.5.6-0ubuntu16

tags: added: verified-xenial-done
Revision history for this message
Thadeu Lima de Souza Cascardo (cascardo) wrote :

This bug is awaiting verification that the kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-xenial' to 'verification-done-xenial'. If the problem still exists, change the tag 'verification-needed-xenial' to 'verification-failed-xenial'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

tags: added: verification-needed-xenial
Revision history for this message
Thadeu Lima de Souza Cascardo (cascardo) wrote :

This bug is awaiting verification that the kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-yakkety' to 'verification-done-yakkety'. If the problem still exists, change the tag 'verification-needed-yakkety' to 'verification-failed-yakkety'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

tags: added: verification-needed-yakkety
Revision history for this message
Colin Ian King (colin-king) wrote :

tested and verified with 4.4.0-69-generic #90-Ubuntu on Xenial with ZFS 0.6.5.6-0ubuntu16

tags: added: verification-done-xenial
removed: verification-needed-xenial verified-xenial-done
Revision history for this message
Colin Ian King (colin-king) wrote :

tested and verified with 4.8.0-43-generic #46-Ubuntu on Yakkety with ZFS 0.6.5.8-0buntu4.2

tags: added: verification-doneyakkety
removed: verification-needed-yakkety
tags: added: verification-done-yakkety
removed: verification-doneyakkety
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package zfs-linux - 0.6.5.8-0ubuntu4.2

---------------
zfs-linux (0.6.5.8-0ubuntu4.2) yakkety; urgency=low

  * Enable zfs to respect RSIZE_LIMIT limits (LP: #1656259)
    backport of upstream commit 933ec999511f3d29de005bfa8966ae007b161c0f
    ("Retire .write/.read file operations")

 -- Colin Ian King <email address hidden> Fri, 17 Feb 2017 11:00:12 +0000

Changed in zfs-linux (Ubuntu Yakkety):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for zfs-linux has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package zfs-linux - 0.6.5.6-0ubuntu16

---------------
zfs-linux (0.6.5.6-0ubuntu16) xenial; urgency=medium

  * Enable zfs to respect RSIZE_LIMIT limits (LP: #1656259)
    - backport of zfs upstream commit 4b908d32200b6e5c7b5115322b6c8d25e770daa0
      ("Linux 4.8 compat: posix_acl_valid()") to facilitate changes in posix_acl_valid.
      1015-Linux-4.8-compat-posix_acl_valid.patch
    - backport of upstream commit 933ec999511f3d29de005bfa8966ae007b161c0f
      ("Retire .write/.read file operations")
      1016-Retire-.write-.read-file-operations.patch

 -- Colin Ian King <email address hidden> Fri, 17 Feb 2017 11:00:12 +0000

Changed in zfs-linux (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (29.1 KiB)

This bug was fixed in the package linux - 4.4.0-75.96

---------------
linux (4.4.0-75.96) xenial; urgency=low

  * linux: 4.4.0-75.96 -proposed tracker (LP: #1684441)

  * [Hyper-V] hv: util: move waiting for release to hv_utils_transport itself
    (LP: #1682561)
    - Drivers: hv: util: move waiting for release to hv_utils_transport itself

linux (4.4.0-74.95) xenial; urgency=low

  * linux: 4.4.0-74.95 -proposed tracker (LP: #1682041)

  * [Hyper-V] hv: vmbus: Raise retry/wait limits in vmbus_post_msg()
    (LP: #1681893)
    - Drivers: hv: vmbus: Raise retry/wait limits in vmbus_post_msg()

linux (4.4.0-73.94) xenial; urgency=low

  * linux: 4.4.0-73.94 -proposed tracker (LP: #1680416)

  * CVE-2017-6353
    - sctp: deny peeloff operation on asocs with threads sleeping on it

  * vfat: missing iso8859-1 charset (LP: #1677230)
    - [Config] NLS_ISO8859_1=y

  * Regression: KVM modules should be on main kernel package (LP: #1678099)
    - [Config] powerpc: Add kvm-hv and kvm-pr to the generic inclusion list

  * linux-lts-xenial 4.4.0-63.84~14.04.2 ADT test failure with linux-lts-xenial
    4.4.0-63.84~14.04.2 (LP: #1664912)
    - SAUCE: apparmor: fix link auditing failure due to, uninitialized var

  * regession tests failing after stackprofile test is run (LP: #1661030)
    - SAUCE: fix regression with domain change in complain mode

  * Permission denied and inconsistent behavior in complain mode with 'ip netns
    list' command (LP: #1648903)
    - SAUCE: fix regression with domain change in complain mode

  * unexpected errno=13 and disconnected path when trying to open /proc/1/ns/mnt
    from a unshared mount namespace (LP: #1656121)
    - SAUCE: apparmor: null profiles should inherit parent control flags

  * apparmor refcount leak of profile namespace when removing profiles
    (LP: #1660849)
    - SAUCE: apparmor: fix ns ref count link when removing profiles from policy

  * tor in lxd: apparmor="DENIED" operation="change_onexec"
    namespace="root//CONTAINERNAME_<var-lib-lxd>" profile="unconfined"
    name="system_tor" (LP: #1648143)
    - SAUCE: apparmor: Fix no_new_privs blocking change_onexec when using stacked
      namespaces

  * apparmor oops in bind_mnt when dev_path lookup fails (LP: #1660840)
    - SAUCE: apparmor: fix oops in bind_mnt when dev_path lookup fails

  * apparmor auditing denied access of special apparmor .null fi\ le
    (LP: #1660836)
    - SAUCE: apparmor: Don't audit denied access of special apparmor .null file

  * apparmor label leak when new label is unused (LP: #1660834)
    - SAUCE: apparmor: fix label leak when new label is unused

  * apparmor reference count bug in label_merge_insert() (LP: #1660833)
    - SAUCE: apparmor: fix reference count bug in label_merge_insert()

  * apparmor's raw_data file in securityfs is sometimes truncated (LP: #1638996)
    - SAUCE: apparmor: fix replacement race in reading rawdata

  * unix domain socket cross permission check failing with nested namespaces
    (LP: #1660832)
    - SAUCE: apparmor: fix cross ns perm of unix domain sockets

  * Xenial update to v4.4.59 stable release (LP: #1678960)
    - xfrm: policy: init locks early
    - virtio_balloon: init ...

Changed in linux (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (14.5 KiB)

This bug was fixed in the package linux - 4.8.0-49.52

---------------
linux (4.8.0-49.52) yakkety; urgency=low

  * linux: 4.8.0-49.52 -proposed tracker (LP: #1684427)

  * [Hyper-V] hv: util: move waiting for release to hv_utils_transport itself
    (LP: #1682561)
    - Drivers: hv: util: move waiting for release to hv_utils_transport itself

linux (4.8.0-48.51) yakkety; urgency=low

  * linux: 4.8.0-48.51 -proposed tracker (LP: #1682034)

  * [Hyper-V] hv: vmbus: Raise retry/wait limits in vmbus_post_msg()
    (LP: #1681893)
    - Drivers: hv: vmbus: Raise retry/wait limits in vmbus_post_msg()

linux (4.8.0-47.50) yakkety; urgency=low

  * linux: 4.8.0-47.50 -proposed tracker (LP: #1679678)

  * CVE-2017-6353
    - sctp: deny peeloff operation on asocs with threads sleeping on it

  * CVE-2017-5986
    - sctp: avoid BUG_ON on sctp_wait_for_sndbuf

  * vfat: missing iso8859-1 charset (LP: #1677230)
    - [Config] NLS_ISO8859_1=y

  * [Hyper-V] pci-hyperv: Use device serial number as PCI domain (LP: #1667527)
    - net/mlx4_core: Use cq quota in SRIOV when creating completion EQs

  * Regression: KVM modules should be on main kernel package (LP: #1678099)
    - [Config] powerpc: Add kvm-hv and kvm-pr to the generic inclusion list

  * linux-lts-xenial 4.4.0-63.84~14.04.2 ADT test failure with linux-lts-xenial
    4.4.0-63.84~14.04.2 (LP: #1664912)
    - SAUCE: apparmor: fix link auditing failure due to, uninitialized var

  * regession tests failing after stackprofile test is run (LP: #1661030)
    - SAUCE: fix regression with domain change in complain mode

  * Permission denied and inconsistent behavior in complain mode with 'ip netns
    list' command (LP: #1648903)
    - SAUCE: fix regression with domain change in complain mode

  * unexpected errno=13 and disconnected path when trying to open /proc/1/ns/mnt
    from a unshared mount namespace (LP: #1656121)
    - SAUCE: apparmor: null profiles should inherit parent control flags

  * apparmor refcount leak of profile namespace when removing profiles
    (LP: #1660849)
    - SAUCE: apparmor: fix ns ref count link when removing profiles from policy

  * tor in lxd: apparmor="DENIED" operation="change_onexec"
    namespace="root//CONTAINERNAME_<var-lib-lxd>" profile="unconfined"
    name="system_tor" (LP: #1648143)
    - SAUCE: apparmor: Fix no_new_privs blocking change_onexec when using stacked
      namespaces

  * apparmor oops in bind_mnt when dev_path lookup fails (LP: #1660840)
    - SAUCE: apparmor: fix oops in bind_mnt when dev_path lookup fails

  * apparmor auditing denied access of special apparmor .null fi\ le
    (LP: #1660836)
    - SAUCE: apparmor: Don't audit denied access of special apparmor .null file

  * apparmor label leak when new label is unused (LP: #1660834)
    - SAUCE: apparmor: fix label leak when new label is unused

  * apparmor reference count bug in label_merge_insert() (LP: #1660833)
    - SAUCE: apparmor: fix reference count bug in label_merge_insert()

  * apparmor's raw_data file in securityfs is sometimes truncated (LP: #1638996)
    - SAUCE: apparmor: fix replacement race in reading rawdata

  * unix domain socket cross permission check failing with n...

Changed in linux (Ubuntu Yakkety):
status: Fix Committed → Fix Released
Revision history for this message
Colin Ian King (colin-king) wrote :

This was also fixed in Zesty with the kernel 4.10.0-9.11

commit d177712eb2130b8c53f9d4fd9b5b756b70fc4f35
Author: Colin Ian King <email address hidden>
Date: Thu Feb 16 10:36:16 2017 +0000

    UBUNTU: SAUCE: (noup) Update spl to 0.6.5.9-1, zfs to 0.6.5.9-2

    Signed-off-by: Colin Ian King <email address hidden>
    Signed-off-by: Tim Gardner <email address hidden>

Changed in linux (Ubuntu):
status: Fix Committed → Fix Released
Changed in linux (Ubuntu Zesty):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.