среда

[Bug 1939301] Re: REGRESSION: shiftfs lets sendfile fail with EINVAL

** Changed in: linux-hwe-5.11 (Ubuntu Focal)
Status: In Progress => Fix Committed

--
You received this bug notification because you are subscribed to linux
in Ubuntu.
Matching subscriptions: Bgg, Bmail, Nb
https://bugs.launchpad.net/bugs/1939301

Title:
REGRESSION: shiftfs lets sendfile fail with EINVAL

Status in linux package in Ubuntu:
In Progress
Status in linux-hwe-5.11 package in Ubuntu:
Invalid
Status in linux source package in Focal:
Invalid
Status in linux-hwe-5.11 source package in Focal:
Fix Committed
Status in linux-meta-hwe-5.11 source package in Focal:
Invalid
Status in linux source package in Hirsute:
Fix Committed
Status in linux-hwe-5.11 source package in Hirsute:
Invalid
Status in linux-meta-hwe-5.11 source package in Hirsute:
Invalid
Status in linux source package in Impish:
In Progress
Status in linux-hwe-5.11 source package in Impish:
Invalid
Status in linux-meta-hwe-5.11 source package in Impish:
Invalid

Bug description:
With the 5.11 HWE kernel landing for Ubuntu 20.04 we noticed that LXC
tools we're using in bionic containers as part of Anbox Cloud start to
fail when executed on the 5.11 kernel.

A simple reproducer looks like this:

1. Run Ubuntu 20.04 with HWE kernel (linux-generic-hwe-20.04, 5.11.0-25-generic #27~20.04.1-Ubuntu)
2. Install LXD and enable shiftfs
$ snap install lxd
$ snap set lxd shiftfs.enable true
$ snap restart --reload lxd
3. Launch bionic container and run `lxc-info`
$ lxc launch ubuntu:b c0
$ lxc shell c0
c0$ apt update
c0$ apt install -y lxc-utils
root@c1:~# apt show lxc-utils | grep Version
Version: 3.0.3-0ubuntu1~18.04.1
c0$ mkdir -p containers/test
c0$ touch containers/test/config
c0$ lxc-info -P containers -n test
Failed to load config for test
Failure to retrieve information on containers:test

Looking into the failing `lxc-info` call with strace reveals:

...
memfd_create(".lxc_config_file", MFD_CLOEXEC) = 4
openat(AT_FDCWD, "containers/test/config", O_RDONLY|O_CLOEXEC) = 5
sendfile(4, 5, NULL, 2147479552) = -1 EINVAL (Invalid argument
...

LXC >= 4.0.0 doesn't use sendfile anymore and with that isn't
affected. Any other tool using sendfile however is affected and will
fail. Bionic is affected as the 3.0.3 version of LXC it includes still
uses sendfile.

Disabling shiftfs makes things work again and can be considered as a
workaround to a certain degree, but not be applicable in all cases.

Further analysis with Christian (cbrauner) from the LXD team this
morning showed that shiftfs is missing an implementation for the now
required slice_read handler in the file_operations structure. So
whenever shiftfs is being used, all calls to sendfile will fail
because of the missing implementation. The generic handler for this
got removed in the following upstream change:
https://lore.kernel.org/lkml/20200626075836.1998185-10-hch@lst.de/

Christian implemented a quick fix:
https://paste.ubuntu.com/p/TPsjfCpnD5/

As of today I don't know of any customer of Anbox Cloud who is
affected by this as most of them run with one of our cloud kernels.
However as soon as 5.11 rolls out to the cloud kernels, we will hit
production systems and cause them to fail.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1939301/+subscriptions

Комментариев нет:

Отправить комментарий