Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp7208247ioo; Fri, 3 Jun 2022 01:48:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvJoj5fhh2ZTRD0o1+NlmjBWPgLfPViWGb3cm0e4MmDiIgHDyvNJHQ92F66PGjx/VgAeQR X-Received: by 2002:a05:6402:510b:b0:42d:d18d:2080 with SMTP id m11-20020a056402510b00b0042dd18d2080mr9359699edd.263.1654246109600; Fri, 03 Jun 2022 01:48:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654246109; cv=none; d=google.com; s=arc-20160816; b=IkWJRJo/7XPWxVPUQG9shC0mlhuxqLFqCGX5A0ldiBw6oECT2IhRlXSH8itGlyamDr Na2ELlllHtU0l0h2BcLlK5zFKB0OPh3MO6C8+Zyk3fayr9v5kiNAlKoCj286mRJQjv8n Y1/VklBpL5WDR1IMgJoG7RfP7bc/2q5DzUcWnxrEGmKK/IOGf5zSnWUd25n7jTPHwRHU 5A3X3C38sYyztA15Wya7kgEEoWdOAjqWKr5+R+5AprXDN+xsobGDHDPvCPLcCV8bzmGd 8BzuycgIpOD+p0rAM/dArclTaFep4dUiwTXz2I9hgLRz5ryXT4Xks20aDaFGEfwUNt56 D7hQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fa0C+LCY84idsUWlo8HR0vK7eKKebloJfOXVdg8uv6I=; b=Mz8Wn61G3mKcw1YbqyP0hblQclrxNOivdcMtSKWh15bSyHfyeSxFrA6FKiJ2kIXEej tw0HQ7jqVGHV23WOmZmxbAowqaI2UCHDOncV+1p/TTRe49fE4zumjHJfhhZt+LwP7v6S 15dwjvckOraaw33zFucntp8KiC6j4bx63juhvTEqNOjAGGMy/cpdrOMBiViun4nYYcxm AADpeJgtcCf+lHHrUdjPlSkR6Q2fq+59lHTYZwGg7btjTKEoJn0PvfKv7dEiLeCo9ctE Cs1/OjKosVbdi1hR9KsjacygTjtpvQwU+apFYnJkPV21+jYD1t2msQEirpigzZEZttju SRmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=JERo+Oyy; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020aa7d851000000b0042a4bc4129esi6074926eds.186.2022.06.03.01.47.50; Fri, 03 Jun 2022 01:48: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=@gmail.com header.s=20210112 header.b=JERo+Oyy; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229598AbiFCE0x (ORCPT + 99 others); Fri, 3 Jun 2022 00:26:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229540AbiFCE0t (ORCPT ); Fri, 3 Jun 2022 00:26:49 -0400 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A58ACB54 for ; Thu, 2 Jun 2022 21:26:47 -0700 (PDT) Received: by mail-qt1-x836.google.com with SMTP id p8so4820026qtx.9 for ; Thu, 02 Jun 2022 21:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=fa0C+LCY84idsUWlo8HR0vK7eKKebloJfOXVdg8uv6I=; b=JERo+OyyoSagd/+5rww33kruhhmEsC77asJfLDqeJUTHChFWOgrP/4qpEu8nYUAczS +lh+pLDRL2m40j0mjqbzzW/EY5UMHa3IEQqkWiyPuGFonLtVHUyP1VEdRGa/ui0AJTi8 8osNV2McSTMo/jwd2Si4zvcZTdClv1ZsWAat0eVml1o29+wzfAoq2oD59LhMAKvcmvkX Yf2ZphsxD20kCt4633FwRKUSpUg0leQuiCYPa3RoYQuzJMbhDB3CkbQsgwcDhcQttf7l hkAry5YRAh1Wv9iT/1uSenWVdgokfJntkrd+F6AXCpmeJkszcfnGvh1b5I5l3dCPb7Zt yveQ== 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:in-reply-to; bh=fa0C+LCY84idsUWlo8HR0vK7eKKebloJfOXVdg8uv6I=; b=2kbk3bR0hpsHNM8Mic1cEyGP9bhBEAwawxv4/C+lX021MI8LfEChbYd9UXTseI9o5B 8X+Ks1awnpxeJmH2x00WOFRnKMS/jzk91XpJy+DR4bslTLItYrbv+y6pWcwk7xpn6ic4 GHLR8cFsXk9CRY4ZzPvHSN+2Nw/DNlgDh/ramw6NJ7St49+t7lsQ2Oby0H8jQreiBwBf B4CbPU9zD2IWiu4aWYqyX3IMmcThGtyBNN3hDTPTULdkH297ET0IRtTr1rhe+kTARUz9 Tl1G4LQ+0DpjIirt3ZcOXHwpsRe0aS/g5PpoPtrozjFaVcSEpg5TZbJKoOsEn29YYn1R a81w== X-Gm-Message-State: AOAM532lEsTTeIuaCJFGmLjiusfaJ8Y4zySJZzrbedvYTKFGAy6DYFUc YaFrAjKGyfXGnuwdBZmqWw== X-Received: by 2002:a05:622a:90:b0:303:1b86:7238 with SMTP id o16-20020a05622a009000b003031b867238mr6046788qtw.599.1654230406766; Thu, 02 Jun 2022 21:26:46 -0700 (PDT) Received: from moria.home.lan (c-73-219-103-14.hsd1.vt.comcast.net. [73.219.103.14]) by smtp.gmail.com with ESMTPSA id u12-20020a05620a430c00b006a37c908d33sm4797965qko.28.2022.06.02.21.26.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 21:26:45 -0700 (PDT) Date: Fri, 3 Jun 2022 00:26:44 -0400 From: Kent Overstreet To: Eric Biggers Cc: herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org Subject: Re: Memory corruption related to skcipher code Message-ID: <20220603042644.jj7wcvp2lzox25vs@moria.home.lan> References: <20220603021134.ehlnluenrz3adpxc@moria.home.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, 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 Thu, Jun 02, 2022 at 07:25:48PM -0700, Eric Biggers wrote: > What if the address is in the vmalloc area and spans a page boundary? If the > next page isn't physically contiguous, this will write to some random page. A > multi-element scatterlist would be needed to describe all the physical pages. That's exactly it :) Can't believe I missed that, or that that bug was lurking for so long. > Note that in v5.5 and later, ChaCha20 support is available via the library > function chacha20_crypt(), in addition to the skcipher API. You should consider > using the library function, as it seems to match your use case. I'll check that out - that looks like exactly what I was looking for when I originally wrote this code. Thanks, I owe you a beer :)