Development discussion of WireGuard
 help / color / mirror / Atom feed
* BUG: unable to handle kernel NULL pointer dereference at .. (linux 3.13)
@ 2019-02-04 16:50 Anatoli
  2019-02-17  1:47 ` Jason A. Donenfeld
  0 siblings, 1 reply; 5+ messages in thread
From: Anatoli @ 2019-02-04 16:50 UTC (permalink / raw)
  To: WireGuard mailing list


[-- Attachment #1.1: Type: text/plain, Size: 8310 bytes --]

Hi,

I'm trying to make WG work on Ubuntu 14.04.5, but got a driver bug 
apparently.

WG was installed this way: sudo add-apt-repository 
ppa:wireguard/wireguard && sudo apt update && sudo apt install wireguard

Then, the following commands were executed (mixed with syslog output):

$ lsb_release -a
Distributor ID:    Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:    14.04
Codename:    trusty

$ uname -a
Linux l 3.13.0-165-generic #215-Ubuntu SMP Wed Jan 16 11:46:47 UTC 2019 
x86_64 x86_64 x86_64 GNU/Linux

$ apt search wireguard
wireguard/trusty,now 0.0.20190123-wg1~trusty all [installed]
wireguard-dkms/trusty,now 0.0.20190123-wg1~trusty all [installed,automatic]
wireguard-tools/trusty,now 0.0.20190123-wg1~trusty amd64 
[installed,automatic]



$ wg genkey | tee privatekey | wg pubkey > publickey

$ sudo ip link add dev wg0 type wireguard

Feb  4 13:20:37 l kernel: [  248.082139] wireguard: module verification 
failed: signature and/or  required key missing - tainting kernel
Feb  4 13:20:37 l kernel: [  248.082815] wireguard: WireGuard 
0.0.20190123 loaded. See www.wireguard.com for information.
Feb  4 13:20:37 l kernel: [  248.082816] wireguard: Copyright (C) 
2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.


$ sudo ip addr add 10.0.0.1/24 dev wg0
$ sudo wg set wg0 listen-port 500 private-key ./privatekey
$ sudo ip link set wg0 up

Feb  4 13:22:12 l kernel: [  342.791370] BUG: unable to handle kernel 
NULL pointer dereference at 0000000000000018
Feb  4 13:22:12 l kernel: [  342.791635] IP: [<ffffffffa036d7ec>] 
wg_socket_init+0x13c/0x3f0 [wireguard]
Feb  4 13:22:12 l kernel: [  342.791861] PGD 80000000b2899067 PUD 
b2a0d067 PMD 0
Feb  4 13:22:12 l kernel: [  342.792043] Oops: 0000 [#1] SMP
Feb  4 13:22:12 l kernel: [  342.792162] Modules linked in: 
wireguard(OX) ip_tunnel iptable_mangle xt_nat iptable_nat nf_nat_ipv4 
ipt_REJECT xt_tcpmss xt_tcpudp xt_LOG xt_limit nf_conntrack_ipv4 
nf_defrag_ipv4 xt_owner xt_recent xt_set xt_conntrack iptable_filter 
ip_tables ip_set_hash_ip ip_set nfnetlink bridge stp llc intel_rapl 
e1000e x86_pkg_temp_thermal intel_powerclamp r8169 mii kvm_intel ptp 
gpio_ich ipmi_devintf lpc_ich pps_core joydev shpchp kvm 
crct10dif_pclmul ipmi_si crc32_pclmul ghash_clmulni_intel 
nf_conntrack_sip nf_conntrack_tftp xt_multiport x_tables nf_nat_ftp 
nf_nat nf_conntrack_ftp nf_conntrack coretemp lp nls_iso8859_1 parport 
dm_crypt raid10 raid456 async_raid6_recov async_memcpy async_pq 
async_xor xor async_tx raid6_pq raid0 multipath linear raid1 hid_generic 
aesni_intel snd_pcsp aes_x86_64 glue_helper snd_pcm lrw snd_page_alloc 
gf128mul snd_timer ablk_helper usbhid ahci snd cryptd soundcore libahci 
hid wmi mac_hid
Feb  4 13:22:12 l kernel: [  342.795383] CPU: 6 PID: 3154 Comm: ip 
Tainted: G           OX 3.13.0-165-generic #215-Ubuntu
Feb  4 13:22:12 l kernel: [  342.795650] Hardware name: IBM IBM System 
x3100 M4
Feb  4 13:22:12 l kernel: [  342.795957] task: ffff88021cb0b000 ti: 
ffff8800af964000 task.ti: ffff8800af964000
Feb  4 13:22:12 l kernel: [  342.796192] RIP: 0010:[<ffffffffa036d7ec>]  
[<ffffffffa036d7ec>] wg_socket_init+0x13c/0x3f0 [wireguard]
Feb  4 13:22:12 l kernel: [  342.796497] RSP: 0018:ffff8800af9656e0  
EFLAGS: 00010202
Feb  4 13:22:12 l kernel: [  342.796665] RAX: 0000000000000000 RBX: 
ffff88021b300880 RCX: 000000007fbae3ff
Feb  4 13:22:12 l kernel: [  342.796894] RDX: ffff88021b300880 RSI: 
ffff880221d7f980 RDI: ffffffff81cded00
Feb  4 13:22:12 l kernel: [  342.797120] RBP: ffff8800af965798 R08: 
ffff88023fd94690 R09: 0000000000000004
Feb  4 13:22:12 l kernel: [  342.797344] R10: ffff88023fd94688 R11: 
ffffc90004e0ca8c R12: 0000000000000065
Feb  4 13:22:12 l kernel: [  342.797568] R13: 0000000000000000 R14: 
ffff8800af96573c R15: 00000000000001f4
Feb  4 13:22:12 l kernel: [  342.797794] FS: 00007f34c4d92740(0000) 
GS:ffff88023fd80000(0000) knlGS:0000000000000000
Feb  4 13:22:12 l kernel: [  342.798050] CS:  0010 DS: 0000 ES: 0000 
CR0: 0000000080050033
Feb  4 13:22:12 l kernel: [  342.798230] CR2: 0000000000000018 CR3: 
00000000af87a000 CR4: 0000000000160770
Feb  4 13:22:12 l kernel: [  342.798455] Stack:
Feb  4 13:22:12 l kernel: [  342.798520]  ffff8800af965750 
ffff880221d7f980 0000000000000000 ffff88021b300880
Feb  4 13:22:12 l kernel: [  342.798784]  ffffffff8162bd01 
ffffffffa036c340 0000000000000002 0000000000000000
Feb  4 13:22:12 l kernel: [  342.799046]  0000000000000000 
0000000000000000 0000f40100000000 0000000a00000001
Feb  4 13:22:12 l kernel: [  342.799309] Call Trace:
Feb  4 13:22:12 l kernel: [  342.806648] [<ffffffff8162bd01>] ? 
skb_copy_and_csum_dev+0xb1/0xc0
Feb  4 13:22:12 l kernel: [  342.814226] [<ffffffffa036c340>] ? 
send6+0x340/0x340 [wireguard]
Feb  4 13:22:12 l kernel: [  342.821781] [<ffffffffa0367a2a>] 
wg_open+0x5a/0xe0 [wireguard]
Feb  4 13:22:12 l kernel: [  342.829201] [<ffffffff8163f942>] 
__dev_open+0xc2/0x140
Feb  4 13:22:12 l kernel: [  342.836477] [<ffffffff8163fc53>] 
__dev_change_flags+0xa3/0x180
Feb  4 13:22:12 l kernel: [  342.843676] [<ffffffff8163fd59>] 
dev_change_flags+0x29/0x60
Feb  4 13:22:12 l kernel: [  342.850884] [<ffffffff8164f176>] 
do_setlink+0x2f6/0x9a0
Feb  4 13:22:12 l kernel: [  342.857911] [<ffffffff8139c442>] ? 
nla_parse+0x32/0x120
Feb  4 13:22:12 l kernel: [  342.864767] [<ffffffff8164fd1a>] 
rtnl_newlink+0x3ba/0x620
Feb  4 13:22:12 l kernel: [  342.871445] [<ffffffff81161923>] ? 
__alloc_pages_nodemask+0x1a3/0xb90
Feb  4 13:22:12 l kernel: [  342.878020] [<ffffffff812e5f7e>] ? 
security_capable+0x1e/0x20
Feb  4 13:22:12 l kernel: [  342.884415] [<ffffffff81077e29>] ? 
ns_capable+0x29/0x50
Feb  4 13:22:12 l kernel: [  342.890633] [<ffffffff8164c718>] 
rtnetlink_rcv_msg+0x98/0x250
Feb  4 13:22:12 l kernel: [  342.896710] [<ffffffff811afc88>] ? 
__kmalloc_node_track_caller+0x58/0x2b0
Feb  4 13:22:12 l kernel: [  342.902695] [<ffffffff8162c98e>] ? 
__alloc_skb+0x7e/0x2b0
Feb  4 13:22:12 l kernel: [  342.908496] [<ffffffff8164c680>] ? 
rtnetlink_rcv+0x30/0x30
Feb  4 13:22:12 l kernel: [  342.914122] [<ffffffff8166b0ab>] 
netlink_rcv_skb+0xab/0xc0
Feb  4 13:22:12 l kernel: [  342.919616] [<ffffffff8164c678>] 
rtnetlink_rcv+0x28/0x30
Feb  4 13:22:12 l kernel: [  342.924963] [<ffffffff8166a7a0>] 
netlink_unicast+0xe0/0x1b0
Feb  4 13:22:12 l kernel: [  342.930172] [<ffffffff8166ab7e>] 
netlink_sendmsg+0x30e/0x680
Feb  4 13:22:12 l kernel: [  342.935225] [<ffffffff81623251>] 
sock_sendmsg+0x91/0xc0
Feb  4 13:22:12 l kernel: [  342.940134] [<ffffffff811bd526>] ? 
__mem_cgroup_commit_charge+0x156/0x3d0
Feb  4 13:22:12 l kernel: [  342.944970] [<ffffffff81622f2e>] ? 
move_addr_to_kernel.part.14+0x1e/0x60
Feb  4 13:22:12 l kernel: [  342.949771] [<ffffffff81623d81>] ? 
move_addr_to_kernel+0x21/0x30
Feb  4 13:22:12 l kernel: [  342.954457] [<ffffffff81623659>] 
___sys_sendmsg+0x389/0x3a0
Feb  4 13:22:12 l kernel: [  342.959123] [<ffffffff81621ecf>] ? 
sock_destroy_inode+0x2f/0x40
Feb  4 13:22:12 l kernel: [  342.963784] [<ffffffff817487d4>] ? 
__do_page_fault+0x214/0x570
Feb  4 13:22:12 l kernel: [  342.968464] [<ffffffff811dffdd>] ? 
dput+0xad/0x190
Feb  4 13:22:12 l kernel: [  342.973110] [<ffffffff811e94e4>] ? 
mntput+0x24/0x40
Feb  4 13:22:12 l kernel: [  342.977642] [<ffffffff811cab81>] ? 
__fput+0x181/0x260
Feb  4 13:22:12 l kernel: [  342.982066] [<ffffffff81624462>] 
__sys_sendmsg+0x42/0x80
Feb  4 13:22:12 l kernel: [  342.986430] [<ffffffff816244b2>] 
SyS_sendmsg+0x12/0x20
Feb  4 13:22:12 l kernel: [  342.990694] [<ffffffff8174d3bc>] 
system_call_fastpath+0x26/0x2b
Feb  4 13:22:12 l kernel: [  342.994897] Code: 7f 48 8b 78 20 e8 65 7e 
2b e1 48 8b bb 50 02 00 00 48 8b b5 50 ff ff ff 48 8d 95 60 ff ff ff e8 
8b dd 01 00 48 8b 05 9c 44 9b e1 <48> 83 78 18 00 0f 84 87 01 00 00 48 
8b 95 50 ff ff ff 48 8b bb
Feb  4 13:22:12 l kernel: [  343.008678] RIP [<ffffffffa036d7ec>] 
wg_socket_init+0x13c/0x3f0 [wireguard]
Feb  4 13:22:12 l kernel: [  343.013245]  RSP <ffff8800af9656e0>
Feb  4 13:22:12 l kernel: [  343.017746] CR2: 0000000000000018
Feb  4 13:22:12 l kernel: [  343.022234] ---[ end trace 7a6ac50ecd32399e 
]---


Any idea what could be the problem?

Regards,
Anatoli

[-- Attachment #1.2: Type: text/html, Size: 11419 bytes --]

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: BUG: unable to handle kernel NULL pointer dereference at .. (linux 3.13)
  2019-02-04 16:50 BUG: unable to handle kernel NULL pointer dereference at .. (linux 3.13) Anatoli
@ 2019-02-17  1:47 ` Jason A. Donenfeld
  2019-02-17  3:00   ` Anatoli
  0 siblings, 1 reply; 5+ messages in thread
From: Jason A. Donenfeld @ 2019-02-17  1:47 UTC (permalink / raw)
  To: Anatoli; +Cc: WireGuard mailing list

Hey Anatoli,

I just tried reproducing that and wasn't able to, using:

root@ubuntu:~# uname -a
Linux ubuntu 3.13.0-165-generic #215-Ubuntu SMP Wed Jan 16 11:46:47
UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

I updated the system to the latest 14.04 packages, rebooted, and then
cut and paste your directions above. Things seemed to go fine. Are you
able to reproduce in a fresh environment?

Also, could you email the crashing wireguard.ko, so that I can see
exactly which instruction corresponds with wg_socket_init+0x13c/0x3f0?

Thanks,
Jason
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: BUG: unable to handle kernel NULL pointer dereference at .. (linux 3.13)
  2019-02-17  1:47 ` Jason A. Donenfeld
