Skip to contentSkip to conversation

New: alg: skcipher: p8_aes_xts encryption unexpectedly succeeded on test vector "random: len=0 klen=64"; expected_error=-22, cfg="random: inplace may_sleep use_finup src_divs=[<flush>66.99%@+10, 33.1%@alignmask+1155]

Bug 206049 [email protected] 1 participant 9 messages Jan 1, 2020 – Jan 8, 2020 Crypto API

lore
Share & tools
lore
#0 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=206049

            Bug ID: 206049
           Summary: alg: skcipher: p8_aes_xts encryption unexpectedly
                    succeeded on test vector "random: len=0 klen=64";
                    expected_error=-22, cfg="random: inplace may_sleep
                    use_finup src_divs=[<flush>66.99%@+10,
                    33.1%@alignmask+1155]
           Product: Platform Specific/Hardware
           Version: 2.5
    Kernel Version: 5.4.7
          Hardware: PPC-64
                OS: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: PPC-64
          Assignee: [email protected]
          Reporter: [email protected]
        Regression: No

Created attachment 286557
--> https://bugzilla.kernel.org/attachment.cgi?id=286557&action=edit
dmesg (5.4.7, Talos II)

# dmesg | grep -i aes
[    5.589319] alg: skcipher: p8_aes_xts encryption unexpectedly succeeded on
test vector "random: len=0 klen=64"; expected_error=-22, cfg="random: inplace
may_sleep use_finup src_divs=[<flush>66.99%@+10, 33.1%@alignmask+1155]"
# inxi -b
System:    Kernel: 5.4.7-gentoo ppc64 bits: 64 Console: tty 1 Distro: Gentoo
Base System release 2.6 
Machine:   Type: PowerPC Device System: T2P9D01 REV 1.01 details: PowerNV
T2P9D01 REV 1.01 rev: 2.2 (pvr 004e 1202) 
CPU:       32-Core: POWER9 altivec supported type: MCP speed: 2785 MHz min/max:
2154/3800 MHz 
Graphics:  Device-1: Advanced Micro Devices [AMD/ATI] Caicos [Radeon HD
6450/7450/8450 / R5 230 OEM] driver: radeon v: kernel 
           Device-2: ASPEED Graphics Family driver: N/A 
           Device-3: NVIDIA GK208B [GeForce GT 710] driver: N/A 
           Display: server: X.org 1.20.5 driver: radeon tty: 211x53 
           Message: Advanced graphics data unavailable in console for root. 
Network:   Device-1: Broadcom and subsidiaries NetXtreme BCM5719 Gigabit
Ethernet PCIe driver: tg3 
           Device-2: Broadcom and subsidiaries NetXtreme BCM5719 Gigabit
Ethernet PCIe driver: tg3
Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#1 lore raw

[Bug 206049] alg: skcipher: p8_aes_xts encryption unexpectedly succeeded on test vector "random: len=0 klen=64"; expected_error=-22, cfg="random: inplace may_sleep use_finup src_divs=[<flush>66.99%@+10, 33.1%@alignmask+1155]

https://bugzilla.kernel.org/show_bug.cgi?id=206049

--- Comment #1 from Erhard F. ([email protected]) --- Created attachment 286559
--> https://bugzilla.kernel.org/attachment.cgi?id=286559&action=edit
kernel .config (5.4.7, Talos II)

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#2 lore raw

[Bug 206049] alg: skcipher: p8_aes_xts encryption unexpectedly succeeded on test vector "random: len=0 klen=64"; expected_error=-22, cfg="random: inplace may_sleep use_finup src_divs=[<flush>66.99%@+10, 33.1%@alignmask+1155]

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=206049

Daniel Axtens ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #2 from Daniel Axtens ([email protected]) --- Hi Erhard,

I'm having a look. Does this reproduce reliably/often? Or was it a one-off?

Regards,
Daniel

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#3 lore raw

[Bug 206049] alg: skcipher: p8_aes_xts encryption unexpectedly succeeded on test vector "random: len=0 klen=64"; expected_error=-22, cfg="random: inplace may_sleep use_finup src_divs=[<flush>66.99%@+10, 33.1%@alignmask+1155]

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=206049

Michael Ellerman ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEW                         |ASSIGNED
                 CC|                            |[email protected]

