Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ovpn-dco: kernel errors about use after free, memleak on Linux 6.1.12 #23

Closed
sebidotorg opened this issue Feb 23, 2023 · 14 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@sebidotorg
Copy link

sebidotorg commented Feb 23, 2023

Describe the bug
After many dozens of messages about “deleting peer”, mainly due to ”reason 1” and “reason 4”, some due to “reason 2” (said peer being a mobile phone during a train journey), with the last 18 of these messages being 12 times “reason 4”, once “reason 2”, and again five times “reason 4”, the kernel suddenly reported errors about “use after free” and “leaking memory”. dmesg output follows:

[540333.750165] ------------[ cut here ]------------
[540333.750184] refcount_t: underflow; use-after-free.
[540333.750337] WARNING: CPU: 2 PID: 246859 at lib/refcount.c:28 0xffffffff93084052
[540333.750346] Modules linked in: ovpn_dco(O)
[540333.750357] CPU: 2 PID: 246859 Comm: kworker/2:1 Tainted: G           O    T  6.1.12 OpenVPN/openvpn#1 
[540333.750365] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1~nc9+4 04/01/2014
[540333.750367] Workqueue: ovpn-event-wq-vpn1 0xffffffffc0604dc0
[540333.750381] RIP: 0010:0xffffffff93084052
[540333.750383] Code: 0b 31 f6 31 ff c3 cc cc cc cc 80 3d ee 00 c2 00 00 0f 85 71 ff ff ff 48 c7 c7 50 68 b5 93 c6 05 da 00 c2 00 01 e8 72 a3 43 00 <0f> 0b 31 f6 31 ff c3 cc cc cc cc 80 3d c1 00 c2 00 00 0f 85 46 ff
[540333.750386] RSP: 0018:ffffa8c9c8abfdb0 EFLAGS: 00010246
[540333.750402] RAX: 0000000000000000 RBX: ffff9007eeb70800 RCX: 0000000000000000
[540333.750421] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[540333.750423] RBP: ffff900753fc07c0 R08: 0000000000000000 R09: 0000000000000000
[540333.750425] R10: 0000000000000000 R11: 0000000000000000 R12: ffff9007eeb70984
[540333.750427] R13: ffff9007fb38ae00 R14: ffff900973d21c80 R15: ffff9007eeb70da8
[540333.750438] FS:  0000000000000000(0000) GS:ffff900973d00000(0000) knlGS:0000000000000000
[540333.750443] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[540333.750445] CR2: 00007f4bcaff4dc8 CR3: 000000010bd96003 CR4: 0000000000370ea0
[540333.750447] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[540333.750448] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[540333.750450] Call Trace:
[540333.750488]  <TASK>
[540333.750492]  0xffffffffc05fefb7
[540333.750528]  0xffffffffc0604d76
[540333.750530]  0xffffffffc0604ddd
[540333.750532]  0xffffffff92ccbd77
[540333.750575]  0xffffffff92ccbf0f
[540333.750577]  ? 0xffffffff92ccbec0
[540333.750588]  0xffffffff92cd2d6b
[540333.750610]  ? 0xffffffff92cd2cb0
[540333.750611]  0xffffffff92c01d02
[540333.750647]  </TASK>
[540333.750648] ---[ end trace 0000000000000000 ]---
[540333.750665] ------------[ cut here ]------------
[540333.750666] refcount_t: saturated; leaking memory.
[540333.750676] WARNING: CPU: 2 PID: 246859 at lib/refcount.c:19 0xffffffff93084000
[540333.750679] Modules linked in: ovpn_dco(O)
[540333.750682] CPU: 2 PID: 246859 Comm: kworker/2:1 Tainted: G        W  O    T  6.1.12 OpenVPN/openvpn#1 
[540333.750685] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1~nc9+4 04/01/2014
[540333.750687] Workqueue: ovpn-event-wq-vpn1 0xffffffffc0604dc0
[540333.750689] RIP: 0010:0xffffffff93084000
[540333.750690] Code: a3 43 00 0f 0b 31 f6 31 ff c3 cc cc cc cc 80 3d 3f 01 c2 00 00 75 c3 48 c7 c7 f8 67 b5 93 c6 05 2f 01 c2 00 01 e8 c4 a3 43 00 <0f> 0b 31 f6 31 ff c3 cc cc cc cc 80 3d 16 01 c2 00 00 75 9c 48 c7
[540333.750692] RSP: 0018:ffffa8c9c8abfdd8 EFLAGS: 00010246
[540333.750694] RAX: 0000000000000000 RBX: ffff9007eeb70800 RCX: 0000000000000000
[540333.750696] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[540333.750697] RBP: 000000000000006c R08: 0000000000000000 R09: 0000000000000000
[540333.750699] R10: 0000000000000000 R11: 0000000000000000 R12: ffffc8c9bfd26600
[540333.750700] R13: 0000000000000000 R14: ffff900973d21c80 R15: ffff9007eeb70da8
[540333.750702] FS:  0000000000000000(0000) GS:ffff900973d00000(0000) knlGS:0000000000000000
[540333.750715] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[540333.750717] CR2: 00007f4bcaff4dc8 CR3: 000000010bd96003 CR4: 0000000000370ea0
[540333.750718] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[540333.750720] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[540333.750721] Call Trace:
[540333.750722]  <TASK>
[540333.750723]  0xffffffffc0604d9b
[540333.750725]  0xffffffffc0604ddd
[540333.750727]  0xffffffff92ccbd77
[540333.750728]  0xffffffff92ccbf0f
[540333.750729]  ? 0xffffffff92ccbec0
[540333.750731]  0xffffffff92cd2d6b
[540333.750732]  ? 0xffffffff92cd2cb0
[540333.750733]  0xffffffff92c01d02
[540333.750735]  </TASK>
[540333.750736] ---[ end trace 0000000000000000 ]---

