anbox-modules icon indicating copy to clipboard operation
anbox-modules copied to clipboard

Kernel oops caused by ashmem_mem on Fedora 31 running 5.3.16-300.fc31.x86_64

Open karuboniru opened this issue 5 years ago • 4 comments

When opening settings, I will get a kernel oops: Information can be found here: https://retrace.fedoraproject.org/faf/reports/2766265/ The kernel module is built with the latest git version of anbox-modules. This seems to happen on all 5.3.y version. ...And seems to have something to do with the bug I mentioned here https://github.com/anbox/anbox/issues/1115#issuecomment-569065863 (opening settings will crash the whole wsl 2)

[  512.965908] BUG: unable to handle page fault for address: 0000000040b81000
[  512.965911] #PF: supervisor write access in kernel mode
[  512.965913] #PF: error_code(0x0002) - not-present page
[  512.965914] PGD 5f5c8067 P4D 5f5c8067 PUD 8006f067 PMD 6fb0f067 PTE 0
[  512.965920] Oops: 0002 [#1] SMP NOPTI
[  512.965924] CPU: 2 PID: 4627 Comm: AsyncTask #3 Tainted: G           OE     5.3.16-300.fc31.x86_64 #1
[  512.965925] Hardware name: Hewlett-Packard HP ProBook 4446s/17EA, BIOS 68CPD Ver. F.68 03/28/2018
[  512.965932] RIP: 0010:__memcpy+0x12/0x20
[  512.965935] Code: 31 48 c1 e2 20 48 09 c2 48 31 d3 e9 71 ff ff ff 90 90 90 90 90 90 90 90 0f 1f 44 00 00 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 <f3> 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 f3 a4
[  512.965937] RSP: 0018:ffff9fc144f83c90 EFLAGS: 00010246
[  512.965939] RAX: 0000000040b8000c RBX: ffff9fc144f83dd8 RCX: 0000000000000002
[  512.965940] RDX: 0000000000000000 RSI: ffff91f764866ff0 RDI: 0000000040b80ffc
[  512.965941] RBP: 0000000000001000 R08: 0000000000000001 R09: ffffd33c00921980
[  512.965943] R10: 0000000000000091 R11: 0000000000000000 R12: 0000000000001000
[  512.965944] R13: 0000000000001000 R14: 0000000000000000 R15: ffff9fc144f83dc8
[  512.965946] FS:  00007f3712ff54e8(0000) GS:ffff91f909300000(0000) knlGS:00007f37193cb000
[  512.965948] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  512.965949] CR2: 0000000040b81000 CR3: 000000008006a000 CR4: 00000000000406e0
[  512.965950] Call Trace:
[  512.965957]  _copy_to_iter+0x155/0x420
[  512.965962]  copy_page_to_iter+0x1b8/0x320
[  512.965966]  shmem_file_read_iter+0xf6/0x440
[  512.965970]  new_sync_read+0x12a/0x1c0
[  512.965974]  vfs_read+0x9d/0x150
[  512.965976]  kernel_read+0x2c/0x40
[  512.965982]  ashmem_read+0x5f/0xb0 [ashmem_linux]
[  512.965985]  vfs_read+0x9d/0x150
[  512.965988]  ksys_read+0x5f/0xe0
[  512.965992]  do_syscall_64+0x5f/0x1a0
[  512.965995]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  512.965998] RIP: 0033:0x7f371c2c42e7
[  512.966001] Code: 1f 40 00 49 89 ca b8 28 01 00 00 0f 05 48 3d 01 f0 ff ff 72 09 f7 d8 89 c7 e8 65 38 fa ff c3 0f 1f 40 00 b8 00 00 00 00 0f 05 <48> 3d 01 f0 ff ff 72 09 f7 d8 89 c7 e8 48 38 fa ff c3 0f 1f 80 00
[  512.966002] RSP: 002b:00007f3712ff4738 EFLAGS: 00000202 ORIG_RAX: 0000000000000000
[  512.966004] RAX: ffffffffffffffda RBX: 00007f3700e75080 RCX: 00007f371c2c42e7
[  512.966005] RDX: 0000000000005400 RSI: 0000000040b8000c RDI: 000000000000002f
[  512.966006] RBP: 000000000000002f R08: 0000000000000000 R09: 0000000000005400
[  512.966008] R10: 0000000070a7e000 R11: 0000000000000202 R12: 0000000040b8000c
[  512.966009] R13: 0000000000000000 R14: 00007f3712ff4770 R15: 00007f3700e75080
[  512.966011] Modules linked in: xt_NFLOG xt_u32 xt_connmark tcp_diag inet_diag nfnetlink_log veth squashfs zstd_decompress loop xt_comment uinput xt_CHECKSUM xt_MASQUERADE nf_nat_tftp nf_conntrack_tftp nf_conntrack_netbios_ns nf_conntrack_broadcast xt_CT ip6t_REJECT nf_reject_ipv6 ip6t_rpfilter ipt_REJECT nf_reject_ipv4 xt_conntrack ebtable_nat ebtable_broute ip6table_nat ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_nat iptable_mangle iptable_raw iptable_security nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c tun bridge stp llc ip_set nfnetlink ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter sunrpc vfat fat edac_mce_amd kvm_amd ccp kvm snd_hda_codec_idt snd_hda_codec_generic irqbypass ledtrig_audio snd_hda_codec_hdmi snd_hda_intel uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc snd_hda_codec snd_hda_core jmb38x_ms snd_hwdep crct10dif_pclmul iwldvm snd_seq crc32_pclmul memstick snd_seq_device mac80211 snd_pcm
[  512.966057]  snd_timer libarc4 snd ghash_clmulni_intel iwlwifi cfg80211 hp_wmi sparse_keymap wmi_bmof rfkill joydev hp_accel soundcore lis3lv02d input_polldev hp_wireless sp5100_tco i2c_piix4 k10temp acpi_cpufreq binder_linux(OE) ashmem_linux(OE) ip_tables radeon crc32c_intel i2c_algo_bit drm_kms_helper serio_raw ttm sdhci_pci drm cqhci sdhci mmc_core wmi r8169 video fuse
[  512.966080] CR2: 0000000040b81000
[  512.966082] ---[ end trace ab3c5a18a10042b5 ]---
[  512.966086] RIP: 0010:__memcpy+0x12/0x20
[  512.966088] Code: 31 48 c1 e2 20 48 09 c2 48 31 d3 e9 71 ff ff ff 90 90 90 90 90 90 90 90 0f 1f 44 00 00 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 <f3> 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 f3 a4
[  512.966089] RSP: 0018:ffff9fc144f83c90 EFLAGS: 00010246
[  512.966091] RAX: 0000000040b8000c RBX: ffff9fc144f83dd8 RCX: 0000000000000002
[  512.966092] RDX: 0000000000000000 RSI: ffff91f764866ff0 RDI: 0000000040b80ffc
[  512.966094] RBP: 0000000000001000 R08: 0000000000000001 R09: ffffd33c00921980
[  512.966095] R10: 0000000000000091 R11: 0000000000000000 R12: 0000000000001000
[  512.966096] R13: 0000000000001000 R14: 0000000000000000 R15: ffff9fc144f83dc8
[  512.966098] FS:  00007f3712ff54e8(0000) GS:ffff91f909300000(0000) knlGS:00007f37193cb000
[  512.966099] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  512.966101] CR2: 0000000040b81000 CR3: 000000008006a000 CR4: 00000000000406e0