@ 2019-02-17  3:00   ` Anatoli
  2019-02-17  3:57     ` Jason A. Donenfeld
  0 siblings, 1 reply; 5+ messages in thread
From: Anatoli @ 2019-02-17  3:00 UTC (permalink / raw)
  Cc: WireGuard mailing list


[-- Attachment #1.1: Type: text/plain, Size: 1310 bytes --]

Hi Jason,

 > Are you able to reproduce in a fresh environment?

I haven't tried a fresh environment as it is rather outdated, I have one 
server that runs OpenVPN now and I'd like to migrate it to WG, but I 
can't update the OS to a newer version at this moment. What I could do 
is to upgrade the kernel to 4.4 with Ubuntu HWE.

I'm attaching the loaded driver with this mail (I checked with modinfo 
it's the right file as there are different wireguard.ko files on the 
system).

Regards,
Anatoli

*From:* Jason A. Donenfeld <Jason@zx2c4.com>
*Sent:* Saturday, February 16, 2019 22:47
*To:* Anatoli <me@anatoli.ws>
*Cc:* Wireguard Mailing List <wireguard@lists.zx2c4.com>
*Subject:* Re: BUG: unable to handle kernel NULL pointer dereference at 
.. (linux 3.13)

Hey Anatoli,

I just tried reproducing that and wasn't able to, using:

