Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754755AbcLNDAK (ORCPT ); Tue, 13 Dec 2016 22:00:10 -0500 Received: from mail-vk0-f52.google.com ([209.85.213.52]:33077 "EHLO mail-vk0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754628AbcLNDAJ (ORCPT ); Tue, 13 Dec 2016 22:00:09 -0500 MIME-Version: 1.0 In-Reply-To: <627e948e37314c13a67c90917386c814c56b8e20.1481683609.git.luto@kernel.org> References: <627e948e37314c13a67c90917386c814c56b8e20.1481683609.git.luto@kernel.org> From: Andy Lutomirski Date: Tue, 13 Dec 2016 18:53:03 -0800 Message-ID: Subject: Re: [PATCH v2] keys/encrypted: Fix two crypto-on-the-stack bugs To: Andy Lutomirski Cc: "linux-kernel@vger.kernel.org" , USB list , David Howells , keyrings@vger.kernel.org, Eric Biggers , linux-crypto@vger.kernel.org, Herbert Xu , Stephan Mueller Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 578 Lines: 15 On Tue, Dec 13, 2016 at 6:48 PM, Andy Lutomirski wrote: > The driver put a constant buffer of all zeros on the stack and > pointed a scatterlist entry at it in two places. This doesn't work > with virtual stacks. Use ZERO_PAGE instead. Wait a second... > - sg_set_buf(&sg_out[1], pad, sizeof pad); > + sg_set_buf(&sg_out[1], empty_zero_page, 16); My fix here is obviously bogus (I meant to use ZERO_PAGE(0)), but what exactly is the code trying to do? The old code makes no sense. It's setting the *output* buffer to zeroed padding. --Andy