From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF456EB64D7 for ; Wed, 28 Jun 2023 17:57:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232281AbjF1R5D (ORCPT ); Wed, 28 Jun 2023 13:57:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231963AbjF1R4B (ORCPT ); Wed, 28 Jun 2023 13:56:01 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24CC6273B for ; Wed, 28 Jun 2023 10:56:00 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1b80ddce748so1419795ad.3 for ; Wed, 28 Jun 2023 10:56:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1687974959; x=1690566959; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=UFGqQjNLgtCZhOK9NTaUTj7bxMdQbyY6Zjaqy2ayJjA=; b=HT4hhiN5JNn0QZARAU/GPGa/fqMUEU/xWerlomznK4qOeXv70AjIVWQytBKI7nuUOr y30LJria+EJLeMYiwDI19PBMLCYv1zqAHrXhJ6OjGKVqFeNZQkbHJWTgPh+UcIJ+VZI8 nwgB7vTZxK12d6z/+pMZx7pQCb4SnIcPvgFdU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687974959; x=1690566959; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UFGqQjNLgtCZhOK9NTaUTj7bxMdQbyY6Zjaqy2ayJjA=; b=U2GH4JkKeoaauOCR6t2mRFes66W2mCMJAKjiLYZmHOj81R6jySVoq+1jOjYs6mP1rT IwBy9VCVBwwEMqO9XXEz2SVtwxtS77knVIBIHczh32HlPngEqo+8ZMi8cXool/siX9gi FmEi3LwPxaqkN6LvFeGQEg/Vb0xNQDt4M2HaMdAHUrGO8CZOfZKbpJOorlfrl9KYOLup FopiCWO7CJR3bD4ngcOe90fopcqzd/2R3iBBCfT57Yht5IO8tC36jQA8YuttCD1nt7q9 hLKzYHQO2nS35t2t9f0bUXS8XKspuHDWAZhI18wHpf63wuTppdGNNoP6WVTwGKst2OzV PKjQ== X-Gm-Message-State: AC+VfDz9hVwptAD9DyCEYYCaahdFk8OBNrltA/w133UO3ambOOEsNFbl PRksNOADU3uk6BHjIP+my5h2jw== X-Google-Smtp-Source: ACHHUZ4pCHzrs3aB3Au1vDEg5t3p5jkohCdi/8ZwcCKxSUqYnxrYOVYU9Bcm50mn5vuXsh9GgTVoug== X-Received: by 2002:a17:902:dace:b0:1b3:c7c1:8ded with SMTP id q14-20020a170902dace00b001b3c7c18dedmr10816630plx.27.1687974959600; Wed, 28 Jun 2023 10:55:59 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id p8-20020a170902b08800b001b8307c81c8sm1970075plr.121.2023.06.28.10.55.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 10:55:58 -0700 (PDT) Date: Wed, 28 Jun 2023 10:55:58 -0700 From: Kees Cook To: Yuxiao Zhang Cc: Tony Luck , "'Guilherme G . Piccoli'" , Greg KH , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, wak@google.com Subject: Re: [PATCH] pstore: ramoops: support pmsg size larger than kmalloc limitation Message-ID: <202306281053.EC5115465B@keescook> References: <20230627202540.881909-2-yuxiaozhang@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230627202540.881909-2-yuxiaozhang@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 27, 2023 at 01:25:41PM -0700, Yuxiao Zhang wrote: > Current pmsg implementation is using kmalloc for pmsg record buffer, > which has max size limits based on page size. Currently even we > allocate enough space with pmsg-size, pmsg will still fail if the > file size is larger than what kmalloc allowed. > > Since we don't need physical contiguous memory for pmsg buffer > , we can use kvmalloc to avoid such limitation. Conceptually, I am fine with this change. I need a little time to trace down the allocations. At first glance, I thought this patch only needed to cover pstore_write_user_compat(), but I guess the read side needs to be adjusted as well? I'll double-check. And yes, Greg's questions are all good -- fixing syntax and adding size details in the commit log would be appreciated. -Kees -- Kees Cook