Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp352094imu; Mon, 10 Dec 2018 23:31:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/V3xbwPAtutiQUGijw5c1PJylEPEYOJjIcRK2+QjxyIEkukWjdN9AJDU/9mZRHrSEuvGQrX X-Received: by 2002:a62:2c81:: with SMTP id s123mr15164002pfs.174.1544513470152; Mon, 10 Dec 2018 23:31:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544513470; cv=none; d=google.com; s=arc-20160816; b=pkjch6bUSTsgPgX6zWUrkASrb4H5eDvzXK0Ag2wOl1A/0WAmnQouYNj/0l8RfhfP2Z qLEYliKlLC4xCNSklZZpSwCBPXSG4oP6A33p4q22C321ur4l8gq1tiafwQLYyUV3RGgw MN1xLq9lTSKsCU69AFrrqWfpOk6UKAldT/xN/1NqsbR6N7JARo+yAAY6p4xW45h4qKbR rt/9tUwoXy43MVRXIUPTUP9U1HOjdleMzjVUO8Wc8b8uGnGU0C1gxxBxv0nkWBDf1RzR VAsa/xf2lv9DLepHZteqVDBlNu8XCZsFTqljc2pYvft1LR42R3Vb9A7P0zc1u1ZxScg2 9KsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:cc:to:subject:from; bh=m9jVyNizPUy98u0ncp57dUCCQ6h4PPVuWfs68b0D2qU=; b=mUI77TB6sIj6KFCXXPLvO00tMiMnSrk2UlGqA0D7L3Yfkavp77gYkv9IZXdSJpKHTq 7BW7MVQwCwkKNX3CkcQtPf1A3p93qyCxKQoZBrx8cbgvTbS1eqTeeBe/4Vhm+SgBCmEq aAgk6P+EcY/EFjV4aOFCP2o6mosh4ZK4+sjkjrm2GXs3QDId9xZ8X5KoUsA7YLSR8RbK QAlBQF1VPQaqllHX/LXyngSQN/Tz+HtSkdsHusDwwPn7w92n3l+JLcW/iWWTI9r2j0Je RhKTxok/8jFydSUfAuyCNPMFsOXthra62IbTA/MzpoQ4Iwc5FmcwimCghC+jfbqE+Mkm QpSw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5si11152405pgs.588.2018.12.10.23.30.54; Mon, 10 Dec 2018 23:31:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726134AbeLKH3z (ORCPT + 99 others); Tue, 11 Dec 2018 02:29:55 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:8899 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726036AbeLKH3z (ORCPT ); Tue, 11 Dec 2018 02:29:55 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 43DWmc634rz9tygZ; Tue, 11 Dec 2018 08:29:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id E_AjTmBt6E_G; Tue, 11 Dec 2018 08:29:52 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 43DWmc5F8Nz9tygX; Tue, 11 Dec 2018 08:29:52 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 689638B7D5; Tue, 11 Dec 2018 08:29:53 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id JiF5Pz7EEWUO; Tue, 11 Dec 2018 08:29:53 +0100 (CET) Received: from PO15451.localdomain (unknown [192.168.232.3]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 18B1D8B775; Tue, 11 Dec 2018 08:29:50 +0100 (CET) Received: by localhost.localdomain (Postfix, from userid 0) id 4E0B0716F4; Tue, 11 Dec 2018 07:29:40 +0000 (UTC) From: Christophe Leroy Subject: [PATCH] crypto: talitos - fix ablkcipher for CONFIG_VMAP_STACK To: Herbert Xu , "David S. Miller" , Ard Biesheuvel Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Message-Id: <20181211072940.4E0B0716F4@localhost.localdomain> Date: Tue, 11 Dec 2018 07:29:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ 2.364486] WARNING: CPU: 0 PID: 60 at ./arch/powerpc/include/asm/io.h:837 dma_nommu_map_page+0x44/0xd4 [ 2.373579] CPU: 0 PID: 60 Comm: cryptomgr_test Tainted: G W 4.20.0-rc5-00560-g6bfb52e23a00-dirty #531 [ 2.384740] NIP: c000c540 LR: c000c584 CTR: 00000000 [ 2.389743] REGS: c95abab0 TRAP: 0700 Tainted: G W (4.20.0-rc5-00560-g6bfb52e23a00-dirty) [ 2.400042] MSR: 00029032 CR: 24042204 XER: 00000000 [ 2.406669] [ 2.406669] GPR00: c02f2244 c95abb60 c6262990 c95abd80 0000256a 00000001 00000001 00000001 [ 2.406669] GPR08: 00000000 00002000 00000010 00000010 24042202 00000000 00000100 c95abd88 [ 2.406669] GPR16: 00000000 c05569d4 00000001 00000010 c95abc88 c0615664 00000004 00000000 [ 2.406669] GPR24: 00000010 c95abc88 c95abc88 00000000 c61ae210 c7ff6d40 c61ae210 00003d68 [ 2.441559] NIP [c000c540] dma_nommu_map_page+0x44/0xd4 [ 2.446720] LR [c000c584] dma_nommu_map_page+0x88/0xd4 [ 2.451762] Call Trace: [ 2.454195] [c95abb60] [82000808] 0x82000808 (unreliable) [ 2.459572] [c95abb80] [c02f2244] talitos_edesc_alloc+0xbc/0x3c8 [ 2.465493] [c95abbb0] [c02f2600] ablkcipher_edesc_alloc+0x4c/0x5c [ 2.471606] [c95abbd0] [c02f4ed0] ablkcipher_encrypt+0x20/0x64 [ 2.477389] [c95abbe0] [c02023b0] __test_skcipher+0x4bc/0xa08 [ 2.483049] [c95abe00] [c0204b60] test_skcipher+0x2c/0xcc [ 2.488385] [c95abe20] [c0204c48] alg_test_skcipher+0x48/0xbc [ 2.494064] [c95abe40] [c0205cec] alg_test+0x164/0x2e8 [ 2.499142] [c95abf00] [c0200dec] cryptomgr_test+0x48/0x50 [ 2.504558] [c95abf10] [c0039ff4] kthread+0xe4/0x110 [ 2.509471] [c95abf40] [c000e1d0] ret_from_kernel_thread+0x14/0x1c [ 2.515532] Instruction dump: [ 2.518468] 7c7e1b78 7c9d2378 7cbf2b78 41820054 3d20c076 8089c200 3d20c076 7c84e850 [ 2.526127] 8129c204 7c842e70 7f844840 419c0008 <0fe00000> 2f9e0000 54847022 7c84fa14 [ 2.533960] ---[ end trace bf78d94af73fe3b8 ]--- [ 2.539123] talitos ff020000.crypto: master data transfer error [ 2.544775] talitos ff020000.crypto: TEA error: ISR 0x20000000_00000040 [ 2.551625] alg: skcipher: encryption failed on test 1 for ecb-aes-talitos: ret=22 IV cannot be on stack when CONFIG_VMAP_STACK is selected because the stack cannot be DMA mapped anymore. This patch copies the IV from areq->info to the context ctx->iv. Fixes: 4de9d0b547b9 ("crypto: talitos - Add ablkcipher algorithms") Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy --- drivers/crypto/talitos.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 6988012deca4..385ec970b639 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -1668,8 +1668,11 @@ static struct talitos_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request * struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher); unsigned int ivsize = crypto_ablkcipher_ivsize(cipher); + if (ivsize) + memcpy(ctx->iv, areq->info, ivsize); + return talitos_edesc_alloc(ctx->dev, areq->src, areq->dst, - areq->info, 0, areq->nbytes, 0, ivsize, 0, + ctx->iv, 0, areq->nbytes, 0, ivsize, 0, areq->base.flags, encrypt); } -- 2.13.3