Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp1116013rwo; Wed, 2 Aug 2023 08:58:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlFGnj7BJxOWWpWtRxJafpWGw2ILP/vaKGLu5VmbRP2DpKfFOC+8jQkm7eRMfPa3WW43y3TQ X-Received: by 2002:aa7:dd0a:0:b0:522:1d30:efce with SMTP id i10-20020aa7dd0a000000b005221d30efcemr4795030edv.22.1690991887063; Wed, 02 Aug 2023 08:58:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690991887; cv=none; d=google.com; s=arc-20160816; b=rXHt808aqet8uUPIcaahq55ojLNch9PvYJpMjt25Alpvrwde0hY5xyjNBg6gEWlfc1 3nwrrKjjNTpJlIDrwLYxQZgaamk648njUUogWEj0fxvVuzptHPYjaX5Yrs7zDLRtxka5 YYVRe1bLEKDbjGP24m5GP5+XtTsUTG4ndXWI6X8YYfR6AzaZsE3tEdDDz0ZzRwTy+byr rNXdqMK2ooMO4+YAlzmuqqsV4Ezc0vpDnfa2lo7Fl2wROI6PEg8ngapFWMDDcaBxs0TU Z2RQe/+vLMvE1hiW/UrDL9z/bjIW4sIgHNTkuV7qWoQAzxeYI+FSa2vqAu/LdxXMtAjM DrGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=u+eTVzDBOj1InyZSduxL/CRo1hb2JHwGid0R+96a+4A=; fh=M4yqY1pbrVodegWEHUt+Jnrcc4ZQhifue9cX7zjACoE=; b=AODS8Zmi4m822w6nhCBl4FSGkOgKnZHZlXvbBhDT4etVoJcJxAc5DiGac66t2J4Xae BXbwi04Qdqie0smjdRFW6Js6xYmDrUSG1EbVyU0JgtCAZKOw62KMxBtaSuKj0CrY1uzo RmTTlBmN5kGSKpk5LgcVcP7Awddp9lloPzxgRcqxmKtRggHHEjTsg2FTT08UKBGYRF3q XnH6OE/SDr9Qmrl7RfmpTe0m1I8ZeW4Unr1hD7e2wvyXwzH5vfUhW/Ou9GO4rEHOfbNd MyCE9VGIgdWHnHqfVGyZhKrvGuwApM/Mh5m8w0B1NWmlHIg5TxjxBc4auC+rs7MJ3Dnc 15dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=R8nVVTha; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l16-20020aa7d950000000b00522270c5923si10048477eds.528.2023.08.02.08.57.42; Wed, 02 Aug 2023 08:58:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=fail header.i=@igalia.com header.s=20170329 header.b=R8nVVTha; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234075AbjHBPrU (ORCPT + 99 others); Wed, 2 Aug 2023 11:47:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232505AbjHBPrT (ORCPT ); Wed, 2 Aug 2023 11:47:19 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A123D9B; Wed, 2 Aug 2023 08:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=u+eTVzDBOj1InyZSduxL/CRo1hb2JHwGid0R+96a+4A=; b=R8nVVThaPu37mhmrjlsqLt5r/F wT4rNJt2iafYVQYZ1qEZJ0ZdTF213lPo3aB9cVKEp+z+oSYkJygZRzkSEX9cR7bIQZGAyDe7B0mss 31dGjJ51OjjKDbanIkl6EZdvJAV4sw6SWUBJb7up8WumIHIFNVpfSjEpUv2Chwp2gsLRgBS88egUW rJQ/1LYYgZg9mznMj/11RVNJLZxfertQ1Ck2Abj7M25RQUd6KMbdtpQOi4ylg1MWajbPVIlYkDotf Ms6DAVKu+Gb/9AkNKMwD9ozYjlP5gnkBs8koBNOp4bhGsFOymBrUnZaJgYd9YbfeXAcexK1lPFcZQ qMrHaUlw==; Received: from 201-92-22-215.dsl.telesp.net.br ([201.92.22.215] helo=[192.168.1.60]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_128_GCM:128) (Exim) id 1qRE3s-00BGGs-8w; Wed, 02 Aug 2023 17:46:56 +0200 Message-ID: Date: Wed, 2 Aug 2023 12:46:49 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH 1/1] pstore/ram: Check member of buffers during the initialization phase of the pstore Content-Language: en-US To: Yunlong Xing , keescook@chromium.org, tony.luck@intel.com, joel@joelfernandes.org, enlin.mu@unisoc.com Cc: linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, enlinmu@gmail.com, yunlong.xing23@gmail.com References: <20230801060432.1307717-1-yunlong.xing@unisoc.com> From: "Guilherme G. Piccoli" In-Reply-To: <20230801060432.1307717-1-yunlong.xing@unisoc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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-kernel@vger.kernel.org On 01/08/2023 03:04, Yunlong Xing wrote: > [...] > diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c > index 85aaf0fc6d7d..eb6df190d752 100644 > --- a/fs/pstore/ram_core.c > +++ b/fs/pstore/ram_core.c > @@ -519,7 +519,7 @@ static int persistent_ram_post_init(struct persistent_ram_zone *prz, u32 sig, > sig ^= PERSISTENT_RAM_SIG; > > if (prz->buffer->sig == sig) { > - if (buffer_size(prz) == 0) { > + if (buffer_size(prz) == 0 && buffer_start(prz) == 0) { > pr_debug("found existing empty buffer\n"); Thanks for the patch! I'd also adjust the above print statement to reflect the different paths (empty buffers vs illegal one) and maybe bump it to pr_info, or even pr_warn(_once?). What do you all think, makes sense or could we pollute dmesg too much? Cheers!