Skip to content
Snippets Groups Projects
  1. Aug 13, 2023
  2. May 15, 2023
    • Lee Jones's avatar
      Revert "Revert "mm/rmap: Fix anon_vma->degree ambiguity leading to double-reuse"" · 07e8f4e4
      Lee Jones authored and Todd Frederick's avatar Todd Frederick committed
      
      This reverts commit 4f35cec76058557d9eaec0d501d03c7657eb56b4 and does so
      in an abi-safe way.
      
      This is done by adding the new fields only to the end of the structure
      and this structure is only passed around to other functions as a
      pointer, the internal structure layout is only touched by the core
      kernel, so adding it to the end is safe.
      
      ABI differences manually updated:
      
      Leaf changes summary: 1 artifact changed
      Changed leaf types summary: 1 leaf type changed
      Removed/Changed/Added functions summary: 0 Removed, 0 Changed, 0 Added function
      Removed/Changed/Added variables summary: 0 Removed, 0 Changed, 0 Added variable
      
      'struct anon_vma at rmap.h:29:1' changed:
        type size changed from 704 to 832 (in bits)
        2 data member insertions:
          'unsigned long int num_children', at offset 704 (in bits) at rmap.h:70:1
          'unsigned long int num_active_vmas', at offset 768 (in bits) at rmap.h:72:1
        761 impacted interfaces
      
      Bug: 260678056
      Bug: 253167854
      Change-Id: Ib1d45625cbc2e0b21330ca3dc2aa7aff34666d31
      Signed-off-by: default avatarLee Jones <joneslee@google.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
      (cherry picked from commit d3e1a50cba092fa9c56fc642ee74f360c4b40a17)
      (cherry picked from commit 7cf5d821)
      Signed-off-by: default avatarTodd Frederick <tfred@google.com>
  3. Apr 28, 2023
  4. Apr 20, 2023
  5. Apr 12, 2023
  6. Apr 05, 2023
    • Ye Bin's avatar
      UPSTREAM: ext4: fix kernel BUG in 'ext4_write_inline_data_end()' · c1102a2e
      Ye Bin authored and Tudor Ambarus's avatar Tudor Ambarus committed
      
      commit 5c099c4fdc438014d5893629e70a8ba934433ee8 upstream.
      
      Syzbot report follow issue:
      ------------[ cut here ]------------
      kernel BUG at fs/ext4/inline.c:227!
      invalid opcode: 0000 [#1] PREEMPT SMP KASAN
      CPU: 1 PID: 3629 Comm: syz-executor212 Not tainted 6.1.0-rc5-syzkaller-00018-g59d0d52c30d4 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
      RIP: 0010:ext4_write_inline_data+0x344/0x3e0 fs/ext4/inline.c:227
      RSP: 0018:ffffc90003b3f368 EFLAGS: 00010293
      RAX: 0000000000000000 RBX: ffff8880704e16c0 RCX: 0000000000000000
      RDX: ffff888021763a80 RSI: ffffffff821e31a4 RDI: 0000000000000006
      RBP: 000000000006818e R08: 0000000000000006 R09: 0000000000068199
      R10: 0000000000000079 R11: 0000000000000000 R12: 000000000000000b
      R13: 0000000000068199 R14: ffffc90003b3f408 R15: ffff8880704e1c82
      FS:  000055555723e3c0(0000) GS:ffff8880b9b00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fffe8ac9080 CR3: 0000000079f81000 CR4: 0000000000350ee0
      Call Trace:
       <TASK>
       ext4_write_inline_data_end+0x2a3/0x12f0 fs/ext4/inline.c:768
       ext4_write_end+0x242/0xdd0 fs/ext4/inode.c:1313
       ext4_da_write_end+0x3ed/0xa30 fs/ext4/inode.c:3063
       generic_perform_write+0x316/0x570 mm/filemap.c:3764
       ext4_buffered_write_iter+0x15b/0x460 fs/ext4/file.c:285
       ext4_file_write_iter+0x8bc/0x16e0 fs/ext4/file.c:700
       call_write_iter include/linux/fs.h:2191 [inline]
       do_iter_readv_writev+0x20b/0x3b0 fs/read_write.c:735
       do_iter_write+0x182/0x700 fs/read_write.c:861
       vfs_iter_write+0x74/0xa0 fs/read_write.c:902
       iter_file_splice_write+0x745/0xc90 fs/splice.c:686
       do_splice_from fs/splice.c:764 [inline]
       direct_splice_actor+0x114/0x180 fs/splice.c:931
       splice_direct_to_actor+0x335/0x8a0 fs/splice.c:886
       do_splice_direct+0x1ab/0x280 fs/splice.c:974
       do_sendfile+0xb19/0x1270 fs/read_write.c:1255
       __do_sys_sendfile64 fs/read_write.c:1323 [inline]
       __se_sys_sendfile64 fs/read_write.c:1309 [inline]
       __x64_sys_sendfile64+0x1d0/0x210 fs/read_write.c:1309
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd
      ---[ end trace 0000000000000000 ]---
      
      Above issue may happens as follows:
      ext4_da_write_begin
        ext4_da_write_inline_data_begin
          ext4_da_convert_inline_data_to_extent
            ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA);
      ext4_da_write_end
      
      ext4_run_li_request
        ext4_mb_prefetch
          ext4_read_block_bitmap_nowait
            ext4_validate_block_bitmap
              ext4_mark_group_bitmap_corrupted(sb, block_group, EXT4_GROUP_INFO_BBITMAP_CORRUPT)
      	 percpu_counter_sub(&sbi->s_freeclusters_counter,grp->bb_free);
      	  -> sbi->s_freeclusters_counter become zero
      ext4_da_write_begin
        if (ext4_nonda_switch(inode->i_sb)) -> As freeclusters_counter is zero will return true
          *fsdata = (void *)FALL_BACK_TO_NONDELALLOC;
          ext4_write_begin
      ext4_da_write_end
        if (write_mode == FALL_BACK_TO_NONDELALLOC)
          ext4_write_end
            if (inline_data)
              ext4_write_inline_data_end
      	  ext4_write_inline_data
      	    BUG_ON(pos + len > EXT4_I(inode)->i_inline_size);
                 -> As inode is already convert to extent, so 'pos + len' > inline_size
      	   -> then trigger BUG.
      
      To solve this issue, instead of checking ext4_has_inline_data() which
      is only cleared after data has been written back, check the
      EXT4_STATE_MAY_INLINE_DATA flag in ext4_write_end().
      
      Fixes: f19d5870 ("ext4: add normal write support for inline data")
      Reported-by: default avatar <syzbot+4faa160fa96bfba639f8@syzkaller.appspotmail.com>
      Reported-by: default avatarJun Nie <jun.nie@linaro.org>
      Signed-off-by: default avatarYe Bin <yebin10@huawei.com>
      Link: https://lore.kernel.org/r/20221206144134.1919987-1-yebin@huaweicloud.com
      
      
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Cc: stable@kernel.org
      [ta: Fix conflict in if expression and use the local variable inline_data
      as it is initialized with ext4_has_inline_data(inode) anyway.]
      Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Bug: 257756238
      Change-Id: Ifc77db2f12db2270a2f7100e548e113dee3ee492
      Signed-off-by: default avatarTudor Ambarus <tudor.ambarus@linaro.org>
      c1102a2e
  7. Apr 04, 2023
  8. Apr 03, 2023
  9. Mar 31, 2023
  10. Mar 23, 2023
    • Greg Kroah-Hartman's avatar
      Merge 4.19.279 into android-4.19-stable · b8d378e9
      Greg Kroah-Hartman authored
      
      Changes in 4.19.279
      	ext4: fix cgroup writeback accounting with fs-layer encryption
      	fs: sysfs_emit_at: Remove PAGE_SIZE alignment check
      	clk: HI655X: select REGMAP instead of depending on it
      	tcp: tcp_make_synack() can be called from process context
      	nfc: pn533: initialize struct pn533_out_arg properly
      	qed/qed_dev: guard against a possible division by zero
      	net: tunnels: annotate lockless accesses to dev->needed_headroom
      	net: phy: smsc: bail out in lan87xx_read_status if genphy_read_status fails
      	nfc: st-nci: Fix use after free bug in ndlc_remove due to race condition
      	net: usb: smsc75xx: Limit packet length to skb->len
      	nvmet: avoid potential UAF in nvmet_req_complete()
      	block: sunvdc: add check for mdesc_grab() returning NULL
      	ipv4: Fix incorrect table ID in IOCTL path
      	net: usb: smsc75xx: Move packet length check to prevent kernel panic in skb_pull
      	net/iucv: Fix size of interrupt data
      	ethernet: sun: add check for the mdesc_grab()
      	hwmon: (adt7475) Display smoothing attributes in correct order
      	hwmon: (adt7475) Fix masking of hysteresis registers
      	hwmon: (xgene) Fix use after free bug in xgene_hwmon_remove due to race condition
      	media: m5mols: fix off-by-one loop termination error
      	mmc: atmel-mci: fix race between stop command and start of next command
      	jffs2: correct logic when creating a hole in jffs2_write_begin
      	ext4: fail ext4_iget if special inode unallocated
      	ext4: fix task hung in ext4_xattr_delete_inode
      	drm/amdkfd: Fix an illegal memory access
      	sh: intc: Avoid spurious sizeof-pointer-div warning
      	tracing: Check field value in hist_field_name()
      	tracing: Make tracepoint lockdep check actually test something
      	ftrace: Fix invalid address access in lookup_rec() when index is 0
      	fbdev: stifb: Provide valid pixelclock and add fb_check_var() checks
      	x86/mm: Fix use of uninitialized buffer in sme_enable()
      	drm/i915: Don't use stolen memory for ring buffers with LLC
      	serial: 8250_em: Fix UART port type
      	HID: core: Provide new max_buffer_size attribute to over-ride the default
      	HID: uhid: Over-ride the default maximum data buffer value with our own
      	Linux 4.19.279
      
      Change-Id: I588a3903d05a52088eb3d8623ed955243db55fbd
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
      b8d378e9
  11. Mar 22, 2023
Loading