Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1538984imw; Tue, 5 Jul 2022 11:09:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vlwj0ZzygJVk/svLZV1Q79j0Zset56C1LrTqnxlmd42/XXCJ7NfehQI9Wz+EMWr5bTzm4b X-Received: by 2002:a17:90b:4a8e:b0:1ec:b561:43b5 with SMTP id lp14-20020a17090b4a8e00b001ecb56143b5mr44979234pjb.239.1657044569866; Tue, 05 Jul 2022 11:09:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657044569; cv=none; d=google.com; s=arc-20160816; b=gNTt9yxwOW9twENG/GMzjBzaMbE7Dik3stGmnukfyWPvAKoca2BcR04hRRTZFFnP5/ cBzNh4zaVYJUtJJNZiTZq0o3mLfuggS6UNN/n05ZYOoQRgVD4w6KvsNqZQXMAPKJg0y2 AZKLHtmbNajWRlUfddNzx8TvzSV4eZD6mPsP1xgv7lVsRIwFnuAMBpJNBDXJtVmHDmL+ UEr8y/Qc6+ciXYwAu3K4ayCHCoBoNCane3Ui/tOCO/hK6jl9M6BFhFzdWBOE6x5olRvI m8G3kL/Dc0Vt/XQXGVn3hLD7tIuLl4LavHjzp/0VRLQQarLt3K6vgIiwpfSb6Y8gTaSQ UPEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=tp/mgAHgccbgU9bAMXiScmyIvCd30+VQEBf2GurCHPE=; b=bxpjLuRYJ8EuT4JfiJyGU14hAshTqtiE59Y1CTAcUmwGrzG/k2nmtN6/ZKmZS2YbKD JhxKbjgYZ0CCPhpf0a0w15zzbFFhLZp+H5P1xm2XePpYHr8oaYqCbnCNvRmBA8C/bXCB AbVvzWVAYGAWhoPE9vqU1KVnmZlqt3spjMzfxheJXMtE8GhUtvfzBfkj4in+wq/672yg Gh9QixN9dg638ruqgwlKk+JQld2f3OtjtgvJsrRs3sP9V7TORIZdMBFPprlCmb/QtF6h 6xMTe1tWctthceb/TB9oJ9/YLHTSc7RgmFXkiKnDTZhFva1J0btrbsI54vkUlyNE+orE CvIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=NeORGT0p; 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 f130-20020a636a88000000b0040db38fbe6dsi43494727pgc.618.2022.07.05.11.09.16; Tue, 05 Jul 2022 11:09:29 -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=NeORGT0p; 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 S231797AbiGER4V (ORCPT + 99 others); Tue, 5 Jul 2022 13:56:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230371AbiGER4U (ORCPT ); Tue, 5 Jul 2022 13:56:20 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A710F2BCA for ; Tue, 5 Jul 2022 10:56:18 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id h14-20020a1ccc0e000000b0039eff745c53so7677492wmb.5 for ; Tue, 05 Jul 2022 10:56:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=tp/mgAHgccbgU9bAMXiScmyIvCd30+VQEBf2GurCHPE=; b=NeORGT0pgGebZrwkVHkg52nMivvW56/r+8xwY4nE1j8QhfggCmqERHDAraqqq+NLFM n6YnGISqsnPnQANEOGT7V2+jFi9ulS90HZXHFBbS/5BtQNlXKPVEhgOtcjrbXa8u6pe6 oxwLl2M82Dq+bEO5FQLaEHpIy7jgJqXQ/rlOXF1lSrgTqTqYnoRJITYuCBEau5LzWIQN 3/ivFSZ5Q8gKsJ6HCsJaa/2yblKxLkkc6C5XhM7Tviz8k+/OG+xXZhd1KFgCMeZygEnr /wPJJQzQ+uSw9pUnOOvymkP4+dzQbAEUvVBHm1wl8dzTiF2g9Rvje+eASF609tmnGilD 8NOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=tp/mgAHgccbgU9bAMXiScmyIvCd30+VQEBf2GurCHPE=; b=c3rang2E01R+YcYWyhJEVY9k/3FggLU2BbGbbnOZ8NvD7wKTdTiq8N9V8OcDd2UqsX tH9Mfagxg2q+eYbMUKdJ7W5XFcxLCDONqFFLCoTWfdVmW1qg2nP3O8vY5PjbD2QVv4fv mqmVg1mqp9jc6J6fYQUa3jC+duQychDoP4J2gZUbhw9ysmCYXN/Rwk+X6HvMIgBZ/vXw uOFt6Em/iFT+dmcxci2qPAtIXRjwERiROajVqtzfCEWCWPUMzje7hXwHM2SqhUViMjIs GFwV03y14jaF1k3pSCMGknOaauutlxoBXhFXR3Cm5kWLAypfYEdcAFbSnYYGub19t6C7 cuDA== X-Gm-Message-State: AJIora923pfF20X4iuZng+v22uD8JWOQlSoAenEjdSXpaL3uCkBz2l/j N1Qs3m39dwUz6MXrYXZNMV5S5xv50gnxYw== X-Received: by 2002:a05:600c:600d:b0:3a1:9712:5d31 with SMTP id az13-20020a05600c600d00b003a197125d31mr18969023wmb.67.1657043777275; Tue, 05 Jul 2022 10:56:17 -0700 (PDT) Received: from Red ([2a01:cb1d:3d5:a100:264b:feff:fe03:2806]) by smtp.googlemail.com with ESMTPSA id r12-20020a05600c35cc00b003a04e900552sm22921126wmq.1.2022.07.05.10.56.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 10:56:16 -0700 (PDT) Date: Tue, 5 Jul 2022 19:56:11 +0200 From: LABBE Corentin To: Christoph Hellwig Cc: Ben Dooks , herbert@gondor.apana.org.au, heiko@sntech.de, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: Re: [RFC PATCH] crypto: flush poison data Message-ID: References: <20220701132735.1594822-1-clabbe@baylibre.com> <4570f6d8-251f-2cdb-1ea6-c3a8d6bb9fcf@codethink.co.uk> <20220705164213.GA14484@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220705164213.GA14484@lst.de> 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 Le Tue, Jul 05, 2022 at 06:42:13PM +0200, Christoph Hellwig a ?crit : > On Tue, Jul 05, 2022 at 10:21:13AM +0200, LABBE Corentin wrote: > > > > I just copied what did drivers/crypto/xilinx/zynqmp-sha.c. > > I tried to do flush_dcache_range() but it seems to not be implemented on riscV. > > That driver is broken and should no have been merged in that form. > > > And flush_dcache_page(virt_to_page(addr), len) produce a kernel panic. > > And that's good so. Drivers have no business doing their own cache > flushing. That is the job of the dma-mapping implementation, so I'd > suggest to look for problems there. I am sorry but this code is not in driver but in crypto API code. It seems that I didnt explain well the problem. The crypto API run a number of crypto operations against every driver that register crypto algos. For each buffer given to the tested driver, crypto API setup a poison buffer contigous to this buffer. The goal is to detect if driver do bad thing outside of buffer it got. So the tested driver dont know existence of this poison buffer and so cannot not handle it. My problem is that a dma_sync on the data buffer corrupt the poison buffer as collateral dommage. Probably because the sync operate on a larger region than the requested dma_sync length. So I try to flush poison data in the cryptoAPI. Any hint on how to do it properly is welcome.