1344 Commits

Author SHA1 Message Date
Arsolitt
ac946a9df1 fix: race condition in jp_spec_setup causing use-after-free
mutex_init(&spec->lock) was called in jp_spec_setup while another
thread could be holding the lock in jp_spec_applymods. Re-initializing
a locked mutex corrupts its state, allowing both threads to enter
the critical section simultaneously.

This caused use-after-free when:
1. send.c holds spec->lock, uses spec->pkt
2. jp_spec_setup re-inits the locked mutex (broken state)
3. jp_spec_setup acquires the "lock" immediately
4. jp_spec_setup does kfree(spec->pkt)
5. send.c continues using freed memory -> crash

Fix: move mutex_init to wg_newlink where it's called once during
device creation, before any concurrent access.
v1.0.20260329-2
2026-03-29 16:44:01 +01:00
Arsolitt
7239c05579 fix: memory corruption in jp_spec_setup causing kernel crash
When I1-I5 parameters are configured, jp_spec_setup() had two critical bugs:

1. spec->mods_size was not reset to 0 before the fill loop, causing
   out-of-bounds write to spec->mods array. This resulted in garbage
   function pointers being called in jp_spec_applymods(), triggering
   'kernel tried to execute NX-protected page' crash.

2. Memory leaks: old pkt, mods, and desc were not freed on reconfiguration.

