console noise after commit c1e9b3b0eea
Hi Anatoly, after commit c1e9b3b0eea1 ("hwrng: n2 - Attach on T5/M5, T7/M7 SPARC CPUs") I get a *lot* of console noise on my T5-2, of the form: n2rng f028f21c: Selftest failed on unit 0 n2rng f028f21c: Test buffer slot 0 [0x] n2rng f028f21c: Test buffer slot 1 [0xe63f56d6a22eb116] n2rng f028f21c: Test buffer slot 2 [0xe63f56d6a22eb116] n2rng f028f21c: Test buffer slot 3 [0xe63f56d6a22eb116] n2rng f028f21c: Test buffer slot 4 [0xe63f56d6a22eb116] n2rng f028f21c: Test buffer slot 5 [0xe63f56d6a22eb116] n2rng f028f21c: Test buffer slot 6 [0xe63f56d6a22eb116] n2rng f028f21c: Test buffer slot 7 [0xe63f56d6a22eb116] Why/when is your commit needed on my T5-2? I'm not sure how this was tested, but if you need to revise it and test on sparc, please let me know- I think it needs more work on sparc. --Sowmini -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] crypto: talitos - fix crash in talitos_cra_init()
From: Jonas EymannConversion of talitos driver to the new AEAD interface hasn't been properly tested. AEAD algorithms crash in talitos_cra_init as follows: [...] [1.141095] talitos ffe3.crypto: hwrng [1.145381] Unable to handle kernel paging request for data at address 0x0058 [1.152913] Faulting instruction address: 0xc02accc0 [1.157910] Oops: Kernel access of bad area, sig: 11 [#1] [1.163315] SMP NR_CPUS=2 P1020 RDB [1.166810] Modules linked in: [1.169875] CPU: 0 PID: 1007 Comm: cryptomgr_test Not tainted 4.4.6 #1 [1.176415] task: db5ec200 ti: db4d6000 task.ti: db4d6000 [1.181821] NIP: c02accc0 LR: c02acd18 CTR: c02acd04 [1.186793] REGS: db4d7d30 TRAP: 0300 Not tainted (4.4.6) [1.192457] MSR: 00029000 CR: 95009359 XER: e000 [1.198585] DEAR: 0058 ESR: GPR00: c017bdc0 db4d7de0 db5ec200 df424b48 df424bfc db75a600 GPR08: df424b48 db75a628 db4d6000 0149 c0044cac db5acda0 GPR16: 0400 df424940 GPR24: df424900 3083 0400 c018 db75a640 c03e9f84 df424b40 df424b48 [1.230978] NIP [c02accc0] talitos_cra_init+0x28/0x6c [1.236039] LR [c02acd18] talitos_cra_init_aead+0x14/0x28 [1.241443] Call Trace: [1.243894] [db4d7de0] [c03e9f84] 0xc03e9f84 (unreliable) [1.249322] [db4d7df0] [c017bdc0] crypto_create_tfm+0x5c/0xf0 [1.255083] [db4d7e10] [c017beec] crypto_alloc_tfm+0x98/0xf8 [1.260769] [db4d7e40] [c0186a20] alg_test_aead+0x28/0xc8 [1.266181] [db4d7e60] [c0186718] alg_test+0x260/0x2e0 [1.271333] [db4d7ee0] [c0183860] cryptomgr_test+0x30/0x54 [1.276843] [db4d7ef0] [c0044d80] kthread+0xd4/0xd8 [1.281741] [db4d7f40] [c000e4a4] ret_from_kernel_thread+0x5c/0x64 [1.287930] Instruction dump: [1.290902] 3860 4e800020 81230028 7c681b78 81490010 38e9ffc0 3929ffe8 554a073e [1.298691] 2b8a000a 7d474f9e 812a0008 91230030 <80e90058> 39270060 7c0004ac 7cc04828 Cc: # 4.3+ Fixes: aeb4c132f33d ("crypto: talitos - Convert to new AEAD interface") Signed-off-by: Jonas Eymann Fix typo - replaced parameter of __crypto_ahash_alg(): s/tfm/alg Remove checkpatch warnings. Add commit message. Signed-off-by: Horia Geantă --- drivers/crypto/talitos.c | 41 +++-- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index a0d4a08313ae..35198804d6d3 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -2629,21 +2629,11 @@ struct talitos_crypto_alg { struct talitos_alg_template algt; }; -static int talitos_cra_init(struct crypto_tfm *tfm) +static int talitos_init_common(struct talitos_ctx *ctx, + struct talitos_crypto_alg *talitos_alg) { - struct crypto_alg *alg = tfm->__crt_alg; - struct talitos_crypto_alg *talitos_alg; - struct talitos_ctx *ctx = crypto_tfm_ctx(tfm); struct talitos_private *priv; - if ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_AHASH) - talitos_alg = container_of(__crypto_ahash_alg(alg), - struct talitos_crypto_alg, - algt.alg.hash); - else - talitos_alg = container_of(alg, struct talitos_crypto_alg, - algt.alg.crypto); - /* update context with ptr to dev */ ctx->dev = talitos_alg->dev; @@ -2661,10 +2651,33 @@ static int talitos_cra_init(struct crypto_tfm *tfm) return 0; } +static int talitos_cra_init(struct crypto_tfm *tfm) +{ + struct crypto_alg *alg = tfm->__crt_alg; + struct talitos_crypto_alg *talitos_alg; + struct talitos_ctx *ctx = crypto_tfm_ctx(tfm); + + if ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_AHASH) + talitos_alg = container_of(__crypto_ahash_alg(alg), + struct talitos_crypto_alg, + algt.alg.hash); + else + talitos_alg = container_of(alg, struct talitos_crypto_alg, + algt.alg.crypto); + + return talitos_init_common(ctx, talitos_alg); +} + static int talitos_cra_init_aead(struct crypto_aead *tfm) { - talitos_cra_init(crypto_aead_tfm(tfm)); - return 0; + struct aead_alg *alg = crypto_aead_alg(tfm); + struct talitos_crypto_alg *talitos_alg; + struct talitos_ctx *ctx = crypto_aead_ctx(tfm); + + talitos_alg = container_of(alg, struct talitos_crypto_alg, + algt.alg.aead); + + return talitos_init_common(ctx, talitos_alg); } static int talitos_cra_init_ahash(struct crypto_tfm *tfm) -- 2.4.4 -- To unsubscribe
[PATCH 2/2] crypto: talitos - fix AEAD tcrypt tests
After conversion to new AEAD interface, tcrypt tests fail as follows: [...] [1.145414] alg: aead: Test 1 failed on encryption for authenc-hmac-sha1-cbc-aes-talitos [1.153564] : 53 69 6e 67 6c 65 20 62 6c 6f 63 6b 20 6d 73 67 [1.160041] 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [1.166509] 0020: 00 00 00 00 [...] Fix them by providing the correct cipher in & cipher out pointers, i.e. must skip over associated data in src and dst S/G. While here, fix a problem with the HW S/G table index usage: tbl_off must be updated after the pointer to the table entries is set. Cc:# 4.3+ Fixes: aeb4c132f33d ("crypto: talitos - Convert to new AEAD interface") Reported-by: Jonas Eymann Signed-off-by: Horia Geantă --- drivers/crypto/talitos.c | 46 ++ 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 35198804d6d3..aae05547b924 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -63,6 +63,14 @@ static void to_talitos_ptr(struct talitos_ptr *ptr, dma_addr_t dma_addr, ptr->eptr = upper_32_bits(dma_addr); } +static void copy_talitos_ptr(struct talitos_ptr *dst_ptr, +struct talitos_ptr *src_ptr, bool is_sec1) +{ + dst_ptr->ptr = src_ptr->ptr; + if (!is_sec1) + dst_ptr->eptr = src_ptr->eptr; +} + static void to_talitos_ptr_len(struct talitos_ptr *ptr, unsigned int len, bool is_sec1) { @@ -1083,21 +1091,20 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, sg_count = dma_map_sg(dev, areq->src, edesc->src_nents ?: 1, (areq->src == areq->dst) ? DMA_BIDIRECTIONAL : DMA_TO_DEVICE); - /* hmac data */ desc->ptr[1].len = cpu_to_be16(areq->assoclen); if (sg_count > 1 && (ret = sg_to_link_tbl_offset(areq->src, sg_count, 0, areq->assoclen, >link_tbl[tbl_off])) > 1) { - tbl_off += ret; - to_talitos_ptr(>ptr[1], edesc->dma_link_tbl + tbl_off * sizeof(struct talitos_ptr), 0); desc->ptr[1].j_extent = DESC_PTR_LNKTBL_JUMP; dma_sync_single_for_device(dev, edesc->dma_link_tbl, edesc->dma_len, DMA_BIDIRECTIONAL); + + tbl_off += ret; } else { to_talitos_ptr(>ptr[1], sg_dma_address(areq->src), 0); desc->ptr[1].j_extent = 0; @@ -1126,11 +1133,13 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, if (edesc->desc.hdr & DESC_HDR_MODE1_MDEU_CICV) sg_link_tbl_len += authsize; - if (sg_count > 1 && - (ret = sg_to_link_tbl_offset(areq->src, sg_count, areq->assoclen, -sg_link_tbl_len, ->link_tbl[tbl_off])) > 1) { - tbl_off += ret; + if (sg_count == 1) { + to_talitos_ptr(>ptr[4], sg_dma_address(areq->src) + + areq->assoclen, 0); + } else if ((ret = sg_to_link_tbl_offset(areq->src, sg_count, + areq->assoclen, sg_link_tbl_len, + >link_tbl[tbl_off])) > + 1) { desc->ptr[4].j_extent |= DESC_PTR_LNKTBL_JUMP; to_talitos_ptr(>ptr[4], edesc->dma_link_tbl + tbl_off * @@ -1138,8 +1147,10 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, dma_sync_single_for_device(dev, edesc->dma_link_tbl, edesc->dma_len, DMA_BIDIRECTIONAL); - } else - to_talitos_ptr(>ptr[4], sg_dma_address(areq->src), 0); + tbl_off += ret; + } else { + copy_talitos_ptr(>ptr[4], >link_tbl[tbl_off], 0); + } /* cipher out */ desc->ptr[5].len = cpu_to_be16(cryptlen); @@ -1151,11 +1162,13 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq, edesc->icv_ool = false; - if (sg_count > 1 && - (sg_count = sg_to_link_tbl_offset(areq->dst, sg_count, + if (sg_count == 1) { + to_talitos_ptr(>ptr[5], sg_dma_address(areq->dst) + + areq->assoclen, 0); + } else if ((sg_count = + sg_to_link_tbl_offset(areq->dst, sg_count, areq->assoclen, cryptlen, -
[PATCH 0/2] crypto: talitos - fix conversion to new AEAD interface
Jonas Eymann reports a crash and some failures of AED algorithms with kernel 4.4.6, all easily reproducible with tcrypt. These have to do with the onversion to the new AEAD interface: aeb4c132f33d crypto: talitos - Convert to new AEAD interface Problems occur for 4.3+ kernels, sending patches to -stable. (*) Proper fix for hash algorithms registration failures (implementation of import/export functionality) will be added separately. Thannks, Horia Horia Geantă (1): crypto: talitos - fix AEAD tcrypt tests Jonas Eymann (1): crypto: talitos - fix crash in talitos_cra_init() drivers/crypto/talitos.c | 87 +++- 1 file changed, 57 insertions(+), 30 deletions(-) -- 2.4.4 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] crypto: marvell/cesa: Improving code readability
On Tue, 19 Apr 2016 17:09:20 +0200 Romain Perierwrote: > When looking for available engines, the variable "engine" is > assigned to ">engines[i]" at the beginning of the for loop. Replacing > next occurences of ">engines[i]" by "engine" and in order to improve > readability. > > Signed-off-by: Romain Perier Acked-by: Boris Brezillon > --- > drivers/crypto/marvell/cesa.c | 10 +- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/crypto/marvell/cesa.c b/drivers/crypto/marvell/cesa.c > index 80239ae..e8ef9fd 100644 > --- a/drivers/crypto/marvell/cesa.c > +++ b/drivers/crypto/marvell/cesa.c > @@ -475,18 +475,18 @@ static int mv_cesa_probe(struct platform_device *pdev) > engine->regs = cesa->regs + CESA_ENGINE_OFF(i); > > if (dram && cesa->caps->has_tdma) > - mv_cesa_conf_mbus_windows(>engines[i], dram); > + mv_cesa_conf_mbus_windows(engine, dram); > > - writel(0, cesa->engines[i].regs + CESA_SA_INT_STATUS); > + writel(0, engine->regs + CESA_SA_INT_STATUS); > writel(CESA_SA_CFG_STOP_DIG_ERR, > -cesa->engines[i].regs + CESA_SA_CFG); > +engine->regs + CESA_SA_CFG); > writel(engine->sram_dma & CESA_SA_SRAM_MSK, > -cesa->engines[i].regs + CESA_SA_DESC_P0); > +engine->regs + CESA_SA_DESC_P0); > > ret = devm_request_threaded_irq(dev, irq, NULL, mv_cesa_int, > IRQF_ONESHOT, > dev_name(>dev), > - >engines[i]); > + engine); > if (ret) > goto err_cleanup; > } -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] crypto: marvell/cesa: Improving code readability
When looking for available engines, the variable "engine" is assigned to ">engines[i]" at the beginning of the for loop. Replacing next occurences of ">engines[i]" by "engine" and in order to improve readability. Signed-off-by: Romain Perier--- drivers/crypto/marvell/cesa.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/marvell/cesa.c b/drivers/crypto/marvell/cesa.c index 80239ae..e8ef9fd 100644 --- a/drivers/crypto/marvell/cesa.c +++ b/drivers/crypto/marvell/cesa.c @@ -475,18 +475,18 @@ static int mv_cesa_probe(struct platform_device *pdev) engine->regs = cesa->regs + CESA_ENGINE_OFF(i); if (dram && cesa->caps->has_tdma) - mv_cesa_conf_mbus_windows(>engines[i], dram); + mv_cesa_conf_mbus_windows(engine, dram); - writel(0, cesa->engines[i].regs + CESA_SA_INT_STATUS); + writel(0, engine->regs + CESA_SA_INT_STATUS); writel(CESA_SA_CFG_STOP_DIG_ERR, - cesa->engines[i].regs + CESA_SA_CFG); + engine->regs + CESA_SA_CFG); writel(engine->sram_dma & CESA_SA_SRAM_MSK, - cesa->engines[i].regs + CESA_SA_DESC_P0); + engine->regs + CESA_SA_DESC_P0); ret = devm_request_threaded_irq(dev, irq, NULL, mv_cesa_int, IRQF_ONESHOT, dev_name(>dev), - >engines[i]); + engine); if (ret) goto err_cleanup; } -- 2.8.0 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] crypto: s5p-sss - Remove useless hash interrupt handler
Beside regular feed control interrupt, the driver requires also hash interrupt for older SoCs (samsung,s5pv210-secss). However after requesting it, the interrupt handler isn't doing anything with it, not even clearing the hash interrupt bit. Driver does not provide hash functions so it is safe to remove the hash interrupt related code and to not require the interrupt in Device Tree. Signed-off-by: Krzysztof Kozlowski--- .../devicetree/bindings/crypto/samsung-sss.txt | 6 ++-- drivers/crypto/s5p-sss.c | 34 -- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/Documentation/devicetree/bindings/crypto/samsung-sss.txt b/Documentation/devicetree/bindings/crypto/samsung-sss.txt index a6dafa83c6df..7a5ca56683cc 100644 --- a/Documentation/devicetree/bindings/crypto/samsung-sss.txt +++ b/Documentation/devicetree/bindings/crypto/samsung-sss.txt @@ -23,10 +23,8 @@ Required properties: - "samsung,exynos4210-secss" for Exynos4210, Exynos4212, Exynos4412, Exynos5250, Exynos5260 and Exynos5420 SoCs. - reg : Offset and length of the register set for the module -- interrupts : interrupt specifiers of SSS module interrupts, should contain - following entries: - - first : feed control interrupt (required for all variants), - - second : hash interrupt (required only for samsung,s5pv210-secss). +- interrupts : interrupt specifiers of SSS module interrupts (one feed + control interrupt). - clocks : list of clock phandle and specifier pairs for all clocks listed in clock-names property. diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c index b0484d4d68d9..71ca6a5d636d 100644 --- a/drivers/crypto/s5p-sss.c +++ b/drivers/crypto/s5p-sss.c @@ -149,7 +149,6 @@ /** * struct samsung_aes_variant - platform specific SSS driver data - * @has_hash_irq: true if SSS module uses hash interrupt, false otherwise * @aes_offset: AES register offset from SSS module's base. * * Specifies platform specific configuration of SSS module. @@ -157,7 +156,6 @@ * expansion of its usage. */ struct samsung_aes_variant { - boolhas_hash_irq; unsigned intaes_offset; }; @@ -178,7 +176,6 @@ struct s5p_aes_dev { struct clk *clk; void __iomem *ioaddr; void __iomem *aes_ioaddr; - int irq_hash; int irq_fc; struct ablkcipher_request *req; @@ -201,12 +198,10 @@ struct s5p_aes_dev { static struct s5p_aes_dev *s5p_dev; static const struct samsung_aes_variant s5p_aes_data = { - .has_hash_irq = true, .aes_offset = 0x4000, }; static const struct samsung_aes_variant exynos_aes_data = { - .has_hash_irq = false, .aes_offset = 0x200, }; @@ -421,15 +416,13 @@ static irqreturn_t s5p_aes_interrupt(int irq, void *dev_id) spin_lock_irqsave(>lock, flags); - if (irq == dev->irq_fc) { - status = SSS_READ(dev, FCINTSTAT); - if (status & SSS_FCINTSTAT_BRDMAINT) - s5p_aes_rx(dev); - if (status & SSS_FCINTSTAT_BTDMAINT) - s5p_aes_tx(dev); + status = SSS_READ(dev, FCINTSTAT); + if (status & SSS_FCINTSTAT_BRDMAINT) + s5p_aes_rx(dev); + if (status & SSS_FCINTSTAT_BTDMAINT) + s5p_aes_tx(dev); - SSS_WRITE(dev, FCINTPEND, status); - } + SSS_WRITE(dev, FCINTPEND, status); spin_unlock_irqrestore(>lock, flags); @@ -795,21 +788,6 @@ static int s5p_aes_probe(struct platform_device *pdev) goto err_irq; } - if (variant->has_hash_irq) { - pdata->irq_hash = platform_get_irq(pdev, 1); - if (pdata->irq_hash < 0) { - err = pdata->irq_hash; - dev_warn(dev, "hash interrupt is not available.\n"); - goto err_irq; - } - err = devm_request_irq(dev, pdata->irq_hash, s5p_aes_interrupt, - IRQF_SHARED, pdev->name, pdev); - if (err < 0) { - dev_warn(dev, "hash interrupt is not available.\n"); - goto err_irq; - } - } - pdata->busy = false; pdata->variant = variant; pdata->dev = dev; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] crypto: s5p-sss - Fix use after free of copied input buffer in error path
The driver makes copies of memory (input or output scatterlists) if they are not aligned. In s5p_aes_crypt_start() error path (on unsuccessful initialization of output scatterlist), if input scatterlist was not aligned, the driver first freed copied input memory and then unmapped it from the device, instead of doing otherwise (unmap and then free). This was wrong in two ways: 1. Freed pages were still mapped to the device. 2. The dma_unmap_sg() iterated over freed scatterlist structure. The call to s5p_free_sg_cpy() in this error path is not needed because the copied scatterlists will be freed by s5p_aes_complete(). Fixes: 9e4a1100a445 ("crypto: s5p-sss - Handle unaligned buffers") Signed-off-by: Krzysztof Kozlowski--- drivers/crypto/s5p-sss.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c index 4f6d5b3ec418..b0484d4d68d9 100644 --- a/drivers/crypto/s5p-sss.c +++ b/drivers/crypto/s5p-sss.c @@ -577,7 +577,6 @@ static void s5p_aes_crypt_start(struct s5p_aes_dev *dev, unsigned long mode) return; outdata_error: - s5p_free_sg_cpy(dev, >sg_src_cpy); s5p_unset_indata(dev); indata_error: -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v5 6/6] crypto: AF_ALG - add support for key_id
On Fri, Apr 15, 2016 at 02:32:47PM -0700, Tadeusz Struk wrote: > On 04/15/2016 02:32 PM, kbuild test robot wrote: > > Hi Tadeusz, > > > > [auto build test ERROR on cryptodev/master] > > [also build test ERROR on v4.6-rc3 next-20160415] > > [if your patch is applied to the wrong git tree, please drop us a note to > > help improving the system] > > > > url: > > https://github.com/0day-ci/linux/commits/Tadeusz-Struk/crypto-algif-add-akcipher/20160416-043207 > > base: > > https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git > > master > > config: i386-allmodconfig (attached as .config) > > reproduce: > > # save the attached .config to linux build tree > > make ARCH=i386 > > Hi, > It's is for > https://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=keys-next > plus this: > https://patchwork.kernel.org/patch/8843381/ Thanks Tadeusz for the feedback. hi Xiaolong, anything we can do in 0day side to detect the base for this case? > Thanks, > -- > TS > -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html