Version information (please complete the following information):

  • OS: Debian stable/testing with custom kernel 6.1.12 and openvpn-dco-dkms
  • OpenVPN version: OpenVPN 2.6.0 x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] [DCO]
  • DCO module version: ovpn-dco-0.0+git20230125
  • Compiler version: gcc (Debian 12.2.0-14) 12.2.0

I hope this helps you find the problem. I can give you access to my kernel config and headers on request.

@ordex ordex transferred this issue from OpenVPN/openvpn Feb 23, 2023
@ordex
Copy link
Member

ordex commented Feb 23, 2023

[I moved the issue to the proper project]

Thanks for the report @sebidotorg !
Too bad that there is no proper stacktrace, however, your description along with the warning message gives us already a rough direction.

Will update the issue as I discover something more concrete!

@sebidotorg
Copy link
Author

sebidotorg commented Feb 23, 2023 via email

@ordex ordex self-assigned this Mar 24, 2023
@ordex ordex added the bug Something isn't working label Mar 24, 2023
@ordex
Copy link
Member

ordex commented Mar 24, 2023

Hi, sorry for the delay but I Was busy with other major features which had a strict deadline. now we can move on!
Options depend on the exact kernel version. Can you have a look at what is suggested here: https://kernelnewbies.org/FAQ/StackTrace ?

However, is this something that was easy to reproduce?

(and please use the latest ovpn-dco master branch and openvpn 2.6.2)

@sebidotorg
Copy link
Author

sebidotorg commented Mar 27, 2023 via email

@bernhardschmidt
Copy link

Hi Sebastian,

openvpn 2.6.2 and an updated ovpn-dco have been uploaded to Debian experimental yesterday.

https://packages.debian.org/experimental/openvpn
https://packages.debian.org/experimental/openvpn-dco-dkms

Can you try those? I have to apply for a release team exception because we are already in freeze, fixing confirmed bugs would certainly help.

@sebidotorg
Copy link
Author

sebidotorg commented Mar 27, 2023 via email

@ordex
Copy link
Member

ordex commented Mar 28, 2023

Thanks @sebidotorg ! Looking forward to your update!

@sebidotorg
Copy link
Author

sebidotorg commented Apr 5, 2023 via email

@cron2
Copy link
Contributor

cron2 commented Apr 5, 2023 via email

@sebidotorg
Copy link
Author

sebidotorg commented Apr 5, 2023 via email

@bernhardschmidt
Copy link

OpenVPN 2.6.3 and DCOv2 have landed in Testing yesterday and are en-route for the Bookworm release. It looks like this bug has been fixed with DCOv2, so I propose to close it.

@sebidotorg
Copy link
Author

sebidotorg commented May 9, 2023 via email

@cron2
Copy link
Contributor

cron2 commented May 10, 2023

Happy to hear that this bug has been fixed with the v2 rewrite :-) - so, closing, as instructed!

@cron2 cron2 closed this as completed May 10, 2023
@ordex
Copy link
Member

ordex commented May 10, 2023

Thank you very much for your feedback guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants