All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	devel@lists.libvirt.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
	"Cédric Le Goater" <clg@redhat.com>
Subject: [PULL v2 10/13] crypto: deprecate the AF_ALG crypto backend
Date: Fri,  4 Sep 2026 17:06:40 +0100	[thread overview]
Message-ID: <20260904160643.353833-11-berrange@redhat.com> (raw)
In-Reply-To: <20260904160643.353833-1-berrange@redhat.com>

Linux 7.2 has deprecated the AF_ALG crypto backend:

  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a67afb1884ba815079bd43d5c998e155e03b08b6

And has documented it to be always slower than userspace crypto:

  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5624ea54f3ba5c83d2e5503411a31a8be0278c1e

as a result of dropping support for zero-copy and hardware
accelerators:

  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7524070f26d8d347c26787dc297fb844baa26abf
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ffdd2bc378953b525aca61902534e753f1f8e734

The main use case for the AF_ALG impl was to improve the performance
of virtio-crypto with the cryptodev-backend-builtin driver. In
practice this did not matter since 'cryptodev-backend-lkcf' can do
offload to the kernel via the keyctl syscall, and 'cryptodev-vhost-user'
can offload to an external process which can optionally integrate with
hardware accelerators without kernel assistance.

The AF_ALG backend has no user visible configuration options at runtime,
it is unconditionally tried with any use of the cipher APIs. So it does
not strictly have to go through the deprecation process, however, it is
left available initially in case there was an unexpected use case that
relies on it which may be faster with old kernels before the above Linux
commits.

Suggested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 docs/about/deprecated.rst | 21 +++++++++++++++++++++
 meson.build               |  6 ++++++
 2 files changed, 27 insertions(+)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 05e4ce8cf1..98c32991c9 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -434,6 +434,27 @@ ABI is long-obsolete. We are therefore deprecating both OABI support
 and NWFPE emulation, and they will be removed in a future QEMU
 release.
 
+Build features
+--------------
+
+Crypto AF_ALG backend (since 11.2)
+----------------------------------
+
+The use of the AF_ALG backend for cryptography has been deprecated
+with no replacement.
+
+The AF_ALG interface is deprecated by Linux 7.2 and all support
+for hardware accelerators has been removed. It will thus always be
+slower than userspace crypto due to the overhead of copying data
+to kernel space. The GNUTLS, Nettle and GCrypt libraries supported
+by QEMU all include a variety of hardware optimized crypto
+implementations which should suffice for typical needs.
+
+For the virtio-crypto device, the 'cryptodev-backend-lkcf' backend
+can offload some operations to the kernel via the keyctl syscall,
+and the 'cryptodev-vhost-user' backend can offload the device
+backend to an external process which can integrate with crypto
+accelerators.
 
 Backwards compatibility
 -----------------------
diff --git a/meson.build b/meson.build
index 5c9de307b0..8528db72af 100644
--- a/meson.build
+++ b/meson.build
@@ -5070,3 +5070,9 @@ if not actually_reloc and (host_os == 'windows' or get_option('relocatable'))
   message('QEMU will have to be installed under ' + get_option('prefix') + '.')
   message('Use --disable-relocatable to remove this warning.')
 endif
+
+if get_option('crypto_afalg').enabled()
+    warning('Use of the AF_ALG crypto backend is deprecated, ' +
+            'since Linux 7.2 has deprecated the AF_ALG interface ' +
+            'and removed its ability to use hardware accelerators.')
+endif
-- 
2.55.0



  parent reply	other threads:[~2026-09-04 16:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 16:06 [PULL v2 00/13] Misc fixes patches Daniel P. Berrangé
2026-09-04 16:06 ` [PULL v2 01/13] crypto: Use g_autofree Daniel P. Berrangé
2026-09-04 16:06 ` [PULL v2 02/13] crypto/x509-utils: don't double set errp Daniel P. Berrangé
2026-09-04 16:06 ` [PULL v2 03/13] crypto/x509-utils: propagate the error Daniel P. Berrangé
2026-09-04 16:06 ` [PULL v2 04/13] io/channel-socket: do not treat a zero length write as an error Daniel P. Berrangé
2026-09-04 16:06 ` [PULL v2 05/13] io/channel-websock: send an HTTP 400 when the greeting has no space Daniel P. Berrangé
2026-09-04 16:06 ` [PULL v2 06/13] io/channel-websock: handle a blocked write during the handshake Daniel P. Berrangé
2026-09-04 16:06 ` [PULL v2 07/13] tests/unit: add websock handshake test Daniel P. Berrangé
2026-09-04 16:06 ` [PULL v2 08/13] io/channel-websock: do not lose QIO_CHANNEL_ERR_BLOCK while reading Daniel P. Berrangé
2026-09-04 16:06 ` [PULL v2 09/13] tests/unit: cover blocked IO during the websock handshake Daniel P. Berrangé
2026-09-04 16:06 ` Daniel P. Berrangé [this message]
2026-09-04 16:06 ` [PULL v2 11/13] gitlab: use --emacs --quiet for checkpatch.pl instead of --terse Daniel P. Berrangé
2026-09-04 16:06 ` [PULL v2 12/13] configure: correctly honour --disable-containers Daniel P. Berrangé
2026-09-07 10:48   ` Daniel P. Berrangé
2026-09-04 16:06 ` [PULL v2 13/13] docs/system/security: exclude uninitialized stack variables as bugs Daniel P. Berrangé
2026-09-06 14:14 ` [PULL v2 00/13] Misc fixes patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260904160643.353833-11-berrange@redhat.com \
    --to=berrange@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=clg@redhat.com \
    --cc=devel@lists.libvirt.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@oss.qualcomm.com \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.