Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Commit a012569

Browse files
committed
Merge tag 'v6.6.47' into 6.6
This is the 6.6.47 stable release
2 parents bc497df + 4c1a2d4 commit a012569

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+1003
-728
lines changed

Documentation/bpf/map_lpm_trie.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ significant byte.
1717

1818
LPM tries may be created with a maximum prefix length that is a multiple
1919
of 8, in the range from 8 to 2048. The key used for lookup and update
20-
operations is a ``struct bpf_lpm_trie_key``, extended by
20+
operations is a ``struct bpf_lpm_trie_key_u8``, extended by
2121
``max_prefixlen/8`` bytes.
2222

2323
- For IPv4 addresses the data length is 4 bytes

Documentation/mm/page_table_check.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,21 @@ Page table check performs extra verifications at the time when new pages become
1414
accessible from the userspace by getting their page table entries (PTEs PMDs
1515
etc.) added into the table.
1616

17-
In case of detected corruption, the kernel is crashed. There is a small
17+
In case of most detected corruption, the kernel is crashed. There is a small
1818
performance and memory overhead associated with the page table check. Therefore,
1919
it is disabled by default, but can be optionally enabled on systems where the
2020
extra hardening outweighs the performance costs. Also, because page table check
2121
is synchronous, it can help with debugging double map memory corruption issues,
2222
by crashing kernel at the time wrong mapping occurs instead of later which is
2323
often the case with memory corruptions bugs.
2424

25+
It can also be used to do page table entry checks over various flags, dump
26+
warnings when illegal combinations of entry flags are detected. Currently,
27+
userfaultfd is the only user of such to sanity check wr-protect bit against
28+
any writable flags. Illegal flag combinations will not directly cause data
29+
corruption in this case immediately, but that will cause read-only data to
30+
be writable, leading to corrupt when the page content is later modified.
31+
2532
Double mapping detection logic
2633
==============================
2734

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-License-Identifier: GPL-2.0
22
VERSION = 6
33
PATCHLEVEL = 6
4-
SUBLEVEL = 46
4+
SUBLEVEL = 47
55
EXTRAVERSION =
66
NAME = Hurr durr I'ma ninja sloth
77

arch/arm64/kvm/hyp/pgtable.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ static int hyp_unmap_walker(const struct kvm_pgtable_visit_ctx *ctx,
523523

524524
kvm_clear_pte(ctx->ptep);
525525
dsb(ishst);
526-
__tlbi_level(vae2is, __TLBI_VADDR(ctx->addr, 0), ctx->level);
526+
__tlbi_level(vae2is, __TLBI_VADDR(ctx->addr, 0), 0);
527527
} else {
528528
if (ctx->end - ctx->addr < granule)
529529
return -EINVAL;
@@ -861,9 +861,13 @@ static void stage2_unmap_put_pte(const struct kvm_pgtable_visit_ctx *ctx,
861861
if (kvm_pte_valid(ctx->old)) {
862862
kvm_clear_pte(ctx->ptep);
863863

864-
if (!stage2_unmap_defer_tlb_flush(pgt))
865-
kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu,
866-
ctx->addr, ctx->level);
864+
if (kvm_pte_table(ctx->old, ctx->level)) {
865+
kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu, ctx->addr,
866+
0);
867+
} else if (!stage2_unmap_defer_tlb_flush(pgt)) {
868+
kvm_call_hyp(__kvm_tlb_flush_vmid_ipa, mmu, ctx->addr,
869+
ctx->level);
870+
}
867871
}
868872

869873
mm_ops->put_page(ctx->ptep);

arch/loongarch/include/uapi/asm/unistd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2+
#define __ARCH_WANT_NEW_STAT
23
#define __ARCH_WANT_SYS_CLONE
34
#define __ARCH_WANT_SYS_CLONE3
45

arch/x86/include/asm/pgtable.h

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -387,23 +387,7 @@ static inline pte_t pte_wrprotect(pte_t pte)
387387
#ifdef CONFIG_HAVE_ARCH_USERFAULTFD_WP
388388
static inline int pte_uffd_wp(pte_t pte)
389389
{
390-
bool wp = pte_flags(pte) & _PAGE_UFFD_WP;
391-
392-
#ifdef CONFIG_DEBUG_VM
393-
/*
394-
* Having write bit for wr-protect-marked present ptes is fatal,
395-
* because it means the uffd-wp bit will be ignored and write will
396-
* just go through.
397-
*
398-
* Use any chance of pgtable walking to verify this (e.g., when
399-
* page swapped out or being migrated for all purposes). It means
400-
* something is already wrong. Tell the admin even before the
401-
* process crashes. We also nail it with wrong pgtable setup.
402-
*/
403-
WARN_ON_ONCE(wp && pte_write(pte));
404-
#endif
405-
406-
return wp;
390+
return pte_flags(pte) & _PAGE_UFFD_WP;
407391
}
408392