root@ubuntu:~# uname -a
Linux ubuntu 3.13.0-165-generic #215-Ubuntu SMP Wed Jan 16 11:46:47
UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

I updated the system to the latest 14.04 packages, rebooted, and then
cut and paste your directions above. Things seemed to go fine. Are you
able to reproduce in a fresh environment?

Also, could you email the crashing wireguard.ko, so that I can see
exactly which instruction corresponds with wg_socket_init+0x13c/0x3f0?

Thanks,
Jason




[-- Attachment #1.2: Type: text/html, Size: 2479 bytes --]

[-- Attachment #2: wireguard.ko --]
[-- Type: application/octet-stream, Size: 288112 bytes --]

[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: BUG: unable to handle kernel NULL pointer dereference at .. (linux 3.13)
  2019-02-17  3:00   ` Anatoli
@ 2019-02-17  3:57     ` Jason A. Donenfeld
  2019-02-17  4:04       ` Anatoli
  0 siblings, 1 reply; 5+ messages in thread
From: Jason A. Donenfeld @ 2019-02-17  3:57 UTC (permalink / raw)
  To: Anatoli; +Cc: WireGuard mailing list

Hi Anatoli,

Thanks for the .ko. I've fixed the compat backport here:

https://git.zx2c4.com/WireGuard/commit/?id=e7348a19a45f4f1311df6266b654c7fc8d50f976

You can either apply that yourself, wait for a new snapshot, or reenable IPv6.

Jason
_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: BUG: unable to handle kernel NULL pointer dereference at .. (linux 3.13)
  2019-02-17  3:57     ` Jason A. Donenfeld
@ 2019-02-17  4:04       ` Anatoli
  0 siblings, 0 replies; 5+ messages in thread
From: Anatoli @ 2019-02-17  4:04 UTC (permalink / raw)
  Cc: WireGuard mailing list


[-- Attachment #1.1: Type: text/plain, Size: 643 bytes --]

Jason,

Thanks for a quick fix! If you plan to release a new snapshot in the 
near future, I guess I'll wait for it.

Regards,
Anatoli

*From:* Jason A. Donenfeld <Jason@zx2c4.com>
*Sent:* Sunday, February 17, 2019 00:57
*To:* Anatoli <me@anatoli.ws>
*Cc:* Wireguard Mailing List <wireguard@lists.zx2c4.com>
*Subject:* Re: BUG: unable to handle kernel NULL pointer dereference at 
.. (linux 3.13)

Hi Anatoli,

Thanks for the .ko. I've fixed the compat backport here:

https://git.zx2c4.com/WireGuard/commit/?id=e7348a19a45f4f1311df6266b654c7fc8d50f976

You can either apply that yourself, wait for a new snapshot, or reenable IPv6.

Jason




[-- Attachment #1.2: Type: text/html, Size: 1854 bytes --]

[-- Attachment #2: Type: text/plain, Size: 148 bytes --]

_______________________________________________
WireGuard mailing list
WireGuard@lists.zx2c4.com
https://lists.zx2c4.com/mailman/listinfo/wireguard

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-17 20:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-04 16:50 BUG: unable to handle kernel NULL pointer dereference at .. (linux 3.13) Anatoli
2019-02-17  1:47 ` Jason A. Donenfeld
2019-02-17  3:00   ` Anatoli
2019-02-17  3:57     ` Jason A. Donenfeld
2019-02-17  4:04       ` Anatoli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).