ehough / docker-nfs-server

A lightweight, robust, flexible, and containerized NFS server.
https://hub.docker.com/r/erichough/nfs-server/
GNU General Public License v3.0
714 stars 229 forks source link

automatic module loading not working for nfsd #46

Open morph027 opened 4 years ago

morph027 commented 4 years ago

OS: Ubuntu 18.04 / 20.04 Kernel: 5.3.0-53-generic Container command (example): docker run --rm -it -v /lib/modules:/lib/modules:ro --security-opt apparmor=erichough-nfs ubuntu:bionic modprobe -v nfsd

Logs:

Container:

insmod /lib/modules/5.3.0-53-generic/kernel/net/sunrpc/auth_gss/auth_rpcgss.ko 
insmod /lib/modules/5.3.0-53-generic/kernel/fs/nfsd/nfsd.ko 
Killed

Host:

Mai 27 08:52:15 host kernel: Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
Mai 27 08:52:15 host kernel: BUG: kernel NULL pointer dereference, address: 0000000000000058
Mai 27 08:52:15 host kernel: #PF: supervisor write access in kernel mode
Mai 27 08:52:15 host kernel: #PF: error_code(0x0002) - not-present page
Mai 27 08:52:15 host kernel: PGD 0 P4D 0 
Mai 27 08:52:15 host kernel: Oops: 0002 [#1] SMP NOPTI
Mai 27 08:52:15 host kernel: CPU: 3 PID: 5964 Comm: modprobe Not tainted 5.3.0-53-generic #47~18.04.1-Ubuntu
Mai 27 08:52:15 host kernel: Hardware name: LENOVO 20N8005UGE/20N8005UGE, BIOS R0YET41W (1.24 ) 12/18/2019
Mai 27 08:52:15 host kernel: RIP: 0010:nfsd_fill_super+0x71/0x90 [nfsd]
Mai 27 08:52:15 host kernel: Code: 85 c0 89 c3 74 09 89 d8 5b 41 5c 41 5d 5d c3 49 8b 7c 24 68 31 f6 48 c7 c2 70 b4 31 c1 e8 97 fe ff ff 48 3d 00 f0 ff ff 77 0d <49> 89 45 58 89 d8 5b 41 5c 41 5d 5d c3 89 c3 eb cb 0f 1f 40 00 66
Mai 27 08:52:15 host kernel: RSP: 0018:ffffb5f881c97aa8 EFLAGS: 00010287
Mai 27 08:52:15 host kernel: RAX: ffff9c714033a900 RBX: 0000000000000000 RCX: 0000000000000002
Mai 27 08:52:15 host kernel: RDX: 0000000000000000 RSI: 0000000000000100 RDI: ffff9c71d31eed28
Mai 27 08:52:15 host kernel: RBP: ffffb5f881c97ac0 R08: ffff9c714033a920 R09: 0000000000000000
Mai 27 08:52:15 host kernel: R10: 0000000000000000 R11: fefefefefefefeff R12: ffff9c71e8bd8800
Mai 27 08:52:15 host kernel: R13: 0000000000000000 R14: ffffffffc12e24d0 R15: ffff9c71734a9c80
Mai 27 08:52:15 host kernel: FS:  00007fd98be92540(0000) GS:ffff9c71f12c0000(0000) knlGS:0000000000000000
Mai 27 08:52:15 host kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Mai 27 08:52:15 host kernel: CR2: 0000000000000058 CR3: 00000003c60fa001 CR4: 00000000003606e0
Mai 27 08:52:15 host kernel: Call Trace:
Mai 27 08:52:15 host kernel:  vfs_get_super+0x5b/0xe0
Mai 27 08:52:15 host kernel:  ? vfs_parse_fs_param+0xdc/0x1c0
Mai 27 08:52:15 host kernel:  nfsd_fs_get_tree+0x2c/0x30 [nfsd]
Mai 27 08:52:15 host kernel:  vfs_get_tree+0x2a/0x100
Mai 27 08:52:15 host kernel:  fc_mount+0x12/0x40
Mai 27 08:52:15 host kernel:  vfs_kern_mount.part.31+0x76/0x90
Mai 27 08:52:15 host kernel:  vfs_kern_mount+0x13/0x20
Mai 27 08:52:15 host kernel:  nfsd_init_net+0x101/0x140 [nfsd]
Mai 27 08:52:15 host kernel:  ops_init+0x44/0x120
Mai 27 08:52:15 host kernel:  register_pernet_operations+0xed/0x200
Mai 27 08:52:15 host kernel:  ? trace_event_define_fields_nfsd_stateid_class+0xb3/0xb3 [nfsd]
Mai 27 08:52:15 host kernel:  register_pernet_subsys+0x28/0x40
Mai 27 08:52:15 host kernel:  init_nfsd+0x22/0xcbc [nfsd]
Mai 27 08:52:15 host kernel:  do_one_initcall+0x4a/0x1fa
Mai 27 08:52:15 host kernel:  ? _cond_resched+0x19/0x40
Mai 27 08:52:15 host kernel:  ? kmem_cache_alloc_trace+0x165/0x220
Mai 27 08:52:15 host kernel:  do_init_module+0x5f/0x227
Mai 27 08:52:15 host kernel:  load_module+0x1aa4/0x2140
Mai 27 08:52:15 host kernel:  __do_sys_finit_module+0xfc/0x120
Mai 27 08:52:15 host kernel:  ? __do_sys_finit_module+0xfc/0x120
Mai 27 08:52:15 host kernel:  __x64_sys_finit_module+0x1a/0x20
Mai 27 08:52:15 host kernel:  do_syscall_64+0x5a/0x130
Mai 27 08:52:15 host kernel:  entry_SYSCALL_64_after_hwframe+0x44/0xa9
Mai 27 08:52:15 host kernel: RIP: 0033:0x7fd98b9ba839
Mai 27 08:52:15 host kernel: Code: 00 f3 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 1f f6 2c 00 f7 d8 64 89 01 48
Mai 27 08:52:15 host kernel: RSP: 002b:00007fffb653b848 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
Mai 27 08:52:15 host kernel: RAX: ffffffffffffffda RBX: 000055e6c1078d80 RCX: 00007fd98b9ba839
Mai 27 08:52:15 host kernel: RDX: 0000000000000000 RSI: 000055e6bf45fcee RDI: 0000000000000004
Mai 27 08:52:15 host kernel: RBP: 000055e6bf45fcee R08: 0000000000000000 R09: 0000000000000000
Mai 27 08:52:15 host kernel: R10: 0000000000000004 R11: 0000000000000246 R12: 0000000000000000
Mai 27 08:52:15 host kernel: R13: 000055e6c1078c80 R14: 0000000000040000 R15: 000055e6c1078d80
Mai 27 08:52:15 host kernel: Modules linked in: nfsd(+) auth_rpcgss nfsv3 nfs_acl nfsv4 nfs lockd grace fscache hid_generic snd_usb_audio usbhid hid snd_usbmidi_lib cdc_ether usbnet r8152 mii rfcomm xt_nat veth vxlan ip6_udp_tunnel udp_tunnel xt_mark nf_conntrack_netlink nfnetlink xfrm_user xfrm_algo xt_addrtype br_netfilter xt_CHECKSUM iptable_mangle xt_MASQUERADE iptable_nat nf_nat bridge stp llc ccm cmac aufs overlay bnep zram binfmt_misc nls_iso8859_1 mei_hdcp intel_rapl_msr sof_pci_dev snd_sof_intel_hda_common snd_soc_hdac_hda snd_sof_intel_hda snd_sof_intel_byt snd_sof_intel_ipc snd_sof snd_sof_xtensa_dsp snd_hda_ext_core snd_soc_acpi_intel_match snd_soc_acpi snd_soc_core x86_pkg_temp_thermal intel_powerclamp iwlmvm snd_compress coretemp ac97_bus snd_hda_codec_hdmi mac80211 snd_pcm_dmaengine kvm_intel snd_hda_codec_conexant snd_hda_codec_generic libarc4 kvm snd_hda_intel irqbypass joydev snd_intel_dspcfg intel_cstate snd_hda_codec input_leds intel_rapl_perf iwlwifi snd_hda_core uvcvideo btusb
Mai 27 08:52:15 host kernel:  serio_raw snd_hwdep thinkpad_acpi btrtl snd_seq_midi intel_wmi_thunderbolt btbcm v4l2_common snd_pcm videobuf2_vmalloc btintel wmi_bmof videobuf2_memops snd_seq_midi_event nvram rtsx_pci_ms videobuf2_v4l2 snd_rawmidi cfg80211 ledtrig_audio videobuf2_common bluetooth memstick mei_me videodev snd_seq mc ucsi_acpi processor_thermal_device typec_ucsi ecdh_generic intel_rapl_common snd_seq_device mei ecc typec intel_soc_dts_iosf intel_pch_thermal snd_timer snd soundcore int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad mac_hid ip6table_filter ip6_tables xt_tcpudp xt_conntrack nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 libcrc32c iptable_filter bpfilter sch_fq_codel parport_pc sunrpc ppdev lp parport ip_tables x_tables autofs4 algif_skcipher af_alg dm_crypt crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel i915 rtsx_pci_sdmmc i2c_algo_bit drm_kms_helper aes_x86_64 crypto_simd syscopyarea nvme sysfillrect cryptd sysimgblt glue_helper
Mai 27 08:52:15 host kernel:  fb_sys_fops psmouse drm r8169 nvme_core realtek rtsx_pci wmi pinctrl_cannonlake video pinctrl_intel
Mai 27 08:52:15 host kernel: CR2: 0000000000000058
Mai 27 08:52:15 host kernel: ---[ end trace 737920d87c3aa490 ]---
Mai 27 08:52:15 host kernel: RIP: 0010:nfsd_fill_super+0x71/0x90 [nfsd]
Mai 27 08:52:15 host kernel: Code: 85 c0 89 c3 74 09 89 d8 5b 41 5c 41 5d 5d c3 49 8b 7c 24 68 31 f6 48 c7 c2 70 b4 31 c1 e8 97 fe ff ff 48 3d 00 f0 ff ff 77 0d <49> 89 45 58 89 d8 5b 41 5c 41 5d 5d c3 89 c3 eb cb 0f 1f 40 00 66
Mai 27 08:52:15 host kernel: RSP: 0018:ffffb5f881c97aa8 EFLAGS: 00010287
Mai 27 08:52:15 host kernel: RAX: ffff9c714033a900 RBX: 0000000000000000 RCX: 0000000000000002
Mai 27 08:52:15 host kernel: RDX: 0000000000000000 RSI: 0000000000000100 RDI: ffff9c71d31eed28
Mai 27 08:52:15 host kernel: RBP: ffffb5f881c97ac0 R08: ffff9c714033a920 R09: 0000000000000000
Mai 27 08:52:15 host kernel: R10: 0000000000000000 R11: fefefefefefefeff R12: ffff9c71e8bd8800
Mai 27 08:52:15 host kernel: R13: 0000000000000000 R14: ffffffffc12e24d0 R15: ffff9c71734a9c80
Mai 27 08:52:15 host kernel: FS:  00007fd98be92540(0000) GS:ffff9c71f12c0000(0000) knlGS:0000000000000000
Mai 27 08:52:15 host kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Mai 27 08:52:15 host kernel: CR2: 0000000000000058 CR3: 00000003c60fa001 CR4: 00000000003606e0

Looks like this issue: https://github.com/docker/for-linux/issues/996

Afterwards, my machine hangs and needs a cold reset.

Modprobing the nfsd module directly on the host works without issues.

alexanderek commented 4 years ago

Also issue on Debian 10

DeathRabbit679 commented 4 years ago

I tripped over this on 18.04 as well. Ended up adding nfs and nfsd to a /etc/modules-load.d/nfs.conf to get around having to remember to do this.

ehough commented 4 years ago

Thank you for the report! A nasty bug indeed. I will investigate and see what can be done from our end to prevent a crash.

yash-fn commented 3 years ago

Do you maybe need SYS_ADMIN and SYS_MODULE capabilities or --privelaged?