karuboniru avatar Dec 29 '19 12:12 karuboniru

The build for anbox-modules is here:https://copr.fedorainfracloud.org/coprs/yanqiyu/anbox/build/1134652/ .

karuboniru avatar Dec 29 '19 13:12 karuboniru

We should check if there are upstream fixes to ashmem and incorporate them into our modules.

morphis avatar Jan 03 '20 07:01 morphis

Nice it is on Copr. Will take a look. Are you looking to get this packaged? There are builds for Arch and Suse, though snaps give some portability not sure if anything else outside of Ubuntu/Debian world has a build.

bkmgit avatar Jan 15 '20 12:01 bkmgit

on Fedora 31, I have similar issue when modprobing. The kernel version is 4.19.111-300.fc31.x86_64

The module compilation is OK, however gives the following error message on modprobing:

848.222712] sysfs: cannot create duplicate filename '/devices/virtual/misc/ashmem' [ 848.222717] CPU: 2 PID: 72212 Comm: modprobe Tainted: P OE 4.19.111-300.fc31.x86_64 #1 [ 848.222719] Hardware name: LENOVO 81Q5/LNVNB161216, BIOS BHCN35WW 11/23/2019 [ 848.222720] Call Trace: [ 848.222729] dump_stack+0x66/0x90 [ 848.222734] sysfs_warn_dup.cold+0x17/0x2d [ 848.222737] sysfs_create_dir_ns+0xaf/0xd0 [ 848.222740] kobject_add_internal+0xb7/0x280 [ 848.222743] kobject_add+0x7e/0xb0 [ 848.222747] ? _cond_resched+0x15/0x30 [ 848.222750] ? _cond_resched+0x15/0x30 [ 848.222754] device_add+0x12f/0x690 [ 848.222757] ? kstrdup+0x44/0x60 [ 848.222761] device_create_groups_vargs+0xda/0x100 [ 848.222766] device_create_with_groups+0x3f/0x60 [ 848.222769] ? kmem_cache_create_usercopy+0xfa/0x240 [ 848.222772] misc_register+0x14e/0x190 [ 848.222775] ? 0xffffffffc0738000 [ 848.222779] ashmem_init+0x6f/0x1000 [ashmem_linux] [ 848.222783] do_one_initcall+0x46/0x1c4 [ 848.222787] ? free_unref_page_commit+0x95/0x110 [ 848.222790] ? _cond_resched+0x15/0x30 [ 848.222793] ? kmem_cache_alloc_trace+0x162/0x1d0 [ 848.222797] ? do_init_module+0x23/0x220 [ 848.222800] do_init_module+0x5c/0x220 [ 848.222803] load_module+0x26f1/0x2a00 [ 848.222806] ? _cond_resched+0x15/0x30 [ 848.222812] ? __do_sys_init_module+0x164/0x190 [ 848.222814] ? _cond_resched+0x15/0x30 [ 848.222817] __do_sys_init_module+0x164/0x190 [ 848.222821] do_syscall_64+0x69/0x190 [ 848.222824] ? page_fault+0x8/0x30 [ 848.222826] entry_SYSCALL_64_after_hwframe+0x44/0xa9 [ 848.222829] RIP: 0033:0x7f8f1cb6f12e [ 848.222831] Code: 48 8b 0d 5d fd 0b 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 af 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 2a fd 0b 00 f7 d8 64 89 01 48 [ 848.222833] RSP: 002b:00007ffc82bcbea8 EFLAGS: 00000246 ORIG_RAX: 00000000000000af [ 848.222835] RAX: ffffffffffffffda RBX: 000055d91fe6fe00 RCX: 00007f8f1cb6f12e [ 848.222837] RDX: 000055d91fdef358 RSI: 0000000000005580 RDI: 000055d91fe7eb20 [ 848.222838] RBP: 000055d91fe7eb20 R08: 0000000000000000 R09: 00007ffc82bcb2d0 [ 848.222839] R10: 0000000000000001 R11: 0000000000000246 R12: 000055d91fdef358 [ 848.222840] R13: 0000000000000000 R14: 000055d91fe6ff30 R15: 000055d91fe6fe00 [ 848.222843] kobject_add_internal failed for ashmem with -EEXIST, don't try to register things with the same name in the same directory. [ 848.222845] ashmem: failed to register misc device!

lithces avatar Mar 21 '20 00:03 lithces