Skip to content

Argon2 via OpenSSL >= 3.2#9602

Draft
ThomasWaldmann wants to merge 8 commits into
borgbackup:masterfrom
ThomasWaldmann:argon2-via-openssl32
Draft

Argon2 via OpenSSL >= 3.2#9602
ThomasWaldmann wants to merge 8 commits into
borgbackup:masterfrom
ThomasWaldmann:argon2-via-openssl32

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

No description provided.

@codecov

codecov Bot commented May 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 48.14815% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.90%. Comparing base (9ba7241) to head (7f16bc3).
⚠️ Report is 3 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/borg/helpers/process.py 41.66% 10 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9602      +/-   ##
==========================================
+ Coverage   84.87%   84.90%   +0.02%     
==========================================
  Files          92       92              
  Lines       15165    15168       +3     
  Branches     2271     2275       +4     
==========================================
+ Hits        12872    12879       +7     
+ Misses       1589     1583       -6     
- Partials      704      706       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann ThomasWaldmann force-pushed the argon2-via-openssl32 branch 2 times, most recently from 745ffbd to b06e98b Compare May 11, 2026 20:55
@ThomasWaldmann ThomasWaldmann marked this pull request as draft May 11, 2026 20:55
@ThomasWaldmann

ThomasWaldmann commented May 11, 2026

Copy link
Copy Markdown
Member Author

Guess we need to wait for:

@ThomasWaldmann ThomasWaldmann force-pushed the argon2-via-openssl32 branch 9 times, most recently from 18e786b to 252cf06 Compare May 11, 2026 23:35
@ThomasWaldmann ThomasWaldmann force-pushed the argon2-via-openssl32 branch 4 times, most recently from 8232e39 to d70e1a5 Compare June 11, 2026 08:39
@ThomasWaldmann ThomasWaldmann force-pushed the argon2-via-openssl32 branch 4 times, most recently from 035b12d to f7e6aae Compare June 15, 2026 08:41
ThomasWaldmann and others added 8 commits June 15, 2026 15:05
- src/borg/crypto/low_level.pyx: implement `argon2_hash` using OpenSSL's
  `EVP_KDF` API for ARGON2 (requires OpenSSL >= 3.2.0).
- src/borg/crypto/key.py: switch to the native `argon2_hash` implementation,
  removing `argon2-cffi` dependency.
- setup.py: require OpenSSL >= 3.2.0 for the crypto extension to ensure
  ARGON2 KDF support is available.
- pyproject.toml: drop `argon2-cffi` dependency.
- docs: update installation requirements and security documentation to
  reflect the transition to OpenSSL for Argon2.
Bump all Ubuntu-based GitHub workflows from ubuntu-24.04 to ubuntu-26.04
(and ubuntu-24.04-arm to ubuntu-26.04-arm). Ubuntu 26.04 ships glibc 2.43,
so rename the built binaries from glibc239 to glibc243.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Currently, ubuntu-26.04 only has py314.
…d process

The foreground process installs SIGTERM/SIGHUP/SIGINT handlers (via
archiver.run) before it reaches the point where it actually waits for the
background (grandchild) process to notify it (via os.kill). If the
background process started up and signalled fast enough, the signal was
delivered to the foreground while it was still between os.fork() and the
waiting code, so the globally installed handler raised at an unexpected,
uncaught place. The signal then escaped daemonizing(), bubbled up through
repository teardown (NotLocked) and made "borg mount" exit with rc 74.

This was observed flaky in CI with coverage's sys.monitoring backend on
Python 3.14 (its first-branch lazy source parse widens the window) and the
pyfuse3 backend (faster grandchild startup).

Fix the race by blocking the notify signals before the fork in
_daemonize() and waiting for them atomically in the foreground. An early
signal then stays pending and is reliably picked up by the wait. The
background process restores the original signal mask so it keeps normal
signal handling.

Use signal.sigwait() plus a SIGALRM timer (signal.setitimer) for the
wait, rather than signal.sigtimedwait(): the latter does not exist on
macOS, where it would raise AttributeError in the foreground and let it
die before the background migrated the lock (breaking test_migrate_lock_alive).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
signal.SIGALRM does not exist on Windows, so referencing it at module
import time raised AttributeError, breaking the import chain (and the
Windows PyInstaller build). Guard it with hasattr, matching the
defensive getattr pattern already used for the notify signals.

Daemonizing is not supported on Windows anyway (no os.fork), so the
empty SIGALRM list has no functional effect there.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The archiver fixture's rmtree onerror handler called os.lchflags(path, 0)
when has_lchflags was True. But has_lchflags is also True on Linux (flags
are cleared via ioctl there), where os.lchflags does not exist, raising an
uncaught AttributeError and turning teardown into an ERROR. Use borg's
cross-platform platform.set_flags instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant