Bug 1226463

Summary: algif_hash in kernel-obs-build causes an openssl-1_1 test failure
Product: [openSUSE] openSUSE Tumbleweed Reporter: Jiri Slaby <jslaby>
Component: KernelAssignee: Pedro Monreal Gonzalez <pmonrealgonzalez>
Status: NEW --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: fvogt, marco.strigl, msuchanek
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: diff of lsinitrd

Description Jiri Slaby 2024-06-18 07:18:27 UTC
Created attachment 875539 [details]
diff of lsinitrd

From https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:K/openssl-1_1/standard/x86_64 :

> [  248s] ../test/recipes/30-test_afalg.t                  (Wstat: 256 (exited 1) Tests: 1 Failed: 1)

Comparing /proc/modules in the build VM shows:
+algif_hash 12288 0 - Live 0x0000000000000000 (E)
+af_alg 36864 1 algif_hash, Live 0x0000000000000000 (E)

So apparently, algif_hash brings af_alg and that for some unknown reason breaks the test.

If I rm algif_hash from KERNEL_MODULES, it works again.
Comment 1 Jiri Slaby 2024-06-18 07:19:00 UTC
It was introduced in:
commit bfd7db420f2993e1228e6413ab3e6d6033ff73db
Refs:
Author:     Fabian Vogt <fvogt@suse.de>
AuthorDate: Tue Apr 19 15:01:49 2022 +0200
Commit:     Fabian Vogt <fvogt@suse.de>
CommitDate: Wed Jun 12 11:17:48 2024 +0200

    rpm/kernel-obs-build.spec.in: Include algif_hash, aegis128 and xts modules
Comment 2 Jiri Slaby 2024-06-18 07:37:47 UTC
Without the module loaded:
# INFO:  @ test/afalgtest.c:133
# Can't load AFALG engine
1..0 # Skipped: ./test/afalgtest

With the module loaded:
    # Subtest: test_afalg_aes_cbc
    1..3
ALG_PERR: engines/e_afalg.c(383): Failed to bind socket : No such file or directory
    # ERROR: (bool) 'EVP_CipherInit_ex(ctx, cipher, e, key, iv, 1) == true' fail
ed @ test/afalgtest.c:73
    # false
    # 139906561836864:error:80065067:lib(128):afalg_create_sk:socket bind failed
:engines/e_afalg.c:384:
    not ok 1 - iteration 1
ALG_PERR: engines/e_afalg.c(383): Failed to bind socket : No such file or directory
    # ERROR: (bool) 'EVP_CipherInit_ex(ctx, cipher, e, key, iv, 1) == true' fail
ed @ test/afalgtest.c:73
    # false
    # 139906561836864:error:80065067:lib(128):afalg_create_sk:socket bind failed
:engines/e_afalg.c:384:
    not ok 2 - iteration 2
ALG_PERR: engines/e_afalg.c(383): Failed to bind socket : No such file or directory
    # ERROR: (bool) 'EVP_CipherInit_ex(ctx, cipher, e, key, iv, 1) == true' fail
ed @ test/afalgtest.c:73
    # false
    # 139906561836864:error:80065067:lib(128):afalg_create_sk:socket bind failed
:engines/e_afalg.c:384:
    not ok 3 - iteration 3
not ok 1 - test_afalg_aes_cbc
ok 2 - test_pr16743


And according to strace:
23186 bind(3, {sa_family=AF_ALG, salg_type="skcipher", salg_feat=0, salg_mask=0, salg_name="cbc(aes)"}, 88) = -1 ENOENT (No such file or directory)

So apparently cbc(aes) is needed for the test, if afalg is available.

We likely need to disable that test in openssl.

For the time being, I am dropping algif_hash from KERNEL_MODULES.
Comment 3 Jiri Slaby 2024-06-18 07:43:06 UTC
Some notes:

When the build fails, "osc shell" and then:
1) either:
cd rpmbuild/BUILD/openssl-1.1.1w
LD_LIBRARY_PATH=`pwd` make test -j1 TESTS=test_afalg
2) or:
cd rpmbuild/BUILD/openssl-1.1.1w
LD_LIBRARY_PATH=`pwd` OPENSSL_ENGINES=`pwd`/engines ./test/afalgtest
Comment 4 Jiri Slaby 2024-07-15 07:35:41 UTC
Any updates here?
Comment 5 Fabian Vogt 2024-07-15 08:25:06 UTC
Apparently if af_alg is available, openssl tries to test various algorithms, even those not actually available. IMO an openssl bug.