5.12.10-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 125/161 pid: take a reference when initializing `cad_pid`
In reply to Greg Kroah-HartmanFrom: Mark Rutland <[email protected]>
commit 0711f0d7050b9e07c44bc159bbc64ac0a1022c7f upstream.
During boot, kernel_init_freeable() initializes cad_pid to the init task's struct pid. Later on, we may change cad_pid via a sysctl, and when this happens proc_do_cad_pid() will increment the refcount on the new pid via get_pid(), and will decrement the refcount on the old pid via put_pid(). As we never called get_pid() when we initialized cad_pid, we decrement a reference we never incremented, can therefore free the init task's struct pid early. As there can be dangling references to the struct pid, we can later encounter a use-after-free (e.g. when delivering signals).
This was spotted when fuzzing v5.13-rc3 with Syzkaller, but seems to have been around since the conversion of cad_pid to struct pid in commit 9ec52099e4b8 ("[PATCH] replace cad_pid by a struct pid") from the pre-KASAN stone age of v2.6.19.
Fix this by getting a reference to the init task's struct pid when we assign it to cad_pid.
Full KASAN splat below.
==================================================================
BUG: KASAN: use-after-free in ns_of_pid include/linux/pid.h:153 [inline]
BUG: KASAN: use-after-free in task_active_pid_ns+0xc0/0xc8 kernel/pid.c:509
Read of size 4 at addr ffff23794dda0004 by task syz-executor.0/273
CPU: 1 PID: 273 Comm: syz-executor.0 Not tainted 5.12.0-00001-g9aef892b2d15 #1
Hardware name: linux,dummy-virt (DT)
Call trace:
ns_of_pid include/linux/pid.h:153 [inline]
task_active_pid_ns+0xc0/0xc8 kernel/pid.c:509
do_notify_parent+0x308/0xe60 kernel/signal.c:1950
exit_notify kernel/exit.c:682 [inline]
do_exit+0x2334/0x2bd0 kernel/exit.c:845
do_group_exit+0x108/0x2c8 kernel/exit.c:922
get_signal+0x4e4/0x2a88 kernel/signal.c:2781
do_signal arch/arm64/kernel/signal.c:882 [inline]
do_notify_resume+0x300/0x970 arch/arm64/kernel/signal.c:936
work_pending+0xc/0x2dc
Allocated by task 0:
slab_post_alloc_hook+0x50/0x5c0 mm/slab.h:516
slab_alloc_node mm/slub.c:2907 [inline]
slab_alloc mm/slub.c:2915 [inline]
kmem_cache_alloc+0x1f4/0x4c0 mm/slub.c:2920
alloc_pid+0xdc/0xc00 kernel/pid.c:180
copy_process+0x2794/0x5e18 kernel/fork.c:2129
kernel_clone+0x194/0x13c8 kernel/fork.c:2500
kernel_thread+0xd4/0x110 kernel/fork.c:2552
rest_init+0x44/0x4a0 init/main.c:687
arch_call_rest_init+0x1c/0x28
start_kernel+0x520/0x554 init/main.c:1064
0x0
Freed by task 270:
slab_free_hook mm/slub.c:1562 [inline]
slab_free_freelist_hook+0x98/0x260 mm/slub.c:1600
slab_free mm/slub.c:3161 [inline]
kmem_cache_free+0x224/0x8e0 mm/slub.c:3177
put_pid.part.4+0xe0/0x1a8 kernel/pid.c:114
put_pid+0x30/0x48 kernel/pid.c:109
proc_do_cad_pid+0x190/0x1b0 kernel/sysctl.c:1401
proc_sys_call_handler+0x338/0x4b0 fs/proc/proc_sysctl.c:591
proc_sys_write+0x34/0x48 fs/proc/proc_sysctl.c:617
call_write_iter include/linux/fs.h:1977 [inline]
new_sync_write+0x3ac/0x510 fs/read_write.c:518
vfs_write fs/read_write.c:605 [inline]
vfs_write+0x9c4/0x1018 fs/read_write.c:585
ksys_write+0x124/0x240 fs/read_write.c:658
__do_sys_write fs/read_write.c:670 [inline]
__se_sys_write fs/read_write.c:667 [inline]
__arm64_sys_write+0x78/0xb0 fs/read_write.c:667
__invoke_syscall arch/arm64/kernel/syscall.c:37 [inline]
invoke_syscall arch/arm64/kernel/syscall.c:49 [inline]
el0_svc_common.constprop.1+0x16c/0x388 arch/arm64/kernel/syscall.c:129
do_el0_svc+0xf8/0x150 arch/arm64/kernel/syscall.c:168
el0_svc+0x28/0x38 arch/arm64/kernel/entry-common.c:416
el0_sync_handler+0x134/0x180 arch/arm64/kernel/entry-common.c:432
el0_sync+0x154/0x180 arch/arm64/kernel/entry.S:701
The buggy address belongs to the object at ffff23794dda0000
which belongs to the cache pid of size 224
The buggy address is located 4 bytes inside of
224-byte region [ffff23794dda0000, ffff23794dda00e0)
The buggy address belongs to the page:
page:(____ptrval____) refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4dda0
head:(____ptrval____) order:1 compound_mapcount:0
flags: 0x3fffc0000010200(slab|head)
raw: 03fffc0000010200 dead000000000100 dead000000000122 ffff23794d40d080
raw: 0000000000000000 0000000000190019 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff23794dd9ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff23794dd9ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff23794dda0000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff23794dda0080: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
ffff23794dda0100: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
==================================================================--- init/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
init/main.c +1 -1
@@ -1514,7 +1514,7 @@ static noinline void __init kernel_init_*/ set_mems_allowed (node_states[N_MEMORY ]); - cad_pid =task_pid (current); + cad_pid =get_pid (task_pid (current));smp_prepare_cpus (setup_max_cpus);
Greg Kroah-Hartman
maintainerPATCH 126/161 ocfs2: fix data corruption by fallocate
In reply to Greg Kroah-HartmanFrom: Junxiao Bi <[email protected]>
commit 6bba4471f0cc1296fe3c2089b9e52442d3074b2e upstream.
When fallocate punches holes out of inode size, if original isize is in the middle of last cluster, then the part from isize to the end of the cluster will be zeroed with buffer write, at that time isize is not yet updated to match the new size, if writeback is kicked in, it will invoke ocfs2_writepage()->block_write_full_page() where the pages out of inode size will be dropped. That will cause file corruption. Fix this by zero out eof blocks when extending the inode size.
Running the following command with qemu-image 4.2.1 can get a corrupted coverted image file easily.
qemu-img convert -p -t none -T none -f qcow2 $qcow_image \
-O qcow2 -o compat=1.1 $qcow_image.convThe usage of fallocate in qemu is like this, it first punches holes out of inode size, then extend the inode size.
fallocate(11, FALLOC_FL_KEEP_SIZE|FALLOC_FL_PUNCH_HOLE, 2276196352, 65536) = 0
fallocate(11, 0, 2276196352, 65536) = 0v1: https://www.spinics.net/lists/linux-fsdevel/msg193999.html
v2: https://lore.kernel.org/linux-fsdevel/[email protected]/T/
--- fs/ocfs2/file.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 5 deletions(-)
fs/ocfs2/file.c +50 -5
@@ -1858,6 +1858,45 @@ out: }/* +* zero out partial blocks of one cluster. +* +* start: file offset where zero starts, will be made upper block aligned. +* len: it will be trimmed to the end of current cluster if "start + len" +* is bigger than it. +*/ +static int ocfs2_zeroout_partial_cluster (struct inode *inode, +u64 start,u64 len) +{ +int ret; +u64 start_block, end_block, nr_blocks; +u64 p_block, offset; +u32 cluster, p_cluster, nr_clusters; +struct super_block *sb = inode->i_sb; +u64 end =ocfs2_align_bytes_to_clusters (sb, start); + +if (start + len < end) + end = start + len; + + start_block =ocfs2_blocks_for_bytes (sb, start); + end_block =ocfs2_blocks_for_bytes (sb, end); + nr_blocks = end_block - start_block; +if (!nr_blocks) +return 0 ; + + cluster =ocfs2_bytes_to_clusters (sb, start); + ret =ocfs2_get_clusters (inode, cluster, &p_cluster, + &nr_clusters,NULL ); +if (ret) +return ret; +if (!p_cluster) +return 0 ; + + offset = start_block -ocfs2_clusters_to_blocks (sb, cluster); + p_block =ocfs2_clusters_to_blocks (sb, p_cluster) + offset; +return sb_issue_zeroout (sb, p_block, nr_blocks,GFP_NOFS ); +} + +/* * Parts of this function taken from xfs_change_file_space() */ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
@@ -1867,7 +1906,7 @@ static int __ocfs2_change_file_space(str {int ret;s64 llen; -loff_t size; +loff_t size, orig_isize;struct ocfs2_super *osb =OCFS2_SB (inode->i_sb);struct buffer_head *di_bh =NULL ;handle_t *handle;
@@ -1898,6 +1937,7 @@ static int __ocfs2_change_file_space(str goto out_inode_unlock; } + orig_isize =i_size_read (inode);switch (sr->l_whence) {case 0 :/*SEEK_SET*/ break ;
@@ -1905,7 +1945,7 @@ static int __ocfs2_change_file_space(str sr->l_start += f_pos;break ;case 2 :/*SEEK_END*/ - sr->l_start +=i_size_read (inode); + sr->l_start += orig_isize;break ;default : ret = -EINVAL ;
@@ -1959,6 +1999,14 @@ static int __ocfs2_change_file_space(strdefault : ret = -EINVAL ; } + +/* zeroout eof blocks in the cluster. */ +if (!ret && change_size && orig_isize < size) { + ret =ocfs2_zeroout_partial_cluster (inode, orig_isize, + size - orig_isize); +if (!ret) +i_size_write (inode, size); + }up_write (&OCFS2_I (inode)->ip_alloc_sem);if (ret) {mlog_errno (ret);
@@ -1975,9 +2023,6 @@ static int __ocfs2_change_file_space(str goto out_inode_unlock; } -if (change_size &&i_size_read (inode) < size) -i_size_write (inode, size); - inode->i_ctime = inode->i_mtime =current_time (inode); ret =ocfs2_mark_inode_dirty (handle, inode, di_bh);if (ret <0 )
Greg Kroah-Hartman
maintainerPATCH 127/161 mm/debug_vm_pgtable: fix alignment for pmd/pud_advanced_tests()
In reply to Greg Kroah-HartmanFrom: Gerald Schaefer <[email protected]>
commit 04f7ce3f07ce39b1a3ca03a56b238a53acc52cfd upstream.
In pmd/pud_advanced_tests(), the vaddr is aligned up to the next pmd/pud entry, and so it does not match the given pmdp/pudp and (aligned down) pfn any more.
For s390, this results in memory corruption, because the IDTE instruction used e.g. in xxx_get_and_clear() will take the vaddr for some calculations, in combination with the given pmdp. It will then end up with a wrong table origin, ending on ...ff8, and some of those wrongly set low-order bits will also select a wrong pagetable level for the index addition. IDTE could therefore invalidate (or 0x20) something outside of the page tables, depending on the wrongly picked index, which in turn depends on the random vaddr.
As result, we sometimes see "BUG task_struct (Not tainted): Padding overwritten" on s390, where one 0x5a padding value got overwritten with 0x7a.
Fix this by aligning down, similar to how the pmd/pud_aligned pfns are calculated.
--- mm/debug_vm_pgtable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/debug_vm_pgtable.c +2 -2
@@ -192,7 +192,7 @@ static void __init pmd_advanced_tests(stpr_debug ("Validating PMD advanced\n" );/* Align the address wrt HPAGE_PMD_SIZE */ - vaddr = (vaddr &HPAGE_PMD_MASK ) +HPAGE_PMD_SIZE ; + vaddr &=HPAGE_PMD_MASK ;pgtable_trans_huge_deposit (mm, pmdp, pgtable);
@@ -330,7 +330,7 @@ static void __init pud_advanced_tests(stpr_debug ("Validating PUD advanced\n" );/* Align the address wrt HPAGE_PUD_SIZE */ - vaddr = (vaddr &HPAGE_PUD_MASK ) +HPAGE_PUD_SIZE ; + vaddr &=HPAGE_PUD_MASK ;set_pud_at (mm, vaddr, pudp, pud);pudp_set_wrprotect (mm, vaddr, pudp);
Greg Kroah-Hartman
maintainerPATCH 154/161 KVM: arm64: Commit pending PC adjustemnts before returning to userspace
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
commit 26778aaa134a9aefdf5dbaad904054d7be9d656d upstream.
KVM currently updates PC (and the corresponding exception state) using a two phase approach: first by setting a set of flags, then by converting these flags into a state update when the vcpu is about to enter the guest.
However, this creates a disconnect with userspace if the vcpu thread returns there with any exception/PC flag set. In this case, the exposed context is wrong, as userspace doesn't have access to these flags (they aren't architectural). It also means that these flags are preserved across a reset, which isn't expected.
To solve this problem, force an explicit synchronisation of the exception state on vcpu exit to userspace. As an optimisation for nVHE systems, only perform this when there is something pending.
[yuz: stable-5.12.y backport: allocate a new number (15) for
__KVM_HOST_SMCCC_FUNC___kvm_adjust_pc to keep the host_hcall array tightly packed]
--- arch/arm64/include/asm/kvm_asm.h | 1 + arch/arm64/kvm/arm.c | 11 +++++++++++ arch/arm64/kvm/hyp/exception.c | 4 ++-- arch/arm64/kvm/hyp/nvhe/hyp-main.c | 8 ++++++++ 4 files changed, 22 insertions(+), 2 deletions(-)
arch/arm64/include/asm/kvm_asm.h +1 -0
@@ -57,6 +57,7 @@#define __KVM_HOST_SMCCC_FUNC___kvm_get_mdcr_el2 12#define __KVM_HOST_SMCCC_FUNC___vgic_v3_save_aprs 13#define __KVM_HOST_SMCCC_FUNC___vgic_v3_restore_aprs 14 +#define __KVM_HOST_SMCCC_FUNC___kvm_adjust_pc 15#ifndef __ASSEMBLY__
arch/arm64/kvm/arm.c +11 -0
@@ -892,6 +892,17 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vkvm_sigset_deactivate (vcpu); +/* +* In the unlikely event that we are returning to userspace +* with pending exceptions or PC adjustment, commit these +* adjustments in order to give userspace a consistent view of +* the vcpu state. Note that this relies on __kvm_adjust_pc() +* being preempt-safe on VHE. +*/ +if (unlikely (vcpu->arch.flags & (KVM_ARM64_PENDING_EXCEPTION | +KVM_ARM64_INCREMENT_PC ))) +kvm_call_hyp (__kvm_adjust_pc, vcpu); +vcpu_put (vcpu);return ret; }
arch/arm64/kvm/hyp/exception.c +2 -2
@@ -331,8 +331,8 @@ static void kvm_inject_exception(struct }/* -* Adjust the guest PC on entry, depending on flags provided by EL1 -* for the purpose of emulation (MMIO, sysreg) or exception injection. +* Adjust the guest PC (and potentially exception state) depending on +* flags provided by the emulation code. */ void __kvm_adjust_pc (struct kvm_vcpu *vcpu) {
arch/arm64/kvm/hyp/nvhe/hyp-main.c +8 -0
@@ -25,6 +25,13 @@ static void handle___kvm_vcpu_run(structcpu_reg (host_ctxt,1 ) =__kvm_vcpu_run (kern_hyp_va (vcpu)); } +static void handle___kvm_adjust_pc (struct kvm_cpu_context *host_ctxt) +{ + DECLARE_REG(struct kvm_vcpu *, vcpu, host_ctxt, 1); + +__kvm_adjust_pc (kern_hyp_va (vcpu)); +} +static void handle___kvm_flush_vm_context (struct kvm_cpu_context *host_ctxt) {__kvm_flush_vm_context ();
@@ -112,6 +119,7 @@ typedef void (*hcall_t)(struct kvm_cpu_cstatic const hcall_t host_hcall[] = {HANDLE_FUNC (__kvm_vcpu_run), +HANDLE_FUNC (__kvm_adjust_pc),HANDLE_FUNC (__kvm_flush_vm_context),HANDLE_FUNC (__kvm_tlb_flush_vmid_ipa),HANDLE_FUNC (__kvm_tlb_flush_vmid),
Greg Kroah-Hartman
maintainerPATCH 157/161 i2c: qcom-geni: Suspend and resume the bus during SYSTEM_SLEEP_PM ops
In reply to Greg Kroah-HartmanFrom: Roja Rani Yarubandi <[email protected]>
commit 57648e860485de39c800a89f849fdd03c2d31d15 upstream.
Mark bus as suspended during system suspend to block the future transfers. Implement geni_i2c_resume_noirq() to resume the bus.
--- drivers/i2c/busses/i2c-qcom-geni.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-qcom-geni.c +11 -1
@@ -698,6 +698,8 @@ static int __maybe_unused geni_i2c_suspe {struct geni_i2c_dev *gi2c =dev_get_drvdata (dev); +i2c_mark_adapter_suspended (&gi2c->adap); +if (!gi2c->suspended) {geni_i2c_runtime_suspend (dev);pm_runtime_disable (dev);
@@ -707,8 +709,16 @@ static int __maybe_unused geni_i2c_suspereturn 0 ; } +static int __maybe_unused geni_i2c_resume_noirq (struct device *dev) +{ +struct geni_i2c_dev *gi2c =dev_get_drvdata (dev); + +i2c_mark_adapter_resumed (&gi2c->adap); +return 0 ; +} +static const struct dev_pm_ops geni_i2c_pm_ops = { - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(geni_i2c_suspend_noirq, NULL) + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(geni_i2c_suspend_noirq, geni_i2c_resume_noirq)SET_RUNTIME_PM_OPS (geni_i2c_runtime_suspend, geni_i2c_runtime_resume,NULL ) };
Greg Kroah-Hartman
maintainerPATCH 128/161 mm/page_alloc: fix counting of free pages after take off from buddy
In reply to Greg Kroah-HartmanFrom: Ding Hui <[email protected]>
commit bac9c6fa1f929213bbd0ac9cdf21e8e2f0916828 upstream.
Recently we found that there is a lot MemFree left in /proc/meminfo after do a lot of pages soft offline, it's not quite correct.
Before Oscar's rework of soft offline for free pages [1], if we soft offline free pages, these pages are left in buddy with HWPoison flag, and NR_FREE_PAGES is not updated immediately. So the difference between NR_FREE_PAGES and real number of available free pages is also even big at the beginning.
However, with the workload running, when we catch HWPoison page in any alloc functions subsequently, we will remove it from buddy, meanwhile update the NR_FREE_PAGES and try again, so the NR_FREE_PAGES will get more and more closer to the real number of available free pages. (regardless of unpoison_memory())
Now, for offline free pages, after a successful call take_page_off_buddy(), the page is no longer belong to buddy allocator, and will not be used any more, but we missed accounting NR_FREE_PAGES in this situation, and there is no chance to be updated later.
Do update in take_page_off_buddy() like rmqueue() does, but avoid double counting if some one already set_migratetype_isolate() on the page.
[1]: commit 06be6ff3d2ec ("mm,hwpoison: rework soft offline for free pages")
--- mm/page_alloc.c | 2 ++ 1 file changed, 2 insertions(+)
mm/page_alloc.c +2 -0
@@ -8951,6 +8951,8 @@ bool take_page_off_buddy(struct page *padel_page_from_free_list (page_head, zone, page_order);break_down_buddy_pages (zone, page_head, page,0 , page_order, migratetype); +if (!is_migrate_isolate (migratetype)) +__mod_zone_freepage_state (zone,-1 , migratetype); ret = true;break ; }
Greg Kroah-Hartman
maintainerPATCH 156/161 ARM: OMAP1: isp1301-omap: Add missing gpiod_add_lookup_table function
In reply to Greg Kroah-HartmanFrom: Maciej Falkowski <[email protected]>
commit 7c302314f37b44595f180198fca5ca646bce4a5f upstream.
The gpiod table was added without any usage making it unused as reported by Clang compilation from omap1_defconfig on linux-next:
arch/arm/mach-omap1/board-h2.c:347:34: warning: unused variable 'isp1301_gpiod_table' [-Wunused-variable]
static struct gpiod_lookup_table isp1301_gpiod_table = {
^1 warning generated.
The patch adds the missing gpiod_add_lookup_table() function.
--- arch/arm/mach-omap1/board-h2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-omap1/board-h2.c +3 -1
@@ -320,7 +320,7 @@ static int tps_setup(struct i2c_client * {if (!IS_BUILTIN (CONFIG_TPS65010 ))return -ENOSYS ; - +tps65010_config_vregs1 (TPS_LDO2_ENABLE |TPS_VLDO2_3_0V |TPS_LDO1_ENABLE |TPS_VLDO1_3_0V );
@@ -394,6 +394,8 @@ static void __init h2_init(void)BUG_ON (gpio_request (H2_NAND_RB_GPIO_PIN ,"NAND ready" ) <0 );gpio_direction_input (H2_NAND_RB_GPIO_PIN ); +gpiod_add_lookup_table (&isp1301_gpiod_table); +omap_cfg_reg (L3_1610_FLASH_CS2B_OE );omap_cfg_reg (M8_1610_FLASH_CS2B_WE );
Greg Kroah-Hartman
maintainerPATCH 158/161 x86/fault: Dont send SIGSEGV twice on SEGV_PKUERR
In reply to Greg Kroah-HartmanFrom: Jiashuo Liang <[email protected]>
commit 5405b42c2f08efe67b531799ba2fdb35bac93e70 upstream.
__bad_area_nosemaphore() calls both force_sig_pkuerr() and force_sig_fault() when handling SEGV_PKUERR. This does not cause problems because the second signal is filtered by the legacy_queue() check in __send_signal() because in both cases, the signal is SIGSEGV, the second one seeing that the first one is already pending.
This causes the kernel to do unnecessary work so send the signal only once for SEGV_PKUERR.
[ bp: Massage commit message. ]
--- arch/x86/mm/fault.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/fault.c +2 -2
@@ -836,8 +836,8 @@ __bad_area_nosemaphore(struct pt_regs *rif (si_code ==SEGV_PKUERR )force_sig_pkuerr ((void __user *)address, pkey); - -force_sig_fault (SIGSEGV , si_code, (void __user *)address); +else +force_sig_fault (SIGSEGV , si_code, (void __user *)address);local_irq_disable (); }
Greg Kroah-Hartman
maintainerPATCH 159/161 netfilter: nf_tables: missing error reporting for not selected expressions
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
commit c781471d67a56d7d4c113669a11ede0463b5c719 upstream.
Sometimes users forget to turn on nftables extensions from Kconfig that they need. In such case, the error reporting from userspace is misleading:
$ sudo nft add rule x y counter Error: Could not process rule: No such file or directory add rule x y counter ^^^^^^^^^^^^^^^^^^^^
Add missing NL_SET_BAD_ATTR() to provide a hint:
$ nft add rule x y counter
Error: Could not process rule: No such file or directory
add rule x y counter
^^^^^^^--- net/netfilter/nf_tables_api.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +3 -1
@@ -3288,8 +3288,10 @@ static int nf_tables_newrule(struct netif (n ==NFT_RULE_MAXEXPRS ) goto err1; err =nf_tables_expr_parse (&ctx, tmp, &info[n]); -if (err <0 ) +if (err <0 ) { +NL_SET_BAD_ATTR (extack, tmp); goto err1; + } size += info[n].ops->size; n++; }
Greg Kroah-Hartman
maintainerPATCH 160/161 xen-netback: take a reference to the RX task thread
In reply to Greg Kroah-HartmanFrom: Roger Pau Monne <[email protected]>
commit 107866a8eb0b664675a260f1ba0655010fac1e08 upstream.
Do this in order to prevent the task from being freed if the thread returns (which can be triggered by the frontend) before the call to kthread_stop done as part of the backend tear down. Not taking the reference will lead to a use-after-free in that scenario. Such reference was taken before but dropped as part of the rework done in 2ac061ce97f4.
Reintroduce the reference taking and add a comment this time explaining why it's needed.
This is XSA-374 / CVE-2021-28691.
--- drivers/net/xen-netback/interface.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/xen-netback/interface.c +6 -0
@@ -684,6 +684,7 @@ static void xenvif_disconnect_queue(stru {if (queue->task) {kthread_stop (queue->task); +put_task_struct (queue->task); queue->task =NULL ; }
@@ -745,6 +746,11 @@ int xenvif_connect_data(struct xenvif_quif (IS_ERR (task)) goto kthread_err; queue->task = task; +/* +* Take a reference to the task in order to prevent it from being freed +* if the thread function returns before kthread_stop is called. +*/ +get_task_struct (task); task =kthread_run (xenvif_dealloc_kthread, queue,"%s-dealloc" , queue->name);
Greg Kroah-Hartman
maintainerPATCH 161/161 neighbour: allow NUD_NOARP entries to be forced GCed
In reply to Greg Kroah-HartmanFrom: David Ahern <[email protected]>
commit 7a6b1ab7475fd6478eeaf5c9d1163e7a18125c8f upstream.
IFF_POINTOPOINT interfaces use NUD_NOARP entries for IPv6. It's possible to fill up the neighbour table with enough entries that it will overflow for valid connections after that.
This behaviour is more prevalent after commit 58956317c8de ("neighbor:
Improve garbage collection") is applied, as it prevents removal from entries that are not NUD_FAILED, unless they are more than 5s old.
--- net/core/neighbour.c | 1 + 1 file changed, 1 insertion(+)
net/core/neighbour.c +1 -0
@@ -238,6 +238,7 @@ static int neigh_forced_gc(struct neigh_write_lock (&n->lock);if ((n->nud_state ==NUD_FAILED ) || + (n->nud_state ==NUD_NOARP ) || (tbl->is_multicast && tbl->is_multicast (n->primary_key)) ||time_after (tref, n->updated))
Greg Kroah-Hartman
maintainerPATCH 155/161 KVM: arm64: Resolve all pending PC updates before immediate exit
In reply to Greg Kroah-HartmanFrom: Zenghui Yu <[email protected]>
commit e3e880bb1518eb10a4b4bb4344ed614d6856f190 upstream.
Commit 26778aaa134a ("KVM: arm64: Commit pending PC adjustemnts before returning to userspace") fixed the PC updating issue by forcing an explicit synchronisation of the exception state on vcpu exit to userspace.
However, we forgot to take into account the case where immediate_exit is set by userspace and KVM_RUN will exit immediately. Fix it by resolving all pending PC updates before returning to userspace.
Since __kvm_adjust_pc() relies on a loaded vcpu context, I moved the immediate_exit checking right after vcpu_load(). We will get some overhead if immediate_exit is true (which should hopefully be rare).
--- arch/arm64/kvm/arm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
arch/arm64/kvm/arm.c +6 -3
@@ -715,11 +715,13 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vreturn ret; } -if (run->immediate_exit) -return -EINTR ; -vcpu_load (vcpu); +if (run->immediate_exit) { + ret = -EINTR ; + goto out; + } +kvm_sigset_activate (vcpu); ret =1 ;
@@ -892,6 +894,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vkvm_sigset_deactivate (vcpu); +out:/* * In the unlikely event that we are returning to userspace * with pending exceptions or PC adjustment, commit these
Sasha Levin
maintainerRe: [PATCH 5.12 083/161] libceph: dont set global_id until we get an auth ticket
In reply to Ilya DryomovQuoted 104 lines · Ilya Dryomov
Quoted 89 lines · Greg Kroah-Hartman
From: Ilya Dryomov <[email protected]>
[ Upstream commit
61ca49a9105faefa003b37542cebad8722f8ae22]With the introduction of enforcing mode, setting
global_idas soon as we get it in the first MAuth reply will result in EACCES if the connection is reset before we get the second MAuth reply containing an auth ticket -- because on retry we would attempt to reclaim thatglobal_idwith no auth ticket at hand.Neither
ceph_auth_clientnorceph_mon_clientdepend onglobal_idbeing set ealy, so just delay the setting until we get and process the second MAuth reply. While at it, complain if the monitor sends a zeroglobal_idor changes ourglobal_idas the session is likely to fail after that.Cc [email protected] # needs backporting for < 5.11Signed-off-by Ilya Dryomov <[email protected]>Reviewed-by Sage Weil <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- net/ceph/auth.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-)net/ceph/auth.c +21
-11@@ -36,6 +36,20 @@ static int init_protocol(struct ceph_auth_client *ac, int proto) } } +static void set_global_id (struct ceph_auth_client *ac,u64 global_id) +{ +dout ("%s global_id %llu\n" , __func__, global_id); + +if (!global_id) +pr_err ("got zero global_id\n" ); + +if (ac->global_id && global_id != ac->global_id) +pr_err ("global_id changed from %llu to %llu\n" , ac->global_id, + global_id); + + ac->global_id = global_id; +} +/* * setup, teardown. */ @@ -222,11 +236,6 @@ int ceph_handle_auth_reply(struct ceph_auth_client *ac, payload_end = payload + payload_len; -if (global_id && ac->global_id != global_id) { -dout (" set global_id %lld -> %lld\n" , ac->global_id, global_id); - ac->global_id = global_id; - } -if (ac->negotiating) {/* server does not support our protocols? */ if (!protocol && result <0 ) {@@ -253,11 +262,16 @@ int ceph_handle_auth_reply(struct ceph_auth_client *ac, ret = ac->ops->handle_reply (ac, result, payload, payload_end,NULL ,NULL ,NULL ,NULL ); -if (ret == -EAGAIN ) +if (ret == -EAGAIN ) { ret =build_request (ac, true, reply_buf, reply_len); -else if (ret) + goto out; + }else if (ret) {pr_err ("auth protocol '%s' mauth authentication failed: %d\n" ,ceph_auth_proto_name (ac->protocol), result); + goto out; + } + +set_global_id (ac, global_id); out:mutex_unlock (&ac->mutex);@@ -484,15 +498,11 @@ int ceph_auth_handle_reply_done(struct ceph_auth_client *ac,int ret;mutex_lock (&ac->mutex); -if (global_id && ac->global_id != global_id) { -dout ("%s global_id %llu -> %llu\n" , __func__, ac->global_id, - global_id); - ac->global_id = global_id;net/ceph/auth.c int ceph_auth_handle_reply_done(struct ceph_auth_client *ac, · line 508
Quoted 10 lines
net/ceph/auth.c +2
-2- } - ret = ac->ops->handle_reply (ac,0 , reply, reply + reply_len, session_key, session_key_len, con_secret, con_secret_len); +if (!ret) +set_global_id (ac, global_id);mutex_unlock (&ac->mutex);return ret; }Hi Greg,
Quoted 1 line
I asked Sasha to drop this patch earlier today.
I've dropped it now, but I think I'm missing your previous request. Was it as a reply to the added-to mail? I just want to make sure I'm not missing your mails.
Signature · 2 lines
Thanks, Sasha
Re: [PATCH 5.12 083/161] libceph: dont set global_id until we get an auth ticket
Quoted 106 lines · Sasha Levin
Quoted 104 lines · Ilya Dryomov
Quoted 89 lines · Greg Kroah-Hartman
From: Ilya Dryomov <[email protected]>
[ Upstream commit
61ca49a9105faefa003b37542cebad8722f8ae22]With the introduction of enforcing mode, setting
global_idas soon as we get it in the first MAuth reply will result in EACCES if the connection is reset before we get the second MAuth reply containing an auth ticket -- because on retry we would attempt to reclaim thatglobal_idwith no auth ticket at hand.Neither
ceph_auth_clientnorceph_mon_clientdepend onglobal_idbeing set ealy, so just delay the setting until we get and process the second MAuth reply. While at it, complain if the monitor sends a zeroglobal_idor changes ourglobal_idas the session is likely to fail after that.Cc [email protected] # needs backporting for < 5.11Signed-off-by Ilya Dryomov <[email protected]>Reviewed-by Sage Weil <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- net/ceph/auth.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-)net/ceph/auth.c +21
-11@@ -36,6 +36,20 @@ static int init_protocol(struct ceph_auth_client *ac, int proto) } } +static void set_global_id (struct ceph_auth_client *ac,u64 global_id) +{ +dout ("%s global_id %llu\n" , __func__, global_id); + +if (!global_id) +pr_err ("got zero global_id\n" ); + +if (ac->global_id && global_id != ac->global_id) +pr_err ("global_id changed from %llu to %llu\n" , ac->global_id, + global_id); + + ac->global_id = global_id; +} +/* * setup, teardown. */ @@ -222,11 +236,6 @@ int ceph_handle_auth_reply(struct ceph_auth_client *ac, payload_end = payload + payload_len; -if (global_id && ac->global_id != global_id) { -dout (" set global_id %lld -> %lld\n" , ac->global_id, global_id); - ac->global_id = global_id; - } -if (ac->negotiating) {/* server does not support our protocols? */ if (!protocol && result <0 ) {@@ -253,11 +262,16 @@ int ceph_handle_auth_reply(struct ceph_auth_client *ac, ret = ac->ops->handle_reply (ac, result, payload, payload_end,NULL ,NULL ,NULL ,NULL ); -if (ret == -EAGAIN ) +if (ret == -EAGAIN ) { ret =build_request (ac, true, reply_buf, reply_len); -else if (ret) + goto out; + }else if (ret) {pr_err ("auth protocol '%s' mauth authentication failed: %d\n" ,ceph_auth_proto_name (ac->protocol), result); + goto out; + } + +set_global_id (ac, global_id); out:mutex_unlock (&ac->mutex);@@ -484,15 +498,11 @@ int ceph_auth_handle_reply_done(struct ceph_auth_client *ac,int ret;mutex_lock (&ac->mutex); -if (global_id && ac->global_id != global_id) { -dout ("%s global_id %llu -> %llu\n" , __func__, ac->global_id, - global_id); - ac->global_id = global_id;net/ceph/auth.c int ceph_auth_handle_reply_done(struct ceph_auth_client *ac, · line 508
Quoted 10 lines
net/ceph/auth.c +2
-2- } - ret = ac->ops->handle_reply (ac,0 , reply, reply + reply_len, session_key, session_key_len, con_secret, con_secret_len); +if (!ret) +set_global_id (ac, global_id);mutex_unlock (&ac->mutex);return ret; }Hi Greg,
Quoted 5 lines
Quoted 1 line
I asked Sasha to drop this patch earlier today.
I've dropped it now, but I think I'm missing your previous request. Was it as a reply to the added-to mail? I just want to make sure I'm not missing your mails.
Yes, but it looks like it didn't make it to stable-commits mailing list either. Weird...
MIME-Version: 1.0
Date: Tue, 8 Jun 2021 11:13:08 +0200
References: <[email protected]>
In-Reply-To: <[email protected]>
Message-ID:<CAOi1vP9Ubs1Cu6sW43H-=dVXSzkFZBycfR_Af4b3vJ9mihkAzA@mail.gmail.com>
Subject: Re: Patch "libceph: don't set global_id until we get an
auth ticket" has been added to the 5.12-stable tree
From: Ilya Dryomov <[email protected]>
To: Sasha Levin <[email protected]>
Cc: [email protected]
Content-Type: text/plain; charset="UTF-8"
Thanks,
Ilya
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.12.10 release. There are 161 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 10 Jun 2021 17:59:18 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.12.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.12.y
and the diffstat can be found below.thanks,
greg k-h
5.12.10-rc1 Successfully Compiled and booted on my Raspberry PI 4b (8g) (bcm2711)
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.12.10 release. There are 161 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 10 Jun 2021 17:59:18 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.12.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.12.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Greg Kroah-Hartman
maintainerPATCH 27/161 nvme-rdma: fix in-casule data send for chained sgls
In reply to Greg Kroah-HartmanFrom: Sagi Grimberg <[email protected]>
[ Upstream commit 12b2aaadb6d5ef77434e8db21f469f46fe2d392e ]
We have only 2 inline sg entries and we allow 4 sg entries for the send wr sge. Larger sgls entries will be chained. However when we build in-capsule send wr sge, we iterate without taking into account that the sgl may be chained and still fit in-capsule (which can happen if the sgl is bigger than 2, but lower-equal to 4).
Fix in-capsule data mapping to correctly iterate chained sgls.
--- drivers/nvme/host/rdma.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/nvme/host/rdma.c +3 -2
@@ -1319,16 +1319,17 @@ static int nvme_rdma_map_sg_inline(struct nvme_rdma_queue *queue, int count) {struct nvme_sgl_desc *sg = &c->common.dptr.sgl; -struct scatterlist *sgl = req->data_sgl.sg_table.sgl;struct ib_sge *sge = &req->sge[1 ]; +struct scatterlist *sgl;u32 len =0 ;int i; -for (i =0 ; i < count; i++, sgl++, sge++) { +for_each_sg (req->data_sgl.sg_table.sgl, sgl, count, i) { sge->addr =sg_dma_address (sgl); sge->length =sg_dma_len (sgl); sge->lkey = queue->device->pd->local_dma_lkey; len += sge->length; + sge++; } sg->addr =cpu_to_le64 (queue->ctrl->ctrl.icdoff);
Signature · 1 line
2.30.2
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.12.10 release. There are 161 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 10 Jun 2021 17:59:18 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.12.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.12.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 5.12.10-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-5.12.y
* git commit: 5a0a66f4d8172bcb8ac3bf155bc524dc467c0071
* git describe: v5.12.9-162-g5a0a66f4d817
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-5.12.y/build/v5.12.9-162-g5a0a66f4d817
## No regressions (compared to v5.12.9)
## No fixes (compared to v5.12.9)
## Test result summary
total: 76414, pass: 64280, fail: 496, skip: 10934, xfail: 704,
## Build Summary
* arc: 10 total, 10 passed, 0 failed
* arm: 193 total, 193 passed, 0 failed
* arm64: 27 total, 27 passed, 0 failed
* i386: 25 total, 25 passed, 0 failed
* mips: 42 total, 42 passed, 0 failed
* parisc: 9 total, 9 passed, 0 failed
* powerpc: 27 total, 27 passed, 0 failed
* riscv: 18 total, 18 passed, 0 failed
* s390: 18 total, 18 passed, 0 failed
* sh: 18 total, 18 passed, 0 failed
* sparc: 9 total, 9 passed, 0 failed
* x86_64: 27 total, 27 passed, 0 failed
## Test suites summary
* fwts
* igt-gpu-tools
* ks[
* kselftest-android
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers
* kselftest-efivarfs
* kselftest-filesystems
* kselftest-firmware
* kselftest-fpu
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kvm
* kselftest-lib
* kselftest-livepatch
* kselftest-lkdtm
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-vm
* kselftest-x86
* kselftest-zram
* kunit
* kvm-unit-tests
* libhugetlbfs
* linux-log-parser
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-containers-tests
* ltp-controllers-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-tracing-tests
* network-basic-tests
* packetdrill
* perf
* rcutorture
* ssuite
* v4l2-compliance
--
Linaro LKFT
https://lkft.linaro.org
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.12.10 release. There are 161 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 10 Jun 2021 17:59:18 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.12.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.12.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v5.12:
12 builds: 12 pass, 0 fail
28 boots: 28 pass, 0 fail
104 tests: 104 pass, 0 failLinux version: 5.12.10-rc1-g5a0a66f4d817
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.12.10 release. There are 161 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 10 Jun 2021 17:59:18 +0000. Anything received after that time might be too late.
Build results:
total: 151 pass: 151 fail: 0 Qemu test results: total: 462 pass: 462 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.12.10 release. There are 161 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 10 Jun 2021 17:59:18 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.12.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.12.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB, using 32-bit and 64-bit ARM kernels:
Signature · 1 line
Florian
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 5.12.10 release. There are 161 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 10 Jun 2021 17:59:18 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.12.10-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-5.12.y
and the diffstat can be found below.thanks,
greg k-h
Tested rc1 against the Fedora build system (aarch64, armv7, ppc64le, s390x, x86_64), and boot tested x86_64. No regressions noted.