Received: by 2002:ac0:c50a:0:0:0:0:0 with SMTP id y10csp1269569imi; Fri, 1 Jul 2022 06:36:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tb90qnYC95XoUfC6OqnIvIK0DYiwoBU4xo11NNDFbgzOJSUy34Zq3DsRPo7LZWObY7Zkzj X-Received: by 2002:a17:906:38ca:b0:722:e836:1d85 with SMTP id r10-20020a17090638ca00b00722e8361d85mr14203337ejd.194.1656682582873; Fri, 01 Jul 2022 06:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656682582; cv=none; d=google.com; s=arc-20160816; b=hzeO3MaQ7uF02B3/PsIu6odH/6KdzKkEFVhZLU3+twUYGZKvcNDVixD6948+4vN5/Q VWUn0sxUs8W0zAzu2+CX2AagRyddg6+BTT5R+ao8+5O7wsCBH8j66z5s5sD54hpjd84x cYIosy8KVyODnb+/IVA5pX4NUSS/oLn94Qkjql2prB6DXyipkBtUdn2stP3PLYtBOwAI Bt2QNgcOwUt6IoxkhB9HGRjmVYLls8OYL+d0iHwZAdu0tq9Ahk5tr1e+qQDaYOIfwXce n9fVYeOlDnWfg5c3Mt/w9Ve8js+RBPWlx+PUanb3raeAKtHww+rKyrM3wKCq8/06YR/0 J9AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=vElcCtw04QzuAH22LcbLyJ8OXVl5mqZvOzdsJCSKnNs=; b=TsyzNaF+NE+4JQf8NGNGY2bgdhP94Ibfr8jEnv9hY9vpdlOhmZf+jn3w96/BRLqjbV L+6dCBgeWu5oB42ys4IWMcnP8KGTqXLSCyxmh6YaB8x9XGg+Jh/xeJ33W/+IxvHnUYGo fLEvl17gX9IN5/NMcE3Pv7p406DfTFd0+ne4H440i1aGw0+HjiNkkC6L3daeUXPKd9Wg DNjgaTR0zEqNoDGmROxC/8ow6CCbTbqzm14ILfNS95PN7C0UbMgkgfr2fva9szt6rG6z puTSSunieOsuGFAol73Es5iyncs2awV/T1r+cIX1xkrVBmnRRwf7NtovgvVRWeZ+2//a euhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=SV30SZRP; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne22-20020a1709077b9600b00726942a5503si23752531ejc.913.2022.07.01.06.35.43; Fri, 01 Jul 2022 06:36:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=SV30SZRP; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230305AbiGAN1u (ORCPT + 99 others); Fri, 1 Jul 2022 09:27:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229864AbiGAN1u (ORCPT ); Fri, 1 Jul 2022 09:27:50 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58DA5675B8 for ; Fri, 1 Jul 2022 06:27:48 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id h14-20020a1ccc0e000000b0039eff745c53so1574358wmb.5 for ; Fri, 01 Jul 2022 06:27:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vElcCtw04QzuAH22LcbLyJ8OXVl5mqZvOzdsJCSKnNs=; b=SV30SZRPWDjribOlXEJdd/yg3juNcqboVOE6JCXCYDcrNei6x23hGFFoTjLeyG5w7s 8oWs+rkoN0jpkAG4owViglzYHdY/zoC59LuweSuaQMU2oES6Las75LQWod71360VGQsQ fxqF643w/vVY4wq3myXS+WkUSXtZVMLQrFyYzdUD020PR2lwg4J/PIIorUhbPHjLyKXl eWVvO6aIheXIFXR7rptanl2FwKYc2LwRJXbKOgGiGarJkmhPSIpXFuqrjll593pSlad6 njT/YBsVcJ///r28v3LoGpgwQSDPxp1VzpKJzu+OD9htbnF4+kaQ3t6G/3lIkRRyuduV n4Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vElcCtw04QzuAH22LcbLyJ8OXVl5mqZvOzdsJCSKnNs=; b=zpn2ICSqXPVofGZMKSFjyOeT4DLAa0m4zuuadqf+cb3tHkXx2cTwuFppv+KKjKQ7Al yRhMD4frnvZfp/4Cq7kmi5wGgF8IlePxKuSn7BAffJo+D4it3GGY6cC6lWFpa6SS1iP1 Ovr7zEdMT/zgRfAc7PaOmPBp53EdFlzyDgdJ0lkMTk/Tz+djSdMEdNsXGvfG2/VtIWhC M9BmL3jDXKrPEH+GJkZSJ4bRZs0oJPqh9UCpFMH8qiXRuy5YWBJIbFs1ldIDHXwhO6zd wbVi1mD1Eepr5uQKrTFtRWI29jCSw1V7zcp2S2a7H7SWub8Cv25NsQLPmjejNIolmoiY V61g== X-Gm-Message-State: AJIora+pS2DSVyFvUAlRQVDEeKBTAF6uqt41GEmuOaJeRLlZB4L7udRs 7eeWqMf2NBP0ye4qRhe7vgQnug== X-Received: by 2002:a1c:f20b:0:b0:39e:f4b9:24e3 with SMTP id s11-20020a1cf20b000000b0039ef4b924e3mr16541364wmc.51.1656682066956; Fri, 01 Jul 2022 06:27:46 -0700 (PDT) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id h13-20020adff4cd000000b002103aebe8absm22354337wrp.93.2022.07.01.06.27.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 06:27:46 -0700 (PDT) From: Corentin Labbe To: herbert@gondor.apana.org.au, hch@lst.de, heiko@sntech.de Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sunxi@lists.linux.dev, Corentin Labbe Subject: [RFC PATCH] crypto: flush poison data Date: Fri, 1 Jul 2022 13:27:35 +0000 Message-Id: <20220701132735.1594822-1-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On my Allwinner D1 nezha, the sun8i-ce fail self-tests due to: alg: skcipher: cbc-des3-sun8i-ce encryption overran dst buffer on test vector 0 In fact the buffer is not overran by device but by the dma_map_single() operation. To prevent any corruption of the poisoned data, simply flush them before giving the buffer to the tested driver. Signed-off-by: Corentin Labbe --- Hello I put this patch as RFC, since this behavour happen only on non yet merged RISCV code. (Mostly riscv: implement Zicbom-based CMO instructions + the t-head variant) Regards crypto/testmgr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index c59bd9e07978..187163e2e593 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -205,6 +206,8 @@ static void testmgr_free_buf(char *buf[XBUFSIZE]) static inline void testmgr_poison(void *addr, size_t len) { memset(addr, TESTMGR_POISON_BYTE, len); + /* Be sure data is written to prevent corruption from some DMA sync */ + flush_icache_range((unsigned long)addr, (unsigned long)addr + len); } /* Is the memory region still fully poisoned? */ -- 2.35.1