~xnox/ubuntu/+source/linux/+git/focal:master-prep

Last commit made on 2021-09-24
Get this branch:
git clone -b master-prep https://git.launchpad.net/~xnox/ubuntu/+source/linux/+git/focal
Only Dimitri John Ledkov can upload to this branch. If you are Dimitri John Ledkov please log in for upload directions.

Branch merges

Branch information

Name:
master-prep
Repository:
lp:~xnox/ubuntu/+source/linux/+git/focal

Recent commits

4920832... by Stefan Bader

UBUNTU: Ubuntu-5.4.0-89.100

Signed-off-by: Stefan Bader <email address hidden>

66f612e... by Stefan Bader

UBUNTU: debian/dkms-versions -- update from kernel-versions (main/2021.09.27)

BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Stefan Bader <email address hidden>

f9cfc59... by Jan Kara <email address hidden>

ext4: fix mmap write protection for data=journal mode

BugLink: https://bugs.launchpad.net/bugs/1847340

Commit afb585a97f81 "ext4: data=journal: write-protect pages on
j_submit_inode_data_buffers()") added calls ext4_jbd2_inode_add_write()
to track inode ranges whose mappings need to get write-protected during
transaction commits. However the added calls use wrong start of a range
(0 instead of page offset) and so write protection is not necessarily
effective. Use correct range start to fix the problem.

Fixes: afb585a97f81 ("ext4: data=journal: write-protect pages on j_submit_inode_data_buffers()")
Signed-off-by: Jan Kara <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Theodore Ts'o <email address hidden>
(cherry picked from commit b5b18160a3e7a9f55e3528d77051670cca6d9314)
Signed-off-by: Mauricio Faria de Oliveira <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Stefan Bader <email address hidden>
Signed-off-by: Kelsey Skunberg <email address hidden>

4adc435... by Mauricio Faria de Oliveira

ext4: data=journal: write-protect pages on j_submit_inode_data_buffers()

BugLink: https://bugs.launchpad.net/bugs/1847340

This implements journal callbacks j_submit|finish_inode_data_buffers()
with different behavior for data=journal: to write-protect pages under
commit, preventing changes to buffers writeably mapped to userspace.

If a buffer's content changes between commit's checksum calculation
and write-out to disk, it can cause journal recovery/mount failures
upon a kernel crash or power loss.

    [ 27.334874] EXT4-fs: Warning: mounting with data=journal disables delayed allocation, dioread_nolock, and O_DIRECT support!
    [ 27.339492] JBD2: Invalid checksum recovering data block 8705 in log
    [ 27.342716] JBD2: recovery failed
    [ 27.343316] EXT4-fs (loop0): error loading journal
    mount: /ext4: can't read superblock on /dev/loop0.

In j_submit_inode_data_buffers() we write-protect the inode's pages
with write_cache_pages() and redirty w/ writepage callback if needed.

In j_finish_inode_data_buffers() there is nothing do to.

And in order to use the callbacks, inodes are added to the inode list
in transaction in __ext4_journalled_writepage() and ext4_page_mkwrite().

In ext4_page_mkwrite() we must make sure that the buffers are attached
to the transaction as jbddirty with write_end_fn(), as already done in
__ext4_journalled_writepage().

Signed-off-by: Mauricio Faria de Oliveira <email address hidden>
Reported-by: Dann Frazier <email address hidden>
Reported-by: kernel test robot <email address hidden> # wbc.nr_to_write
Suggested-by: Jan Kara <email address hidden>
Reviewed-by: Jan Kara <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Theodore Ts'o <email address hidden>
(cherry picked from commit afb585a97f81899e39c14658789f02259d8c306a)
Signed-off-by: Mauricio Faria de Oliveira <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Stefan Bader <email address hidden>
Signed-off-by: Kelsey Skunberg <email address hidden>

451dcef... by Mauricio Faria de Oliveira

ext4: data=journal: fixes for ext4_page_mkwrite()

BugLink: https://bugs.launchpad.net/bugs/1847340

These are two fixes for data journalling required by
the next patch, discovered while testing it.

First, the optimization to return early if all buffers
are mapped is not appropriate for the next patch:

The inode _must_ be added to the transaction's list in
data=journal mode (so to write-protect pages on commit)
thus we cannot return early there.

Second, once that optimization to reduce transactions
was disabled for data=journal mode, more transactions
happened, and occasionally hit this warning message:
'JBD2: Spotted dirty metadata buffer'.

Reason is, block_page_mkwrite() will set_buffer_dirty()
before do_journal_get_write_access() that is there to
prevent it. This issue was masked by the optimization.

So, on data=journal use __block_write_begin() instead.
This also requires page locking and len recalculation.
(see block_page_mkwrite() for implementation details.)

Finally, as Jan noted there is little sharing between
data=journal and other modes in ext4_page_mkwrite().

However, a prototype of ext4_journalled_page_mkwrite()
showed there still would be lots of duplicated lines
(tens of) that didn't seem worth it.

Thus this patch ends up with an ugly goto to skip all
non-data journalling code (to avoid long indentations,
but that can be changed..) in the beginning, and just
a conditional in the transaction section.

Well, we skip a common part to data journalling which
is the page truncated check, but we do it again after
ext4_journal_start() when we re-acquire the page lock
(so not to acquire the page lock twice needlessly for
data journalling.)

Signed-off-by: Mauricio Faria de Oliveira <email address hidden>
Suggested-by: Jan Kara <email address hidden>
Reviewed-by: Jan Kara <email address hidden>
Reviewed-by: Andreas Dilger <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Theodore Ts'o <email address hidden>
(cherry picked from commit 64a9f1449950c774743420cf374047043e32fde4)
Signed-off-by: Mauricio Faria de Oliveira <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Stefan Bader <email address hidden>
Signed-off-by: Kelsey Skunberg <email address hidden>

8df0077... by Mauricio Faria de Oliveira

jbd2, ext4, ocfs2: introduce/use journal callbacks j_submit|finish_inode_data_buffers()

BugLink: https://bugs.launchpad.net/bugs/1847340

Introduce journal callbacks to allow different behaviors
for an inode in journal_submit|finish_inode_data_buffers().

The existing users of the current behavior (ext4, ocfs2)
are adapted to use the previously exported functions
that implement the current behavior.

Users are callers of jbd2_journal_inode_ranged_write|wait(),
which adds the inode to the transaction's inode list with
the JI_WRITE|WAIT_DATA flags. Only ext4 and ocfs2 in-tree.

Both CONFIG_EXT4_FS and CONFIG_OCSFS2_FS select CONFIG_JBD2,
which builds fs/jbd2/commit.c and journal.c that define and
export the functions, so we can call directly in ext4/ocfs2.

Signed-off-by: Mauricio Faria de Oliveira <email address hidden>
Suggested-by: Jan Kara <email address hidden>
Reviewed-by: Jan Kara <email address hidden>
Reviewed-by: Andreas Dilger <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Theodore Ts'o <email address hidden>
(cherry picked from commit 342af94ec6c02aa478fe2adcd41b950e154b03ba)
Signed-off-by: Mauricio Faria de Oliveira <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Stefan Bader <email address hidden>
Signed-off-by: Kelsey Skunberg <email address hidden>

be4f376... by Mauricio Faria de Oliveira

jbd2: introduce/export functions jbd2_journal_submit|finish_inode_data_buffers()

BugLink: https://bugs.launchpad.net/bugs/1847340

Export functions that implement the current behavior done
for an inode in journal_submit|finish_inode_data_buffers().

No functional change.

Signed-off-by: Mauricio Faria de Oliveira <email address hidden>
Suggested-by: Jan Kara <email address hidden>
Reviewed-by: Jan Kara <email address hidden>
Reviewed-by: Andreas Dilger <email address hidden>
Link: https://<email address hidden>
Signed-off-by: Theodore Ts'o <email address hidden>
(cherry picked from commit aa3c0c61f62d682259e3e66cdc01846290f9cd6c)
Signed-off-by: Mauricio Faria de Oliveira <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Stefan Bader <email address hidden>
Signed-off-by: Kelsey Skunberg <email address hidden>

7c95317... by Theodore Ts'o

ext4: fix race writing to an inline_data file while its xattrs are changing

The location of the system.data extended attribute can change whenever
xattr_sem is not taken. So we need to recalculate the i_inline_off
field since it mgiht have changed between ext4_write_begin() and
ext4_write_end().

This means that caching i_inline_off is probably not helpful, so in
the long run we should probably get rid of it and shrink the in-memory
ext4 inode slightly, but let's fix the race the simple way for now.

Cc: <email address hidden>
Fixes: f19d5870cbf72 ("ext4: add normal write support for inline data")
Reported-by: <email address hidden>
Signed-off-by: Theodore Ts'o <email address hidden>
(cherry picked from commit a54c4613dac1500b40e4ab55199f7c51f028e848)
CVE-2021-40490
Signed-off-by: Thadeu Lima de Souza Cascardo <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Kelsey Skunberg <email address hidden>
Signed-off-by: Kelsey Skunberg <email address hidden>

d48a912... by Danilo Krummrich

Revert "UBUNTU: SAUCE: ext4: fix directory index node split corruption"

This reverts commit d94ce655c62e06461879548962bd3e4000190c97.

Already fixed by commit 93ad4c3f59c6
("ext4: fix potential htree corruption when growing large_dir directories")

BugLink: https://bugs.launchpad.net/bugs/1942902

Signed-off-by: Danilo Krummrich <email address hidden>
Acked-by: Stefan Bader <email address hidden>
Acked-by: Kleber Sacilotto de Souza <email address hidden>
Signed-off-by: Kelsey Skunberg <email address hidden>

079b953... by Dust Li <email address hidden>

selftests/net: remove min gso test in packet_snd

BugLink: https://bugs.launchpad.net/bugs/1892213

This patch removed the 'raw gso min size - 1' test which
always fails now:
./in_netns.sh ./psock_snd -v -c -g -l "${mss}"
  raw gso min size - 1 (expected to fail)
  tx: 1524
  rx: 1472
  OK

After commit 7c6d2ecbda83 ("net: be more gentle about silly
gso requests coming from user"), we relaxed the min gso_size
check in virtio_net_hdr_to_skb().
So when a packet which is smaller then the gso_size,
GSO for this packet will not be set, the packet will be
send/recv successfully.

Signed-off-by: Dust Li <email address hidden>
Reviewed-by: Xuan Zhuo <email address hidden>
Signed-off-by: David S. Miller <email address hidden>
(cherry picked from commit cfba3fb68960b4e1fb63b4e3d95970b4a4be8577)
Signed-off-by: Po-Hsu Lin <email address hidden>
Acked-by: Tim Gardner <email address hidden>
Acked-by: Stefan Bader <email address hidden>
Signed-off-by: Kelsey Skunberg <email address hidden>