--- Comment #3 from Michael Ellerman ([email protected]) --- Looks like other implementations check the size, can you try this:

drivers/crypto/vmx/aes_xts.c +0 -0
index d59e736882f6..9fee1b1532a4 100644
@@ -84,6 +84,9 @@ static int p8_aes_xts_crypt(struct skcipher_request *req, int

enc)

        u8 tweak[AES_BLOCK_SIZE];
        int ret;

+ if (req->cryptlen < AES_BLOCK_SIZE)
+ return -EINVAL;
+

        if (!crypto_simd_usable() || (req->cryptlen % XTS_BLOCK_SIZE) != 0) {
                struct skcipher_request *subreq = skcipher_request_ctx(req);
Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#4 lore raw

[Bug 206049] alg: skcipher: p8_aes_xts encryption unexpectedly succeeded on test vector "random: len=0 klen=64"; expected_error=-22, cfg="random: inplace may_sleep use_finup src_divs=[<flush>66.99%@+10, 33.1%@alignmask+1155]

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=206049

Michael Ellerman ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |NEEDINFO

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#5 lore raw

[Bug 206049] alg: skcipher: p8_aes_xts encryption unexpectedly succeeded on test vector "random: len=0 klen=64"; expected_error=-22, cfg="random: inplace may_sleep use_finup src_divs=[<flush>66.99%@+10, 33.1%@alignmask+1155]

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=206049

--- Comment #4 from Erhard F. ([email protected]) --- (In reply to Daniel Axtens from comment #2)

Quoted 3 lines

Hi Erhard,

I'm having a look. Does this reproduce reliably/often? Or was it a one-off?

Hi Daniel,

This shows up every time booting the Talos II. I have yet to try Michaels patch.

Regards,
Erhard

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#6 lore raw

[Bug 206049] alg: skcipher: p8_aes_xts encryption unexpectedly succeeded on test vector "random: len=0 klen=64"; expected_error=-22, cfg="random: inplace may_sleep use_finup src_divs=[<flush>66.99%@+10, 33.1%@alignmask+1155]

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=206049

--- Comment #5 from Erhard F. ([email protected]) --- (In reply to Michael Ellerman from comment #3)

Quoted 7 lines

Looks like other implementations check the size, can you try this:

drivers/crypto/vmx/aes_xts.c +0 -0
index d59e736882f6..9fee1b1532a4 100644

drivers/crypto/vmx/aes_xts.c static int p8_aes_xts_crypt(struct skcipher_request *req, · line 92

Quoted 9 lines
drivers/crypto/vmx/aes_xts.c +3 -0
@@ -84,6 +84,9 @@ static int p8_aes_xts_crypt(struct skcipher_request *req,
 int enc)
      u8 tweak[AES_BLOCK_SIZE];
      int ret;
 
+     if (req->cryptlen < AES_BLOCK_SIZE)
+             return -EINVAL;
+
      if (!crypto_simd_usable() || (req->cryptlen % XTS_BLOCK_SIZE) != 0) {
              struct skcipher_request *subreq = skcipher_request_ctx(req);

Your patch fixed it, thanks! Applied it on top of kernel 5.4.8 and the p8_aes_xts error did not show up in subsequent reboots.

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#7 lore raw

[Bug 206049] alg: skcipher: p8_aes_xts encryption unexpectedly succeeded on test vector "random: len=0 klen=64"; expected_error=-22, cfg="random: inplace may_sleep use_finup src_divs=[<flush>66.99%@+10, 33.1%@alignmask+1155]

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=206049

--- Comment #6 from Daniel Axtens ([email protected]) --- Patch sent: https://patchwork.ozlabs.org/patch/1219350/

Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.
#8 lore raw

[Bug 206049] alg: skcipher: p8_aes_xts encryption unexpectedly succeeded on test vector "random: len=0 klen=64"; expected_error=-22, cfg="random: inplace may_sleep use_finup src_divs=[<flush>66.99%@+10, 33.1%@alignmask+1155]

In reply to [email protected]

https://bugzilla.kernel.org/show_bug.cgi?id=206049

Michael Ellerman ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------

             Status|NEEDINFO                    |RESOLVED
         Resolution|---                         |CODE_FIX
Signature · 2 lines
You are receiving this mail because:
You are watching the assignee of the bug.