libreswan / libreswan

libreswan
https://libreswan.org/
Other
858 stars 225 forks source link

x32 platform segfaults on `algparse -ta` #397

Closed dkg closed 2 years ago

dkg commented 3 years ago

the debian x32 buildd shows this failure:

debian/tests/cryptocheck: line 17: 16108 Segmentation fault      $algparse -ta
algorithm test failed
make[1]: *** [debian/rules:56: override_dh_auto_test] Error 1

that doesn't happen on any other platform that i can see.

letoams commented 3 years ago

can you add -v ? It will hopefully clarify what we were doing when things blew up

dkg commented 3 years ago

you want -v or -d?

letoams commented 3 years ago

On Tue, 12 Jan 2021, dkg wrote:

you want -v or -d?

you can do both.

dkg commented 3 years ago

whoops, sorry, i uploaded 4.1-2 with just -v -- should be a result soon on the x32 buildds for you to take a look at. let me know if you want -d as well, i can do another upload.

cagney commented 3 years ago

algparse: testing AES_GCM_16: algparse: empty string algparse: one block debian/tests/cryptocheck: line 17: 18432 Segmentation fault $algparse -v -ta

dkg commented 3 years ago

i've added --debug (see #398) to those tests for 4.1-3 -- it should show up soon on the debian buildd network.

dkg commented 3 years ago
algparse:   one block
| decode_to_chunk: raw_key: input "0xe98b72a9881a84ca6b76e0f43e68647a"
| decode_to_chunk: output: 
|   e9 8b 72 a9  88 1a 84 ca  6b 76 e0 f4  3e 68 64 7a
| CONCATENATE_DATA_AND_BASE:
|     target: EXTRACT_KEY_FROM_KEY
|     base: base-key@0x58453bd0 (16-bytes, AES_KEY_GEN)
|     params: 8-bytes@0xfff11fd4
|     result: newref symkey-key@0x58456010 (32-bytes, EXTRACT_KEY_FROM_KEY)(in merge_symkey_bytes() at crypt_symkey.c:224)
|     key-offset: 0, key-size: 16
| EXTRACT_KEY_FROM_KEY:
|     target: AES_GCM
|     flags: ENCRYPT+DECRYPT
|     key_size: 16-bytes
|     base: base-key@0x58456010 (32-bytes, EXTRACT_KEY_FROM_KEY)
|     operation: FLAGS_ONLY
|     params: 4-bytes@0xfff11fd0
|     result: newref symkey-key@0x58454d80 (16-bytes, AES_GCM)(in decode_to_key() at test_buffer.c:121)
| symkey: delref tmp-key@0x58456010
| decode_to_chunk: salted IV: input "0x8b23299fde174053f3d652ba"
| decode_to_chunk: output: 
|   8b 23 29 9f  de 17 40 53  f3 d6 52 ba
| decode_to_chunk: AAD: input ""
| decode_to_chunk: output: 
| 
| decode_to_chunk: plaintext: input "0x28286a321293253c3e0aa2704a278032"
| decode_to_chunk: output: 
|   28 28 6a 32  12 93 25 3c  3e 0a a2 70  4a 27 80 32
| decode_to_chunk: ciphertext: input "0x5a3c1cf1985dbb8bed818036fdd5ab42"
| decode_to_chunk: output: 
|   5a 3c 1c f1  98 5d bb 8b  ed 81 80 36  fd d5 ab 42
| decode_to_chunk: tag: input "0x23c7ab0f952b7091cd324835043b5eb5"
| decode_to_chunk: output: 
|   23 c7 ab 0f  95 2b 70 91  cd 32 48 35  04 3b 5e b5
| test_gcm_vector: decrypt: aad-size=0 salt-size=4 wire-IV-size=8 text-size=16 tag-size=16
| test_gcm_vector: text+tag on call
|   5a 3c 1c f1  98 5d bb 8b  ed 81 80 36  fd d5 ab 42
|   23 c7 ab 0f  95 2b 70 91  cd 32 48 35  04 3b 5e b5
debian/tests/cryptocheck: line 19: 22163 Segmentation fault      $algparse -v --debug -ta
cagney commented 3 years ago

Which version of NSS?

dkg commented 3 years ago

the most recent x32 buildd attempt shows libnss3-dev version 2:3.56-1

(that's upstream version 3.56, if we ignore the debian epoch prefix and revision suffix)

dkg commented 3 years ago

I do note that there are weird build and test failures for recent versions of nss on the debian x32 buildds as well, so maybe this is an x32 NSS problem, and not a libreswan problem? not sure how to pursue that line of inquiry further, since i don't think i have direct access to any x32 machines.

cagney commented 3 years ago

https://bugzilla.mozilla.org/show_bug.cgi?id=1062903 scary

cagney commented 3 years ago

The problem isn't building 32-bit (I just built on a 32-bit debian ARM (aka pi) and algparse ran fine. I'd assume the problem is in NSS and the lack of love for the x32 frankenabi.

cagney commented 2 years ago

Can re-open if latest code shows same problems.