Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3020909imu; Thu, 29 Nov 2018 14:09:18 -0800 (PST) X-Google-Smtp-Source: AFSGD/XD+ikkma3tTs2F/PaoyoQwUipY2j36mfo41DrjeWYh95fVSSTA5c359iYkzpwvoAO7vCS0 X-Received: by 2002:a63:2c82:: with SMTP id s124mr2667686pgs.73.1543529358405; Thu, 29 Nov 2018 14:09:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543529358; cv=none; d=google.com; s=arc-20160816; b=VR5a5P86IYZM83vPgImlJEAWInfoiC7x4g2XAHHlYExXz6dA7BWjG9ulHR7q7uPZfi E1s0WKp+XIS3oFGEtldMRCR5RGIlus+8BpkI67UCc89CAi3b1/T/eFOXNgpGMD28XZaB 75TnIWMzHAecK56N3sJ/rMMemsgwQQqFXDAhn7n9e15a52kth5zp+O/od3/QKdZkK7yq LcevWoMS0xQ7Q6rYbcaDlOkglCY8FT5iBbKhHE3m7qcx66F9Us8gSAr7LLkqJpw7BNX+ fQZrFNfzWc75tb/OLkMBTjdCAUptyH50VSKCbybeXuq5Y1nADHl0MXzJVVC3R72ivSHX yEVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=2V5q1RZhIAgk2y8PFh917I/PmTMC8nPJHHRYBZqgcx0=; b=kuBSCDkgFDjj3u2Pt+xzrZbGcdrZEh5xhp41OU3NgsFswaG+q2O8C+Foa1EfNCKqar kpXJWY09W3TlXYfC+QSI78vAkOkdPIpobZakYPEjPbCXZr8ptcO0lF/geBARCHCK6HzP SH8QprHXYvtiyLWu+8Em1hLsZz26MbBZYT56LS3ZMTT58Uc/L1FklRu9MO1kh4Zayg7s 4CLIznULLdAjDTZz0kHxpfnQKpvz7roS5ubj9yqzjA7U9wNWl7Me0EzzL1A/7VQG2V/0 2iXo6WYd4cDhIlss3mXr5lMLbUo4gbwharwMHroQnciOn9c6452dLMIjUX8hnWAJo0NJ mQTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kEPeLPO3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 35si3405581plf.177.2018.11.29.14.09.03; Thu, 29 Nov 2018 14:09:18 -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; dkim=pass header.i=@chromium.org header.s=google header.b=kEPeLPO3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726848AbeK3JNt (ORCPT + 99 others); Fri, 30 Nov 2018 04:13:49 -0500 Received: from mail-yb1-f195.google.com ([209.85.219.195]:34544 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726264AbeK3JNt (ORCPT ); Fri, 30 Nov 2018 04:13:49 -0500 Received: by mail-yb1-f195.google.com with SMTP id a67-v6so1427369ybg.1 for ; Thu, 29 Nov 2018 14:06:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2V5q1RZhIAgk2y8PFh917I/PmTMC8nPJHHRYBZqgcx0=; b=kEPeLPO3yIbXBbGpec+rpkoXwlrpPoRSRWxGMkrfD/Q6zm83lnca5n9Cq7GDW7mqNw hSV1yTXH8rvo85dQMw9Oph0qN31CqqmrSRCXBIwusnghwaccs9hSJbjKuYfVHTJtaK3Z CF2llBa2vDEIFTpNkKWNkMFstm/bByg22GdPk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2V5q1RZhIAgk2y8PFh917I/PmTMC8nPJHHRYBZqgcx0=; b=DCmq7XAMlpGU+dw83AtHvGC1Sl0RAfnAhopUmrCii7WKuaWhC0EHfQzncRp0uzu77f EyFVuM/0Xx3bXGPqCyrLhijWnDASXxOrXl3tZgsJVzFmZ8Yhr7bgkvSCRQDErfDiYgmD 8OVEF9ssMheB1KyDWoOm16lOB5M4zwU/pWO+V65m1tnkIFRCo2P4rHpUiZ25efCRDQvV bAvlSZFrawrm2EAmL+4xf9cP4EcZwt/NHuAQ9rE+iPlX8yILd8eC42qhedMmv58ZU3UM /8Gi/p3oNNh2FCvYK2y1fmcsG1bkLO8+VAMFkOPsZz+xVZGHpjIL3iO14OH/kxsJ7Gao HxDw== X-Gm-Message-State: AA+aEWZB5Ya+/j2PIi4wC4ypSgi0Ej2ac+Mgy5gYw54GcOcWdyAXUvMn LcyRmRR1e11sgFyRfEmwP1QMP1tJXDM= X-Received: by 2002:a25:4e82:: with SMTP id c124-v6mr3183701ybb.481.1543529212476; Thu, 29 Nov 2018 14:06:52 -0800 (PST) Received: from mail-yw1-f52.google.com (mail-yw1-f52.google.com. [209.85.161.52]) by smtp.gmail.com with ESMTPSA id i2sm922046ywc.59.2018.11.29.14.06.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Nov 2018 14:06:51 -0800 (PST) Received: by mail-yw1-f52.google.com with SMTP id h32so1450989ywk.2 for ; Thu, 29 Nov 2018 14:06:50 -0800 (PST) X-Received: by 2002:a81:2890:: with SMTP id o138mr3431193ywo.168.1543529210469; Thu, 29 Nov 2018 14:06:50 -0800 (PST) MIME-Version: 1.0 References: <20181101235200.28584-1-keescook@chromium.org> <20181101235200.28584-3-keescook@chromium.org> <20181102182454.GB14942@google.com> In-Reply-To: From: Kees Cook Date: Thu, 29 Nov 2018 14:06:39 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/8] pstore: Do not use crash buffer for decompression To: Joel Fernandes Cc: LKML , Anton Vorontsov , Colin Cross , Tony Luck Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 13, 2018 at 11:56 PM Kees Cook wrote: > On Fri, Nov 2, 2018 at 1:24 PM, Joel Fernandes wrote: > > On Thu, Nov 01, 2018 at 04:51:54PM -0700, Kees Cook wrote: > >> + workspace = kmalloc(unzipped_len + record->ecc_notice_size, > > > > Should tihs be unzipped_len + record->ecc_notice_size + 1. The extra byte > > being for the NULL character of the ecc notice? > > > > This occurred to me when I saw the + 1 in ram.c. It could be better to just > > abstract the size as a macro. > > Ooh, yes, good catch. I'll get this fixed. I spent more time looking at this, and it seems that only the initial creation of this string needs the +1, since all other operations are byte-based not NUL-terminated string based. It's a big odd, and I might try to clean it up differently, but as it stands, this is okay. (See inode.c which doesn't include the trailing NUL byte.) -Kees -- Kees Cook