qemu/crypto
Tiago Pasqualini c72cab5ad9 crypto: run qcrypto_pbkdf2_count_iters in a new thread
CPU time accounting in the kernel has been demonstrated to have a
sawtooth pattern[1][2]. This can cause the getrusage system call to
not be as accurate as we are expecting, which can cause this calculation
to stall.

The kernel discussions shows that this inaccuracy happens when CPU time
gets big enough, so this patch changes qcrypto_pbkdf2_count_iters to run
in a fresh thread to avoid this inaccuracy. It also adds a sanity check
to fail the process if CPU time is not accounted.

[1] https://lore.kernel.org/lkml/159231011694.16989.16351419333851309713.tip-bot2@tip-bot2/
[2] https://lore.kernel.org/lkml/20221226031010.4079885-1-maxing.lan@bytedance.com/t/#m1c7f2fdc0ea742776a70fd1aa2a2e414c437f534

Resolves: #2398
Signed-off-by: Tiago Pasqualini <tiago.pasqualini@canonical.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2024-09-09 15:13:38 +01:00
..
aes.c target/riscv: Use existing lookup tables for MixColumns 2023-09-11 11:45:54 +10:00
afalg.c misc/other: spelling fixes 2023-09-08 13:08:52 +03:00
afalgpriv.h crypto: Allocate QCryptoCipher with the subclass 2020-09-10 11:02:23 +01:00
afsplit.c crypto: use auto cleanup for many stack variables 2019-08-22 10:56:57 +01:00
akcipher-gcrypt.c.inc crypto: Implement RSA algorithm by gcrypt 2022-05-26 11:41:53 +01:00
akcipher-nettle.c.inc test/crypto: Add test suite for crypto akcipher 2022-05-26 11:41:54 +01:00
akcipher.c crypto: Support export akcipher to pkcs8 2022-11-02 06:56:32 -04:00
akcipherpriv.h crypto: Introduce akcipher crypto class 2022-05-26 11:41:47 +01:00
block-luks-priv.h crypto: Clean up includes 2023-02-08 07:16:23 +01:00
block-luks.c crypto/block-luks: make range overlap check more readable 2024-07-23 20:30:36 +02:00
block-luks.h crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
block-qcow.c crypto/block: drop qcrypto_block_open() n_threads argument 2024-06-10 11:05:43 +02:00
block-qcow.h crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
block.c crypto/block: drop qcrypto_block_open() n_threads argument 2024-06-10 11:05:43 +02:00
blockpriv.h crypto/block: drop qcrypto_block_open() n_threads argument 2024-06-10 11:05:43 +02:00
cipher-afalg.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
cipher-builtin.c.inc crypto: delete built-in XTS cipher mode support 2021-07-14 14:15:52 +01:00
cipher-gcrypt.c.inc crypto: query gcrypt for cipher availability 2024-03-19 20:17:12 +00:00
cipher-gnutls.c.inc crypto/cipher-gnutls.c: Clean up local variable shadowing 2023-09-29 10:07:16 +02:00
cipher-nettle.c.inc crypto: Introduce SM4 symmetric cipher algorithm 2024-02-09 12:47:55 +00:00
cipher.c crypto: Introduce SM4 symmetric cipher algorithm 2024-02-09 12:47:55 +00:00
cipherpriv.h crypto: Move cipher->driver init to qcrypto_*_cipher_ctx_new 2020-09-10 11:02:23 +01:00
clmul.c crypto: Add generic 64-bit carry-less multiply routine 2023-09-15 13:57:00 +00:00
der.c misc/other: spelling fixes 2023-09-08 13:08:52 +03:00
der.h misc/other: spelling fixes 2023-09-08 13:08:52 +03:00
hash-afalg.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
hash-gcrypt.c crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
hash-glib.c crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
hash-gnutls.c crypto: add gnutls hash provider 2021-07-14 14:15:52 +01:00
hash-nettle.c crypto: drop back compatibility typedefs for nettle 2021-06-02 07:04:55 +02:00
hash.c crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
hashpriv.h crypto: hash: add afalg-backend hash support 2017-07-19 10:11:05 +01:00
hmac-gcrypt.c qapi: Mechanically convert FOO_lookup[...] to FOO_str(...) 2017-09-04 13:09:13 +02:00
hmac-glib.c glib: bump min required glib library version to 2.48 2019-08-22 10:46:34 +01:00
hmac-gnutls.c crypto: add gnutls hmac provider 2021-07-14 14:15:52 +01:00
hmac-nettle.c crypto: drop back compatibility typedefs for nettle 2021-06-02 07:04:55 +02:00
hmac.c Include qapi/error.h exactly where needed 2018-02-09 13:50:17 +01:00
hmacpriv.h bulk: Do not declare function prototypes using 'extern' keyword 2023-08-31 19:47:43 +02:00
init.c crypto: drop gnutls debug logging support 2024-07-24 10:39:10 +01:00
ivgen-essiv.c crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
ivgen-essiv.h crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
ivgen-plain64.c crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
ivgen-plain64.h crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
ivgen-plain.c crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
ivgen-plain.h Clean up ill-advised or unusual header guards 2022-05-11 16:50:01 +02:00
ivgen.c crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
ivgenpriv.h crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
meson.build crypto: only include tls-cipher-suites in emulators 2023-10-03 10:29:39 +02:00
pbkdf-gcrypt.c crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
pbkdf-gnutls.c crypto: add gnutls pbkdf provider 2021-07-14 14:15:52 +01:00
pbkdf-nettle.c crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
pbkdf-stub.c crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
pbkdf.c crypto: run qcrypto_pbkdf2_count_iters in a new thread 2024-09-09 15:13:38 +01:00
random-gcrypt.c crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
random-gnutls.c crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
random-none.c crypto: add "none" random provider 2020-06-15 11:33:50 +01:00
random-platform.c crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00
rsakey-builtin.c.inc crypto/rsakey-builtin.c.inc: Clean up two error paths 2023-11-07 14:54:56 +00:00
rsakey-nettle.c.inc crypto: Implement RSA algorithm by hogweed 2022-05-26 11:41:51 +01:00
rsakey.c crypto: Support export akcipher to pkcs8 2022-11-02 06:56:32 -04:00
rsakey.h crypto: Support export akcipher to pkcs8 2022-11-02 06:56:32 -04:00
secret_common.c crypto: make loaded property read-only 2022-05-14 12:33:44 +02:00
secret_keyring.c crypto: Move USER_CREATABLE to secret_common base class 2021-01-29 17:07:53 +00:00
secret.c crypto: Move USER_CREATABLE to secret_common base class 2021-01-29 17:07:53 +00:00
sm4.c crypto: Add SM4 constant parameter CK 2023-09-11 11:45:55 +10:00
tls-cipher-suites.c crypto: remove shadowed 'ret' variable 2023-09-29 10:07:20 +02:00
tlscreds.c crypto/tlscreds: Introduce qcrypto_tls_creds_check_endpoint() helper 2021-06-29 18:29:43 +01:00
tlscredsanon.c crypto: make loaded property read-only 2022-05-14 12:33:44 +02:00
tlscredspriv.h crypto: Make QCryptoTLSCreds* structures private 2021-06-29 18:30:24 +01:00
tlscredspsk.c crypto/tlscredspsk: Free username on finalize 2024-08-20 00:49:14 +02:00
tlscredsx509.c crypto: make loaded property read-only 2022-05-14 12:33:44 +02:00
tlssession.c crypto: propagate errors from TLS session I/O callbacks 2024-07-24 10:39:10 +01:00
trace-events docs: fix references to docs/devel/tracing.rst 2021-06-02 06:51:09 +02:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
xts.c crypto: Fix LGPL information in the file headers 2019-07-19 14:21:25 +01:00