diff options
author | Mike Pagano <mpagano@gentoo.org> | 2022-06-25 15:44:50 -0400 |
---|---|---|
committer | Mike Pagano <mpagano@gentoo.org> | 2022-06-25 15:44:50 -0400 |
commit | 6e0d0b04ebaf8be6ef1adff3d563b4c16b465af0 (patch) | |
tree | 666beaa4a9e9804e5251429210f1292567e2e416 | |
parent | Linux patch 5.10.124 (diff) | |
download | linux-patches-6e0d0b04ebaf8be6ef1adff3d563b4c16b465af0.tar.gz linux-patches-6e0d0b04ebaf8be6ef1adff3d563b4c16b465af0.tar.bz2 linux-patches-6e0d0b04ebaf8be6ef1adff3d563b4c16b465af0.zip |
Linux patch 5.10.1255.10-134
Signed-off-by: Mike Pagano <mpagano@gentoo.org>
-rw-r--r-- | 0000_README | 4 | ||||
-rw-r--r-- | 1124_linux-5.10.125.patch | 493 |
2 files changed, 497 insertions, 0 deletions
diff --git a/0000_README b/0000_README index aedaaf1a..fb42ce16 100644 --- a/0000_README +++ b/0000_README @@ -539,6 +539,10 @@ Patch: 1123_linux-5.10.124.patch From: http://www.kernel.org Desc: Linux 5.10.124 +Patch: 1124_linux-5.10.125.patch +From: http://www.kernel.org +Desc: Linux 5.10.125 + Patch: 1500_XATTR_USER_PREFIX.patch From: https://bugs.gentoo.org/show_bug.cgi?id=470644 Desc: Support for namespace user.pax.* on tmpfs. diff --git a/1124_linux-5.10.125.patch b/1124_linux-5.10.125.patch new file mode 100644 index 00000000..0af8c810 --- /dev/null +++ b/1124_linux-5.10.125.patch @@ -0,0 +1,493 @@ +diff --git a/Makefile b/Makefile +index 9ed79a05a9725..da5b28931e5cb 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0 + VERSION = 5 + PATCHLEVEL = 10 +-SUBLEVEL = 124 ++SUBLEVEL = 125 + EXTRAVERSION = + NAME = Dare mighty things + +diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S +index 2d881f34dd9d5..7b8158ae36ecc 100644 +--- a/arch/arm64/mm/cache.S ++++ b/arch/arm64/mm/cache.S +@@ -228,8 +228,6 @@ SYM_FUNC_END_PI(__dma_flush_area) + * - dir - DMA direction + */ + SYM_FUNC_START_PI(__dma_map_area) +- cmp w2, #DMA_FROM_DEVICE +- b.eq __dma_inv_area + b __dma_clean_area + SYM_FUNC_END_PI(__dma_map_area) + +diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c +index fabaedddc90cb..1c05caf68e7d8 100644 +--- a/arch/s390/mm/pgtable.c ++++ b/arch/s390/mm/pgtable.c +@@ -734,7 +734,7 @@ void ptep_zap_key(struct mm_struct *mm, unsigned long addr, pte_t *ptep) + pgste_val(pgste) |= PGSTE_GR_BIT | PGSTE_GC_BIT; + ptev = pte_val(*ptep); + if (!(ptev & _PAGE_INVALID) && (ptev & _PAGE_WRITE)) +- page_set_storage_key(ptev & PAGE_MASK, PAGE_DEFAULT_KEY, 1); ++ page_set_storage_key(ptev & PAGE_MASK, PAGE_DEFAULT_KEY, 0); + pgste_set_unlock(ptep, pgste); + preempt_enable(); + } +diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c +index 19f0c5db11e33..32d09d024f6c9 100644 +--- a/drivers/tty/serial/serial_core.c ++++ b/drivers/tty/serial/serial_core.c +@@ -144,6 +144,11 @@ uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear) + unsigned long flags; + unsigned int old; + ++ if (port->rs485.flags & SER_RS485_ENABLED) { ++ set &= ~TIOCM_RTS; ++ clear &= ~TIOCM_RTS; ++ } ++ + spin_lock_irqsave(&port->lock, flags); + old = port->mctrl; + port->mctrl = (old & ~clear) | set; +@@ -157,23 +162,10 @@ uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear) + + static void uart_port_dtr_rts(struct uart_port *uport, int raise) + { +- int rs485_on = uport->rs485_config && +- (uport->rs485.flags & SER_RS485_ENABLED); +- int RTS_after_send = !!(uport->rs485.flags & SER_RS485_RTS_AFTER_SEND); +- +- if (raise) { +- if (rs485_on && RTS_after_send) { +- uart_set_mctrl(uport, TIOCM_DTR); +- uart_clear_mctrl(uport, TIOCM_RTS); +- } else { +- uart_set_mctrl(uport, TIOCM_DTR | TIOCM_RTS); +- } +- } else { +- unsigned int clear = TIOCM_DTR; +- +- clear |= (!rs485_on || RTS_after_send) ? TIOCM_RTS : 0; +- uart_clear_mctrl(uport, clear); +- } ++ if (raise) ++ uart_set_mctrl(uport, TIOCM_DTR | TIOCM_RTS); ++ else ++ uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS); + } + + /* +@@ -1116,11 +1108,6 @@ uart_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) + goto out; + + if (!tty_io_error(tty)) { +- if (uport->rs485.flags & SER_RS485_ENABLED) { +- set &= ~TIOCM_RTS; +- clear &= ~TIOCM_RTS; +- } +- + uart_update_mctrl(uport, set, clear); + ret = 0; + } +@@ -2429,6 +2416,9 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state, + */ + spin_lock_irqsave(&port->lock, flags); + port->mctrl &= TIOCM_DTR; ++ if (port->rs485.flags & SER_RS485_ENABLED && ++ !(port->rs485.flags & SER_RS485_RTS_AFTER_SEND)) ++ port->mctrl |= TIOCM_RTS; + port->ops->set_mctrl(port, port->mctrl); + spin_unlock_irqrestore(&port->lock, flags); + +diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c +index a40be8b448c24..64ef97ab9274a 100644 +--- a/drivers/usb/gadget/function/u_ether.c ++++ b/drivers/usb/gadget/function/u_ether.c +@@ -772,9 +772,13 @@ struct eth_dev *gether_setup_name(struct usb_gadget *g, + dev->qmult = qmult; + snprintf(net->name, sizeof(net->name), "%s%%d", netname); + +- if (get_ether_addr(dev_addr, net->dev_addr)) ++ if (get_ether_addr(dev_addr, net->dev_addr)) { ++ net->addr_assign_type = NET_ADDR_RANDOM; + dev_warn(&g->dev, + "using random %s ethernet address\n", "self"); ++ } else { ++ net->addr_assign_type = NET_ADDR_SET; ++ } + if (get_ether_addr(host_addr, dev->host_mac)) + dev_warn(&g->dev, + "using random %s ethernet address\n", "host"); +@@ -831,6 +835,9 @@ struct net_device *gether_setup_name_default(const char *netname) + INIT_LIST_HEAD(&dev->tx_reqs); + INIT_LIST_HEAD(&dev->rx_reqs); + ++ /* by default we always have a random MAC address */ ++ net->addr_assign_type = NET_ADDR_RANDOM; ++ + skb_queue_head_init(&dev->rx_frames); + + /* network device setup */ +@@ -868,7 +875,6 @@ int gether_register_netdev(struct net_device *net) + g = dev->gadget; + + memcpy(net->dev_addr, dev->dev_mac, ETH_ALEN); +- net->addr_assign_type = NET_ADDR_RANDOM; + + status = register_netdev(net); + if (status < 0) { +@@ -908,6 +914,7 @@ int gether_set_dev_addr(struct net_device *net, const char *dev_addr) + if (get_ether_addr(dev_addr, new_addr)) + return -EINVAL; + memcpy(dev->dev_mac, new_addr, ETH_ALEN); ++ net->addr_assign_type = NET_ADDR_SET; + return 0; + } + EXPORT_SYMBOL_GPL(gether_set_dev_addr); +diff --git a/fs/io_uring.c b/fs/io_uring.c +index 871475d3fca2c..40ac37beca47d 100644 +--- a/fs/io_uring.c ++++ b/fs/io_uring.c +@@ -773,7 +773,8 @@ static const struct io_op_def io_op_defs[] = { + .buffer_select = 1, + .needs_async_data = 1, + .async_size = sizeof(struct io_async_rw), +- .work_flags = IO_WQ_WORK_MM | IO_WQ_WORK_BLKCG, ++ .work_flags = IO_WQ_WORK_MM | IO_WQ_WORK_BLKCG | ++ IO_WQ_WORK_FILES, + }, + [IORING_OP_WRITEV] = { + .needs_file = 1, +@@ -783,7 +784,7 @@ static const struct io_op_def io_op_defs[] = { + .needs_async_data = 1, + .async_size = sizeof(struct io_async_rw), + .work_flags = IO_WQ_WORK_MM | IO_WQ_WORK_BLKCG | +- IO_WQ_WORK_FSIZE, ++ IO_WQ_WORK_FSIZE | IO_WQ_WORK_FILES, + }, + [IORING_OP_FSYNC] = { + .needs_file = 1, +@@ -794,7 +795,8 @@ static const struct io_op_def io_op_defs[] = { + .unbound_nonreg_file = 1, + .pollin = 1, + .async_size = sizeof(struct io_async_rw), +- .work_flags = IO_WQ_WORK_BLKCG | IO_WQ_WORK_MM, ++ .work_flags = IO_WQ_WORK_BLKCG | IO_WQ_WORK_MM | ++ IO_WQ_WORK_FILES, + }, + [IORING_OP_WRITE_FIXED] = { + .needs_file = 1, +@@ -803,7 +805,7 @@ static const struct io_op_def io_op_defs[] = { + .pollout = 1, + .async_size = sizeof(struct io_async_rw), + .work_flags = IO_WQ_WORK_BLKCG | IO_WQ_WORK_FSIZE | +- IO_WQ_WORK_MM, ++ IO_WQ_WORK_MM | IO_WQ_WORK_FILES, + }, + [IORING_OP_POLL_ADD] = { + .needs_file = 1, +@@ -857,7 +859,7 @@ static const struct io_op_def io_op_defs[] = { + .pollout = 1, + .needs_async_data = 1, + .async_size = sizeof(struct io_async_connect), +- .work_flags = IO_WQ_WORK_MM, ++ .work_flags = IO_WQ_WORK_MM | IO_WQ_WORK_FS, + }, + [IORING_OP_FALLOCATE] = { + .needs_file = 1, +@@ -885,7 +887,8 @@ static const struct io_op_def io_op_defs[] = { + .pollin = 1, + .buffer_select = 1, + .async_size = sizeof(struct io_async_rw), +- .work_flags = IO_WQ_WORK_MM | IO_WQ_WORK_BLKCG, ++ .work_flags = IO_WQ_WORK_MM | IO_WQ_WORK_BLKCG | ++ IO_WQ_WORK_FILES, + }, + [IORING_OP_WRITE] = { + .needs_file = 1, +@@ -894,7 +897,7 @@ static const struct io_op_def io_op_defs[] = { + .pollout = 1, + .async_size = sizeof(struct io_async_rw), + .work_flags = IO_WQ_WORK_MM | IO_WQ_WORK_BLKCG | +- IO_WQ_WORK_FSIZE, ++ IO_WQ_WORK_FSIZE | IO_WQ_WORK_FILES, + }, + [IORING_OP_FADVISE] = { + .needs_file = 1, +@@ -907,14 +910,16 @@ static const struct io_op_def io_op_defs[] = { + .needs_file = 1, + .unbound_nonreg_file = 1, + .pollout = 1, +- .work_flags = IO_WQ_WORK_MM | IO_WQ_WORK_BLKCG, ++ .work_flags = IO_WQ_WORK_MM | IO_WQ_WORK_BLKCG | ++ IO_WQ_WORK_FS, + }, + [IORING_OP_RECV] = { + .needs_file = 1, + .unbound_nonreg_file = 1, + .pollin = 1, + .buffer_select = 1, +- .work_flags = IO_WQ_WORK_MM | IO_WQ_WORK_BLKCG, ++ .work_flags = IO_WQ_WORK_MM | IO_WQ_WORK_BLKCG | ++ IO_WQ_WORK_FS, + }, + [IORING_OP_OPENAT2] = { + .work_flags = IO_WQ_WORK_FILES | IO_WQ_WORK_FS | +diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c +index 8c7d01e907a31..bf5cb6efb8c09 100644 +--- a/fs/zonefs/super.c ++++ b/fs/zonefs/super.c +@@ -68,15 +68,49 @@ static inline void zonefs_i_size_write(struct inode *inode, loff_t isize) + zi->i_flags &= ~ZONEFS_ZONE_OPEN; + } + +-static int zonefs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, +- unsigned int flags, struct iomap *iomap, +- struct iomap *srcmap) ++static int zonefs_read_iomap_begin(struct inode *inode, loff_t offset, ++ loff_t length, unsigned int flags, ++ struct iomap *iomap, struct iomap *srcmap) + { + struct zonefs_inode_info *zi = ZONEFS_I(inode); + struct super_block *sb = inode->i_sb; + loff_t isize; + +- /* All I/Os should always be within the file maximum size */ ++ /* ++ * All blocks are always mapped below EOF. If reading past EOF, ++ * act as if there is a hole up to the file maximum size. ++ */ ++ mutex_lock(&zi->i_truncate_mutex); ++ iomap->bdev = inode->i_sb->s_bdev; ++ iomap->offset = ALIGN_DOWN(offset, sb->s_blocksize); ++ isize = i_size_read(inode); ++ if (iomap->offset >= isize) { ++ iomap->type = IOMAP_HOLE; ++ iomap->addr = IOMAP_NULL_ADDR; ++ iomap->length = length; ++ } else { ++ iomap->type = IOMAP_MAPPED; ++ iomap->addr = (zi->i_zsector << SECTOR_SHIFT) + iomap->offset; ++ iomap->length = isize - iomap->offset; ++ } ++ mutex_unlock(&zi->i_truncate_mutex); ++ ++ return 0; ++} ++ ++static const struct iomap_ops zonefs_read_iomap_ops = { ++ .iomap_begin = zonefs_read_iomap_begin, ++}; ++ ++static int zonefs_write_iomap_begin(struct inode *inode, loff_t offset, ++ loff_t length, unsigned int flags, ++ struct iomap *iomap, struct iomap *srcmap) ++{ ++ struct zonefs_inode_info *zi = ZONEFS_I(inode); ++ struct super_block *sb = inode->i_sb; ++ loff_t isize; ++ ++ /* All write I/Os should always be within the file maximum size */ + if (WARN_ON_ONCE(offset + length > zi->i_max_size)) + return -EIO; + +@@ -86,7 +120,7 @@ static int zonefs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, + * operation. + */ + if (WARN_ON_ONCE(zi->i_ztype == ZONEFS_ZTYPE_SEQ && +- (flags & IOMAP_WRITE) && !(flags & IOMAP_DIRECT))) ++ !(flags & IOMAP_DIRECT))) + return -EIO; + + /* +@@ -95,45 +129,42 @@ static int zonefs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, + * write pointer) and unwriten beyond. + */ + mutex_lock(&zi->i_truncate_mutex); ++ iomap->bdev = inode->i_sb->s_bdev; ++ iomap->offset = ALIGN_DOWN(offset, sb->s_blocksize); ++ iomap->addr = (zi->i_zsector << SECTOR_SHIFT) + iomap->offset; + isize = i_size_read(inode); +- if (offset >= isize) ++ if (iomap->offset >= isize) { + iomap->type = IOMAP_UNWRITTEN; +- else ++ iomap->length = zi->i_max_size - iomap->offset; ++ } else { + iomap->type = IOMAP_MAPPED; +- if (flags & IOMAP_WRITE) +- length = zi->i_max_size - offset; +- else +- length = min(length, isize - offset); ++ iomap->length = isize - iomap->offset; ++ } + mutex_unlock(&zi->i_truncate_mutex); + +- iomap->offset = ALIGN_DOWN(offset, sb->s_blocksize); +- iomap->length = ALIGN(offset + length, sb->s_blocksize) - iomap->offset; +- iomap->bdev = inode->i_sb->s_bdev; +- iomap->addr = (zi->i_zsector << SECTOR_SHIFT) + iomap->offset; +- + return 0; + } + +-static const struct iomap_ops zonefs_iomap_ops = { +- .iomap_begin = zonefs_iomap_begin, ++static const struct iomap_ops zonefs_write_iomap_ops = { ++ .iomap_begin = zonefs_write_iomap_begin, + }; + + static int zonefs_readpage(struct file *unused, struct page *page) + { +- return iomap_readpage(page, &zonefs_iomap_ops); ++ return iomap_readpage(page, &zonefs_read_iomap_ops); + } + + static void zonefs_readahead(struct readahead_control *rac) + { +- iomap_readahead(rac, &zonefs_iomap_ops); ++ iomap_readahead(rac, &zonefs_read_iomap_ops); + } + + /* + * Map blocks for page writeback. This is used only on conventional zone files, + * which implies that the page range can only be within the fixed inode size. + */ +-static int zonefs_map_blocks(struct iomap_writepage_ctx *wpc, +- struct inode *inode, loff_t offset) ++static int zonefs_write_map_blocks(struct iomap_writepage_ctx *wpc, ++ struct inode *inode, loff_t offset) + { + struct zonefs_inode_info *zi = ZONEFS_I(inode); + +@@ -147,12 +178,12 @@ static int zonefs_map_blocks(struct iomap_writepage_ctx *wpc, + offset < wpc->iomap.offset + wpc->iomap.length) + return 0; + +- return zonefs_iomap_begin(inode, offset, zi->i_max_size - offset, +- IOMAP_WRITE, &wpc->iomap, NULL); ++ return zonefs_write_iomap_begin(inode, offset, zi->i_max_size - offset, ++ IOMAP_WRITE, &wpc->iomap, NULL); + } + + static const struct iomap_writeback_ops zonefs_writeback_ops = { +- .map_blocks = zonefs_map_blocks, ++ .map_blocks = zonefs_write_map_blocks, + }; + + static int zonefs_writepage(struct page *page, struct writeback_control *wbc) +@@ -182,7 +213,8 @@ static int zonefs_swap_activate(struct swap_info_struct *sis, + return -EINVAL; + } + +- return iomap_swapfile_activate(sis, swap_file, span, &zonefs_iomap_ops); ++ return iomap_swapfile_activate(sis, swap_file, span, ++ &zonefs_read_iomap_ops); + } + + static const struct address_space_operations zonefs_file_aops = { +@@ -612,7 +644,7 @@ static vm_fault_t zonefs_filemap_page_mkwrite(struct vm_fault *vmf) + + /* Serialize against truncates */ + down_read(&zi->i_mmap_sem); +- ret = iomap_page_mkwrite(vmf, &zonefs_iomap_ops); ++ ret = iomap_page_mkwrite(vmf, &zonefs_write_iomap_ops); + up_read(&zi->i_mmap_sem); + + sb_end_pagefault(inode->i_sb); +@@ -869,7 +901,7 @@ static ssize_t zonefs_file_dio_write(struct kiocb *iocb, struct iov_iter *from) + if (append) + ret = zonefs_file_dio_append(iocb, from); + else +- ret = iomap_dio_rw(iocb, from, &zonefs_iomap_ops, ++ ret = iomap_dio_rw(iocb, from, &zonefs_write_iomap_ops, + &zonefs_write_dio_ops, sync); + if (zi->i_ztype == ZONEFS_ZTYPE_SEQ && + (ret > 0 || ret == -EIOCBQUEUED)) { +@@ -911,7 +943,7 @@ static ssize_t zonefs_file_buffered_write(struct kiocb *iocb, + if (ret <= 0) + goto inode_unlock; + +- ret = iomap_file_buffered_write(iocb, from, &zonefs_iomap_ops); ++ ret = iomap_file_buffered_write(iocb, from, &zonefs_write_iomap_ops); + if (ret > 0) + iocb->ki_pos += ret; + else if (ret == -EIO) +@@ -1004,7 +1036,7 @@ static ssize_t zonefs_file_read_iter(struct kiocb *iocb, struct iov_iter *to) + goto inode_unlock; + } + file_accessed(iocb->ki_filp); +- ret = iomap_dio_rw(iocb, to, &zonefs_iomap_ops, ++ ret = iomap_dio_rw(iocb, to, &zonefs_read_iomap_ops, + &zonefs_read_dio_ops, is_sync_kiocb(iocb)); + } else { + ret = generic_file_read_iter(iocb, to); +diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c +index 44b524136f953..f38b71cc3edbe 100644 +--- a/net/ipv4/inet_hashtables.c ++++ b/net/ipv4/inet_hashtables.c +@@ -726,12 +726,14 @@ EXPORT_SYMBOL_GPL(inet_unhash); + * Note that we use 32bit integers (vs RFC 'short integers') + * because 2^16 is not a multiple of num_ephemeral and this + * property might be used by clever attacker. +- * RFC claims using TABLE_LENGTH=10 buckets gives an improvement, +- * we use 256 instead to really give more isolation and +- * privacy, this only consumes 1 KB of kernel memory. ++ * RFC claims using TABLE_LENGTH=10 buckets gives an improvement, though ++ * attacks were since demonstrated, thus we use 65536 instead to really ++ * give more isolation and privacy, at the expense of 256kB of kernel ++ * memory. + */ +-#define INET_TABLE_PERTURB_SHIFT 8 +-static u32 table_perturb[1 << INET_TABLE_PERTURB_SHIFT]; ++#define INET_TABLE_PERTURB_SHIFT 16 ++#define INET_TABLE_PERTURB_SIZE (1 << INET_TABLE_PERTURB_SHIFT) ++static u32 *table_perturb; + + int __inet_hash_connect(struct inet_timewait_death_row *death_row, + struct sock *sk, u64 port_offset, +@@ -774,10 +776,11 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row, + if (likely(remaining > 1)) + remaining &= ~1U; + +- net_get_random_once(table_perturb, sizeof(table_perturb)); +- index = hash_32(port_offset, INET_TABLE_PERTURB_SHIFT); ++ net_get_random_once(table_perturb, ++ INET_TABLE_PERTURB_SIZE * sizeof(*table_perturb)); ++ index = port_offset & (INET_TABLE_PERTURB_SIZE - 1); + +- offset = READ_ONCE(table_perturb[index]) + port_offset; ++ offset = READ_ONCE(table_perturb[index]) + (port_offset >> 32); + offset %= remaining; + + /* In first pass we try ports of @low parity. +@@ -833,6 +836,12 @@ next_port: + return -EADDRNOTAVAIL; + + ok: ++ /* Here we want to add a little bit of randomness to the next source ++ * port that will be chosen. We use a max() with a random here so that ++ * on low contention the randomness is maximal and on high contention ++ * it may be inexistent. ++ */ ++ i = max_t(int, i, (prandom_u32() & 7) * 2); + WRITE_ONCE(table_perturb[index], READ_ONCE(table_perturb[index]) + i + 2); + + /* Head lock still held and bh's disabled */ +@@ -906,6 +915,12 @@ void __init inet_hashinfo2_init(struct inet_hashinfo *h, const char *name, + low_limit, + high_limit); + init_hashinfo_lhash2(h); ++ ++ /* this one is used for source ports of outgoing connections */ ++ table_perturb = kmalloc_array(INET_TABLE_PERTURB_SIZE, ++ sizeof(*table_perturb), GFP_KERNEL); ++ if (!table_perturb) ++ panic("TCP: failed to alloc table_perturb"); + } + + int inet_hashinfo2_init_mod(struct inet_hashinfo *h) |