Fixes:
- Reset spec->mods_size = 0 before fill loop in jp_spec_setup()
- Free old pkt/mods before reallocation in jp_spec_setup()
- Free old desc before reallocation in netlink.c
- Complete cleanup in jp_spec_free()
2026-03-29 16:44:01 +01:00
Yaroslav Gurov
ac8e22c264 fix: remove redundant compat header includes v1.0.20260329 2026-03-29 16:16:16 +01:00
Yaroslav Gurov
b52ea88244 fix: wrap all usages of simd in guards 2026-03-29 16:16:16 +01:00
noctuum
26f5df04ec compat: fix compilation on kernels >= 6.19 (blake2s API change) (#145)
* compat: fix compilation on kernels >= 6.19 (blake2s API change)

Kernel 6.19 refactored the blake2s API in include/crypto/blake2s.h:
- struct blake2s_state was renamed to blake2s_ctx
- blake2s() argument order changed from (out, in, key, outlen, inlen, keylen)
  to (key, keylen, in, inlen, out, outlen)

Add a compat macro to alias blake2s_state to blake2s_ctx, and guard the
three blake2s() call sites in noise.c and cookie.c with ifdef to use the
correct argument order depending on kernel version.

Tested on kernel 6.19.6-zen1-1-zen (Arch Linux).

* compat: use new blake2s API as default, add fallback for old kernels

Rework the blake2s compat approach per maintainer feedback: use the
kernel 6.19+ API (blake2s_ctx struct, new argument order) directly in
source files, and provide a self-referencing macro in compat.h that
remaps the call to the old signature on kernels < 6.19.

This follows the project convention of keeping sources aligned with
mainline and isolating all backward compatibility in compat.h.

* fix: add blake2s inclusion before using its internal method for compat

---------

Co-authored-by: Yaroslav Gurov <ygurov@proton.me>
v1.0.20260322
2026-03-22 00:01:11 +00:00
Petro
c529d3c138 Fix network stats reported for default 6.8 kernels on Ubuntu 24.04
Driver has compat switch, where new reporting method is activated for modern kernels (see issue #120 and PR #129 ).
Ubuntu 24.04 has kernel version 6.8.0-100 as default via `linux-image` package where `tstat` reporting method looks broken, and compat mode has to be relaxed to cover 6.8 kernels as well
v1.0.20260210
2026-02-10 11:16:01 +01:00
Kirill Shtumf
b2e234ba31 compat: fix compilation on Ubuntu 20.04 with kernel 5.4.223
Disabled COMPAT_INIT_CRYPTO and timer_delete for Ubuntu kernels to avoid symbol collision due to backported features.
2025-12-29 22:08:05 +01:00
Slava-Shchipunov
61b1e904e9 fix: use ifdef for COMPAT_CANNOT_USE_PCPU_STAT_TYPE (#129)
* fix: remove COMPAT_CANNOT_USE_PCPU_STAT_TYPE guard

The compatibility guard breaks ndo_get_stats64 registration on recent kernels, causing missing or incorrect network statistics reporting.

Signed-off-by: Slava-Shchipunov <92646230+Slava-Shchipunov@users.noreply.github.com>

* fix: use ifdef for COMPAT_CANNOT_USE_PCPU_STAT_TYPE

Signed-off-by: Slava-Shchipunov <92646230+Slava-Shchipunov@users.noreply.github.com>

---------

Signed-off-by: Slava-Shchipunov <92646230+Slava-Shchipunov@users.noreply.github.com>
2025-12-29 13:17:53 +01:00
Yaroslav Gurov
866b0abe82 fix: compat for kernels less than 3.13 v1.0.20251104 2025-11-04 12:25:20 +01:00
Yaroslav Gurov
b96e12d001 fix: compat with 3.10 kernels 2025-10-19 13:39:10 +02:00
Yaroslav Gurov
16671add12 fix: compat for ubuntu 22.04 2025-10-19 13:37:18 +02:00
Yaroslav Gurov
eaffd2bed6 fix: compilation under Debian 11 2025-10-17 10:15:55 +02:00
ph4
931ffada73 RHEL 9 compat
Add RHEL9 compatibility (5.14 kernel with patches)
2025-10-17 01:32:38 +02:00
Yaroslav Gurov
1a030837f9 chore: bump version v1.0.20251009 2025-10-09 18:29:35 +02:00
Yaroslav Gurov
b66f1a2891 chore: sync mainstream 2025-10-09 18:29:35 +02:00
Yaroslav Gurov
87a06ff146 fix: memleak in jp_spec_setup due to uninit pkt_size 2025-10-06 15:28:56 +02:00
Yaroslav Gurov
876bf7571e fix: adjust compat versions for random and dev stats 2025-10-04 15:43:01 +02:00
Yaroslav Gurov
8a55ceb761 fix: adjust package version in dkms v1.0.20251004 2025-10-04 12:14:51 +02:00
Yaroslav Gurov
b0db37dd17 fix: dkms build adjusted to the new(old) build system 2025-10-03 18:11:34 +02:00
Yaroslav Gurov
591f50af05 chore: add vscode-specific values to gitignore 2025-10-02 13:00:55 +02:00
Yaroslav Gurov
97f8eb182e chore: update copyrights 2025-10-02 13:00:55 +02:00
Yaroslav Gurov
610587f09a chore: refactor wg struct
* get rid of advanced_security struct, merge all child to wg
* naming reworks
* get rid of redundant allocations
* general cleanup
2025-10-02 13:00:55 +02:00
Yaroslav Gurov
e543fc2d7f feat: implement I1-I5 CPS-specified packets 2025-10-02 13:00:55 +02:00
Yaroslav Gurov
613e5d5410 feat: implement S3-S4 junked offsets
* rework junked headers sending
* get rid of redundant allocations
2025-10-02 13:00:55 +02:00
Yaroslav Gurov
e939553f72 feat: implement H1-H4 ranged headers 2025-10-02 13:00:55 +02:00
Yaroslav Gurov
9eb888d250 chore: sync with mainstream wireguard
* apply changes from recent kernel
* extended compatibility layer
2025-10-02 13:00:55 +02:00
Yaroslav Gurov
3d1147e1fb feat: reworked build system
* change approach from patch-based to a common build
    * get rid of all patch files
    * remove "modern kernel" definition from the project
2025-10-02 13:00:55 +02:00
lunardunno
b91fabacfa Clarification of the values ​​specified in the "configuration" section (#79) 2025-06-02 18:49:21 +01:00
Iurii Egorov
7e7dfca6b2 Fix get_random_u8() absence in older kernels
Signed-off-by: Iurii Egorov <ye@amnezia.org>
2024-11-15 09:56:58 +00:00
Iurii Egorov
7596c5c278 Support prefixed bogus endpoints' addresses
Signed-off-by: Iurii Egorov <ye@amnezia.org>
v1.0.20241112
2024-11-12 13:26:44 +00:00
Iurii Egorov
e53879f523 Fix Makefile for dpkg-buildpackage v1.0.20241023 2024-10-23 13:37:56 +03:00
Iurii Egorov
e882483f87 Add parameter to obfuscate endpoints in netlink get device response 2024-10-23 13:15:11 +03:00
Iurii Egorov
6301e3add4 Fix kernel download for newer Fedora kernels, and Ubuntu 24 package build fixes v1.0.20241022 2024-10-22 15:32:56 +03:00
Iurii Egorov
7fd8528466 Fix dkms build again 2024-10-21 13:15:56 +03:00
tiaga
515fbf63d4 Extend README.md about debug logging (#38) 2024-10-18 20:07:19 +07:00
ValdikSS
8d1b073205 Fix for patches in Makefile 2024-09-18 18:49:01 +03:00
ValdikSS
dc17712fda Fix dkms build one more time
Debian provides dh-sequence-dkms since at least 10, but Ubuntu
does not at least in 20.04.

dh-dkms is also packaged separately only on the latest Ubuntu version.

Use "or" hack to select the most preferable package.
2024-09-18 18:48:04 +03:00
ValdikSS
d7beb9f7f9 Fix debian dpkg-buildpackage local build 2024-09-18 15:43:28 +03:00
Iurii Egorov
4f60d10d21 Fix for non-linear skb 2024-09-15 20:53:14 +03:00
Iurii Egorov
5fbaee7526 Auth notifications for unknown peers 2024-09-09 13:32:50 +03:00
Iurii Egorov
8eb278b208 Support for legacy clients (#16) 2024-09-03 14:48:06 +03:00
Yoh Deadfall
f097b4441c Fixed typos in readme 2024-09-03 10:47:36 +03:00
Iurii Egorov
c98173803a Build fixes for newer kernels (#13)
* Hotfix: installation on modern kernels

* Cleanup kernel sources and final RPM package fix

* Notice in README regarding EPEL and DKMS.
2024-08-05 18:14:38 +03:00
tiaga
a0f9c4c1fe Update README.md (#11)
Update recomended values for AmneziaWG parameters.
2024-07-16 23:17:17 +07:00
Sergey Bondarev
85d637ea55 set version in Makefile.
Fix kernel source directory
2024-07-11 16:44:32 +03:00
tiaga
52e4134b4d Recommended parameters values
Add recomended values for AmneziaWG parameters.
2024-06-14 15:25:53 +03:00
Iurii Egorov
baf34a93ce Add AmneziaWG protocol improvements (#3)
* Add Amnezia VPN protocol

* Fix incorrect post config empty asc handling

* Build changes to engage more distros

* Improve parameter handling and add handshake debugging

* Small cosmetic changes

* Small cosmetic changes

* Small cosmetic changes

* Update main.c copyright

Signed-off-by: pokamest <pokamest@gmail.com>

---------

Signed-off-by: pokamest <pokamest@gmail.com>
Co-authored-by: pokamest <pokamest@gmail.com>
2024-03-22 18:37:03 +03:00
Jason A. Donenfeld
3d3c92b471 compat: drop CentOS 8 Stream support
Nobody uses this and it's impossible to maintain given the current CI
situation.

RHEL 7 and 8 release remain for now, though that might not always be the
case. See the link for details.

Link: https://lists.zx2c4.com/pipermail/wireguard/2022-June/007664.html
Suggested-by: Philip J. Perry <phil@elrepo.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2022-06-29 15:36:49 +02:00
Jason A. Donenfeld
99935b07b4 compat: do not backport ktime_get_coarse_boottime_ns to c8s
Also bump the c8s version stamp.

Reported-by: Vladimír Beneš <vbenes@redhat.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2022-06-28 12:44:18 +02:00
Jason A. Donenfeld
18fbcd68a3 version: bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
v1.0.20220627
2022-06-27 12:54:37 +02:00