409393
static inline pte_t pte_mkuffd_wp(pte_t pte)

drivers/ata/libata-scsi.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -941,8 +941,19 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc)
941941
&sense_key, &asc, &ascq);
942942
ata_scsi_set_sense(qc->dev, cmd, sense_key, asc, ascq);
943943
} else {
944-
/* ATA PASS-THROUGH INFORMATION AVAILABLE */
945-
ata_scsi_set_sense(qc->dev, cmd, RECOVERED_ERROR, 0, 0x1D);
944+
/*
945+
* ATA PASS-THROUGH INFORMATION AVAILABLE
946+
*
947+
* Note: we are supposed to call ata_scsi_set_sense(), which
948+
* respects the D_SENSE bit, instead of unconditionally
949+
* generating the sense data in descriptor format. However,
950+
* because hdparm, hddtemp, and udisks incorrectly assume sense
951+
* data in descriptor format, without even looking at the
952+
* RESPONSE CODE field in the returned sense data (to see which
953+
* format the returned sense data is in), we are stuck with
954+
* being bug compatible with older kernels.
955+
*/
956+
scsi_build_sense(cmd, 1, RECOVERED_ERROR, 0, 0x1D);
946957
}
947958
}
948959

drivers/isdn/mISDN/socket.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,23 +401,23 @@ data_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
401401
}
402402

403403
static int data_sock_setsockopt(struct socket *sock, int level, int optname,
404-
sockptr_t optval, unsigned int len)
404+
sockptr_t optval, unsigned int optlen)
405405
{
406406
struct sock *sk = sock->sk;
407407
int err = 0, opt = 0;
408408

409409
if (*debug & DEBUG_SOCKET)
410410
printk(KERN_DEBUG "%s(%p, %d, %x, optval, %d)\n", __func__, sock,
411-
level, optname, len);
411+
level, optname, optlen);
412412

413413
lock_sock(sk);
414414

415415
switch (optname) {
416416
case MISDN_TIME_STAMP:
417-
if (copy_from_sockptr(&opt, optval, sizeof(int))) {
418-
err = -EFAULT;
417+
err = copy_safe_from_sockptr(&opt, sizeof(opt),
418+
optval, optlen);
419+
if (err)
419420
break;
420-
}
421421

422422
if (opt)
423423
_pms(sk)->cmask |= MISDN_TIME_STAMP;

drivers/media/usb/dvb-usb/dvb-usb-init.c

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,40 +23,11 @@ static int dvb_usb_force_pid_filter_usage;
2323
module_param_named(force_pid_filter_usage, dvb_usb_force_pid_filter_usage, int, 0444);
2424
MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a PID filter, if any (default: 0).");
2525

26-
static int dvb_usb_check_bulk_endpoint(struct dvb_usb_device *d, u8 endpoint)
27-
{
28-
if (endpoint) {
29-
int ret;
30-
31-
ret = usb_pipe_type_check(d->udev, usb_sndbulkpipe(d->udev, endpoint));
32-
if (ret)
33-
return ret;
34-
ret = usb_pipe_type_check(d->udev, usb_rcvbulkpipe(d->udev, endpoint));
35-
if (ret)
36-
return ret;
37-
}
38-
return 0;
39-
}
40-
41-
static void dvb_usb_clear_halt(struct dvb_usb_device *d, u8 endpoint)
42-
{
43-
if (endpoint) {
44-
usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, endpoint));
45-
usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, endpoint));
46-
}
47-
}
48-
4926
static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs)
5027
{
5128
struct dvb_usb_adapter *adap;
5229
int ret, n, o;
5330

54-
ret = dvb_usb_check_bulk_endpoint(d, d->props.generic_bulk_ctrl_endpoint);
55-
if (ret)
56-
return ret;
57-
ret = dvb_usb_check_bulk_endpoint(d, d->props.generic_bulk_ctrl_endpoint_response);
58-
if (ret)
59-
return ret;
6031
for (n = 0; n < d->props.num_adapters; n++) {
6132
adap = &d->adapter[n];
6233
adap->dev = d;
@@ -132,8 +103,10 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs)
132103
* when reloading the driver w/o replugging the device
133104
* sometimes a timeout occurs, this helps
134105
*/
135-
dvb_usb_clear_halt(d, d->props.generic_bulk_ctrl_endpoint);
136-
dvb_usb_clear_halt(d, d->props.generic_bulk_ctrl_endpoint_response);
106+
if (d->props.generic_bulk_ctrl_endpoint != 0) {
107+
usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
108+
usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint));
109+
}
137110

