Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3823783imu; Mon, 7 Jan 2019 10:05:25 -0800 (PST) X-Google-Smtp-Source: ALg8bN6fhGvxFoNKnJG11AgJBn/FvNh+gdkW1/DqUoMSK58/tjNdL4vCbMTaDNvfEw12j7OQ9QH9 X-Received: by 2002:a63:1013:: with SMTP id f19mr11826488pgl.38.1546884325250; Mon, 07 Jan 2019 10:05:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546884325; cv=none; d=google.com; s=arc-20160816; b=DTVC5T564/yUyA8nIINy/LWskOucRku43va3nh8mrY9ISVUPHBLfIkmhrbE7vUnz5p 2jm78lh+y/o80vQvjAwNvjplU8wwq/Blvf2/9P8gvH2q7ghX6G17n1+YwmA4lQ/BI9Dk CQtfNUw2/3yoBqsl6tZUM4S/18ykI77+5aZxYAfv7FR0OsKwWXrnxYBPviELhrEqEPlc hI+n1RF+utOEjet1MgPqVuTrxip+l+h+87TJ1fguYJ8f+vyqj41aplxnWjyOiIOl0kbW o/v1kqkUo7YjC8mhess2dBFCbaDKZcAcRlCVix5EYzD4lJpWm1cKWPoul4eYQ6n/ugzE gIlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Haio7TbC2YkgcHFHxCWYMcw9k0Ir9kMwhdbrSjsdfRE=; b=PK+oScebm2WWpfUJDBz3zW8e3/pbUy8jkIT6HucNu/btTAaOkCSOylDsBDeXm+Sd1F CqdLqvf1zcdRTGzm7GhJOvBF9JQEmw57uxX0qdixqto5VPZFB0wnXLvSr2UJDMZPQ/fr NGparkpeZRDu7z8Uc5YUkB0OoVREBXAapehyipN+Mva0VvbuBKFEjdmv3S70E72l3ysw DBzH5uZl90p7V2XRUT0JvV7LKsrgT9t8zWKEZ7MgA+6I7+bSZlO9pDt9vXrC7ZlxggEV m5TgoZ5ROvnzonxC84bCrDi7yLRCYinh4t/JE5nGmqlBPUwraIw53HjbAaFU4RIDSYGV TM/g== 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 f90si5033100plb.362.2019.01.07.10.05.10; Mon, 07 Jan 2019 10:05:25 -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 S1726793AbfAGRGS (ORCPT + 99 others); Mon, 7 Jan 2019 12:06:18 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:37200 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726643AbfAGRGS (ORCPT ); Mon, 7 Jan 2019 12:06:18 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 43YMH559FMz9vGlM; Mon, 7 Jan 2019 18:06:09 +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 dl4EcOjDCiYh; Mon, 7 Jan 2019 18:06:09 +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 43YMH54fNvz9vGlL; Mon, 7 Jan 2019 18:06:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 985168B838; Mon, 7 Jan 2019 18:06:16 +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 GcQYpRrA_W5j; Mon, 7 Jan 2019 18:06:16 +0100 (CET) Received: from PO15451 (po15451.idsi0.si.c-s.fr [172.25.231.3]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 53AAA8B833; Mon, 7 Jan 2019 18:06:16 +0100 (CET) Subject: Re: [PATCH v3] crypto: talitos - fix ablkcipher for CONFIG_VMAP_STACK To: Horia Geanta , Herbert Xu , "David S. Miller" Cc: "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "stable@vger.kernel.org" , "iommu@lists.linux-foundation.org" References: From: Christophe Leroy Message-ID: Date: Mon, 7 Jan 2019 18:06:15 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 04/01/2019 à 16:24, Horia Geanta a écrit : > On 1/4/2019 5:17 PM, Horia Geanta wrote: >> On 12/21/2018 10:07 AM, Christophe Leroy wrote: >> [snip] >>> IV cannot be on stack when CONFIG_VMAP_STACK is selected because the stack >>> cannot be DMA mapped anymore. >>> This looks better, thanks. >> >>> This patch copies the IV into the extended descriptor when iv is not >>> a valid linear address. >>> >> Though I am not sure the checks in place are enough. >> >>> Fixes: 4de9d0b547b9 ("crypto: talitos - Add ablkcipher algorithms") >>> Cc: stable@vger.kernel.org >>> Signed-off-by: Christophe Leroy >>> --- >>> v3: Using struct edesc buffer. >>> >>> v2: Using per-request context. >> [snip] >>> + if (ivsize && !virt_addr_valid(iv)) >>> + alloc_len += ivsize; >> [snip] >>> >>> + if (ivsize && !virt_addr_valid(iv)) >> A more precise condition would be (!is_vmalloc_addr || is_vmalloc_addr(iv)) >> > Sorry for the typo, I meant: > (!virt_addr_valid(iv) || is_vmalloc_addr(iv)) As far as I know, virt_addr_valid() means the address is in the linear memory space. So it cannot be a vmalloc_addr if it is a linear space addr, can it ? At least, it is that way on powerpc which is the arch embedding the talitos crypto engine. virt_addr_valid() means we are under max_pfn, while VMALLOC_START is above max_pfn. Christophe > >> It matches the checks in debug_dma_map_single() helper, though I am not sure >> they are enough to rule out all exceptions of DMA API.