wg-quick segfaults when running in LXC -- apparmor
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| apparmor (Ubuntu) |
New
|
Undecided
|
Unassigned | ||
| net-tools (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
| wireguard (Ubuntu) |
Incomplete
|
Undecided
|
Unassigned | ||
Bug Description
On Ubuntu 25.10 running inside a Proxmox LXC container, any direct execution
of wg-quick (e.g. "wg-quick up wg0") results in a SIGSEGV. The same command
works perfectly when invoked via "bash /usr/bin/wg-quick up wg0".
Cause:
wg-quick has an AppArmor profile (/etc/apparmor.
wg-quick is execve()'d directly, LXC’s AppArmor+seccomp enforcement switches
to the wg-quick profile which denies some operations (likely ip/nft/sysctl),
causing the process to be killed and reported as a segmentation fault.
Placing the profile in complain mode fixes the issue:
"aa-complain wg-quick"
Disabling the profile also fixes it:
"aa-disable wg-quick"
Running wg-quick via bash bypasses the profile switch, so it works.
Expected:
wg-quick should not segfault in LXC environments. (Note, I did not reproduce the crash in docker, I do not have a non-virtualized ubuntu 25.10 to test in)
Actual:
wg-quick segfaults due to AppArmor enforcement on direct exec only.
Reproduction:
- Proxmox 8.x host
- Ubuntu 25.10 LXC container
- Install wireguard-tools
- Provide wg0.conf
- Run "wg-quick up wg0" → SIGSEGV
- Run "bash /usr/bin/wg-quick up wg0" → works normally
```
root@twentyfive
Description: Ubuntu 25.10
Release: 25.10
```
```
root@twentyfive
apparmor:
Installed: 5.0.0~alpha1-
Candidate: 5.0.0~alpha1-
Version table:
*** 5.0.0~alpha1-
500 http://
100 /var/lib/
5.
500 http://
root@twentyfive
wireguard:
Installed: 1.0.20210914-
Candidate: 1.0.20210914-
Version table:
*** 1.0.20210914-
500 http://
100 /var/lib/
root@twentyfive
wireguard-tools:
Installed: 1.0.20210914-
Candidate: 1.0.20210914-
Version table:
*** 1.0.20210914-
500 http://
100 /var/lib/
```
| tags: | added: server-triage-discuss |
| Changed in net-tools (Ubuntu): | |
| status: | New → Invalid |
| tags: | added: sec-8111 |

Thank you for this bug report, I can confirm the segfault in a Questing LXD container:
root@engaging- guinea: ~# aa-enforce wg-quick guinea: ~# strace wg-quick "/usr/bin/ wg-quick" , ["wg-quick"], 0x7ffdc0d05d40 /* 20 vars */) = -1 EACCES (Permission denied)
Setting /usr/bin/wg-quick to enforce mode.
Warning: profile wg-quick represents multiple programs
root@engaging-
execve(
+++ killed by SIGSEGV +++
Segmentation fault (core dumped)
Passes when in complain mode: guinea: ~# aa-complain wg-quick guinea: ~# wg-quick
root@engaging-
Setting /usr/bin/wg-quick to complain mode.
Warning: profile wg-quick represents multiple programs
Warning: profile wg-quick represents multiple programs
root@engaging-
Usage: wg-quick [ up | down | save | strip ] [ CONFIG_FILE | INTERFACE ]
[...]
See wg-quick(8) for more info and examples.
Passes via bash redirection: guinea: ~# bash wg-quick
root@engaging-
Usage: wg-quick [ up | down | save | strip ] [ CONFIG_FILE | INTERFACE ]
[...]
See wg-quick(8) for more info and examples.
I collected the following AppArmor denial logs:
Dez 03 12:23:40 abaconcy kernel: audit: type=1400 audit(176476102 0.244:103661) : apparmor="DENIED" operation= "file_mmap" class="file" namespace= "root// lxd-engaging- guinea_ <var-snap- lxd-common- lxd>" profile="wg-quick" name="/ usr/bin/ bash" pid=1402704 comm="wg-quick" requested_mask="r" denied_mask="r" fsuid=1000000 ouid=1000000 5.855:103660) : apparmor="DENIED" operation= "file_mmap" class="file" namespace= "root// lxd-engaging- guinea_ <var-snap- lxd-common- lxd>" profile="wg-quick" name="/ usr/bin/ bash" pid=1402695 comm="wg-quick" requested_mask="r" denied_mask="r" fsuid=1000000 ouid=1000000 2.289:103659) : apparmor="STATUS" operation= "profile_ replace" info="same as current profile, skipping" label=" lxd-engaging- guinea_ </var/snap/ lxd/common/ lxd>//& :lxd-engaging- guinea_ <var-snap- lxd-common- lxd>:unconfined " name="wg- quick// sysctl" pid=1402689 comm="apparmor_ parser" 2.288:103658) : apparmor="STATUS" operation= "profile_ replace" info="same as current profile, skipping" label=" lxd-engaging- guinea_ </var/snap/ lxd/common/ lxd>//& :lxd-engaging- guinea_ <var-snap- lxd-common- lxd>:unconfined " name="wg- quick// nft" pid=1402689 comm="apparmor_ parser" 2.288:103657) : apparmor="STATUS" operation= "profile_ replace" info="same as current profile, skipping" label=" lxd-engaging- guinea_ </var/snap/ lxd/common/ lxd>//& :lxd-engaging- guinea_ <var-snap- lxd-common- lxd>:unconfined " name="wg-quick//ip" pid=1402689 comm="apparmor_ parser" 2.281:103656) : apparmor="STATUS" operation= "profile_ replace" label=" lxd-engaging- guinea_ </var/snap/ lxd/common/ lxd>//& :lxd-engaging- guinea_ <var-snap- lxd-common- lxd>:unconfined " name="wg-quick" pid=1402689 comm="apparmor_ parser" 6.927:103655) : apparmor="ALLOWED" operation= "file_mmap" class="file" namespace= "root// lxd-engaging- guinea_ <...
Dez 03 12:23:35 abaconcy kernel: audit: type=1400 audit(176476101
Dez 03 12:23:32 abaconcy kernel: audit: type=1400 audit(176476101
Dez 03 12:23:32 abaconcy kernel: audit: type=1400 audit(176476101
Dez 03 12:23:32 abaconcy kernel: audit: type=1400 audit(176476101
Dez 03 12:23:32 abaconcy kernel: audit: type=1400 audit(176476101
Dez 03 12:23:26 abaconcy kernel: audit: type=1400 audit(176476100