138111
return 0;
139112

drivers/net/ppp/pppoe.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,26 +1007,21 @@ static int pppoe_recvmsg(struct socket *sock, struct msghdr *m,
10071007
struct sk_buff *skb;
10081008
int error = 0;
10091009

1010-
if (sk->sk_state & PPPOX_BOUND) {
1011-
error = -EIO;
1012-
goto end;
1013-
}
1010+
if (sk->sk_state & PPPOX_BOUND)
1011+
return -EIO;
10141012

10151013
skb = skb_recv_datagram(sk, flags, &error);
1016-
if (error < 0)
1017-
goto end;
1014+
if (!skb)
1015+
return error;
10181016

1019-
if (skb) {
1020-
total_len = min_t(size_t, total_len, skb->len);
1021-
error = skb_copy_datagram_msg(skb, 0, m, total_len);
1022-
if (error == 0) {
1023-
consume_skb(skb);
1024-
return total_len;
1025-
}
1017+
total_len = min_t(size_t, total_len, skb->len);
1018+
error = skb_copy_datagram_msg(skb, 0, m, total_len);
1019+
if (error == 0) {
1020+
consume_skb(skb);
1021+
return total_len;
10261022
}
10271023

10281024
kfree_skb(skb);
1029-
end:
10301025
return error;
10311026
}
10321027

drivers/nvme/host/pci.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2931,6 +2931,13 @@ static unsigned long check_vendor_combination_bug(struct pci_dev *pdev)
29312931
return NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND;
29322932
}
29332933

2934+
/*
2935+
* NVMe SSD drops off the PCIe bus after system idle
2936+
* for 10 hours on a Lenovo N60z board.
2937+
*/
2938+
if (dmi_match(DMI_BOARD_NAME, "LXKT-ZXEG-N6"))
2939+
return NVME_QUIRK_NO_APST;
2940+
29342941
return 0;
29352942
}
29362943

fs/binfmt_flat.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@
7272

7373
#ifdef CONFIG_BINFMT_FLAT_NO_DATA_START_OFFSET
7474
#define DATA_START_OFFSET_WORDS (0)
75+
#define MAX_SHARED_LIBS_UPDATE (0)
7576
#else
7677
#define DATA_START_OFFSET_WORDS (MAX_SHARED_LIBS)
78+
#define MAX_SHARED_LIBS_UPDATE (MAX_SHARED_LIBS)
7779
#endif
7880

7981
struct lib_info {
@@ -880,7 +882,7 @@ static int load_flat_binary(struct linux_binprm *bprm)
880882
return res;
881883

882884
/* Update data segment pointers for all libraries */
883-
for (i = 0; i < MAX_SHARED_LIBS; i++) {
885+
for (i = 0; i < MAX_SHARED_LIBS_UPDATE; i++) {
884886
if (!libinfo.lib_list[i].loaded)
885887
continue;
886888
for (j = 0; j < MAX_SHARED_LIBS; j++) {

fs/buffer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,6 +2179,8 @@ static void __block_commit_write(struct folio *folio, size_t from, size_t to)
21792179
struct buffer_head *bh, *head;
21802180

21812181
bh = head = folio_buffers(folio);
2182+
if (!bh)
2183+
return;
21822184
blocksize = bh->b_size;
21832185

21842186
block_start = 0;

fs/cramfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ static void cramfs_kill_sb(struct super_block *sb)
495495
sb->s_mtd = NULL;
496496
} else if (IS_ENABLED(CONFIG_CRAMFS_BLOCKDEV) && sb->s_bdev) {
497497
sync_blockdev(sb->s_bdev);
498-
blkdev_put(sb->s_bdev, sb);
498+
bdev_release(sb->s_bdev_handle);
499499
}
500500
kfree(sbi);
501501
}

fs/erofs/decompressor.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,9 @@ static int z_erofs_lz4_decompress_mem(struct z_erofs_lz4_decompress_ctx *ctx,
248248
if (ret != rq->outputsize) {
249249
erofs_err(rq->sb, "failed to decompress %d in[%u, %u] out[%u]",
250250
ret, rq->inputsize, inputmargin, rq->outputsize);
251-
252-
print_hex_dump(KERN_DEBUG, "[ in]: ", DUMP_PREFIX_OFFSET,
253-
16, 1, src + inputmargin, rq->inputsize, true);
254-
print_hex_dump(KERN_DEBUG, "[out]: ", DUMP_PREFIX_OFFSET,
255-
16, 1, out, rq->outputsize, true);
256-
257251
if (ret >= 0)
258252
memset(out + ret, 0, rq->outputsize - ret);
259-
ret = -EIO;
253+
ret = -EFSCORRUPTED;
260254
} else {
261255
ret = 0;
262256
}

fs/exec.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1609,6 +1609,7 @@ static void bprm_fill_uid(struct linux_binprm *bprm, struct file *file)
16091609
unsigned int mode;
16101610
vfsuid_t vfsuid;
16111611
vfsgid_t vfsgid;
1612+
int err;
16121613

16131614
if (!mnt_may_suid(file->f_path.mnt))
16141615
return;
@@ -1625,12 +1626,17 @@ static void bprm_fill_uid(struct linux_binprm *bprm, struct file *file)
16251626
/* Be careful if suid/sgid is set */
16261627
inode_lock(inode);
16271628

1628-
/* reload atomically mode/uid/gid now that lock held */
1629+
/* Atomically reload and check mode/uid/gid now that lock held. */
16291630
mode = inode->i_mode;
16301631
vfsuid = i_uid_into_vfsuid(idmap, inode);
16311632
vfsgid = i_gid_into_vfsgid(idmap, inode);
1633+
err = inode_permission(idmap, inode, MAY_EXEC);
16321634
inode_unlock(inode);
16331635

1636+
/* Did the exec bit vanish out from under us? Give up. */
1637+
if (err)
1638+
return;
1639+
16341640
/* We ignore suid/sgid if there are no mappings for them in the ns */
16351641
if (!vfsuid_has_mapping(bprm->cred->user_ns, vfsuid) ||
16361642
!vfsgid_has_mapping(bprm->cred->user_ns, vfsgid))

fs/ext4/inode.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2966,23 +2966,29 @@ static int ext4_da_should_update_i_disksize(struct folio *folio,
29662966

29672967
static int ext4_da_do_write_end(struct address_space *mapping,
29682968
loff_t pos, unsigned len, unsigned copied,
2969-
struct page *page)
2969+
struct folio *folio)
29702970
{
29712971
struct inode *inode = mapping->host;
29722972
loff_t old_size = inode->i_size;
29732973
bool disksize_changed = false;
29742974
loff_t new_i_size;
29752975

2976+
if (unlikely(!folio_buffers(folio))) {
2977+
folio_unlock(folio);
2978+
folio_put(folio);
2979+
return -EIO;
2980+
}
29762981
/*
29772982
* block_write_end() will mark the inode as dirty with I_DIRTY_PAGES
29782983
* flag, which all that's needed to trigger page writeback.
29792984
*/
2980-
copied = block_write_end(NULL, mapping, pos, len, copied, page, NULL);
2985+
copied = block_write_end(NULL, mapping, pos, len, copied,
2986+
&folio->page, NULL);
29812987
new_i_size = pos + copied;
29822988

29832989
/*
2984-
* It's important to update i_size while still holding page lock,
2985-
* because page writeout could otherwise come in and zero beyond
2990+
* It's important to update i_size while still holding folio lock,
2991+
* because folio writeout could otherwise come in and zero beyond
29862992
* i_size.
29872993
*
29882994
* Since we are holding inode lock, we are sure i_disksize <=
@@ -3000,14 +3006,14 @@ static int ext4_da_do_write_end(struct address_space *mapping,
30003006

30013007
i_size_write(inode, new_i_size);
30023008
end = (new_i_size - 1) & (PAGE_SIZE - 1);
3003-
if (copied && ext4_da_should_update_i_disksize(page_folio(page), end)) {
3009+
if (copied && ext4_da_should_update_i_disksize(folio, end)) {
30043010
ext4_update_i_disksize(inode, new_i_size);
30053011
disksize_changed = true;
30063012
}
30073013
}
30083014

3009-
unlock_page(page);
3010-
put_page(page);
3015+
folio_unlock(folio);
3016+
folio_put(folio);
30113017

30123018
if (old_size < pos)
30133019
pagecache_isize_extended(inode, old_size, pos);
@@ -3046,10 +3052,10 @@ static int ext4_da_write_end(struct file *file,
30463052
return ext4_write_inline_data_end(inode, pos, len, copied,
30473053
folio);
30483054

3049-
if (unlikely(copied < len) && !PageUptodate(page))
3055+
if (unlikely(copied < len) && !folio_test_uptodate(folio))
30503056
copied = 0;
30513057

3052-
return ext4_da_do_write_end(mapping, pos, len, copied, &folio->page);
3058+
return ext4_da_do_write_end(mapping, pos, len, copied, folio);
30533059
}
30543060

30553061
/*

0 commit comments

Comments
 (0)