Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp6462027rwb; Tue, 9 Aug 2022 16:09:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR73qfMUJ0uogjXwb3DfdCzeMsxwyQX+iolIuB5bEAbA0QU0awVXNmYuZdrGzJU9T8p+Q/nV X-Received: by 2002:a05:6a00:234f:b0:525:1f7c:f2bf with SMTP id j15-20020a056a00234f00b005251f7cf2bfmr25328710pfj.14.1660086573055; Tue, 09 Aug 2022 16:09:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660086573; cv=none; d=google.com; s=arc-20160816; b=V7xhKVQfHZeSSLDoNbiWs4//RoDh+Dkqmna8idost5hXTGuD/Qnh1Tifke5A6aZRQw WPApp36A0rf9BWCcj4meV6uXn7qoNI6SQ5K8qM61Fb2x6Q2gOZgvBhV8YWFvJVG7TDYc m6KjUSFv8Bcj7yrl5n7pSJMkCr1piOkprO0ArrICIPCf6GUwbe9vohurCztmmNCEW6mQ rWhSeN2vOFRFXuC2gkTF01HWufxxm3LLAb94ZQaykOIkXJgRSpICVkKiw08il6xGLyR0 sFdrCO1VUpK09F8vSZCd2R0GLHBs1db/GEw2Y3ypZtzdZJBtejco/hiHeLWE8hnVoDZv BM7A== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0dif6Jvy3tqvIXoBURzewg07wJiLTaWlzuiD5tnehZE=; b=j4CY7PCChmLnPiuw0n/eaZEs6P5ebSjKXW5pq/mlYeLixPajxWPodC3wCHy1mhBMfJ NFlFLw8SIdeWhV+8HxPM58vNwGe0UMin0dRWaAPYzIIP6882uyqRa2Uc+iRsrc7gSTrG ES4nohRpUwEqNF6xs7CzbMSExZ9gEaHrg3x4ca2iRkQD17dhL5M+nsZhXvTnEYoRobPD QYbS3NPjlHVgliX5MjG8GLVWZd7sMoAKPqXC9ROrt7Ktilzxo+SXk5Ak9eqWMBO0R78d hhOYe9RsizTT4SiphCG6EhOnR6eD1HRjxKEXV+yIi9z2b13SMuJ1DM1h0RZFQpjhoPsd 5UcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jz+mkg4M; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e71-20020a63694a000000b0040cc59144b1si9836952pgc.745.2022.08.09.16.09.19; Tue, 09 Aug 2022 16:09:33 -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=pass header.i=@chromium.org header.s=google header.b=jz+mkg4M; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229568AbiHIXGd (ORCPT + 99 others); Tue, 9 Aug 2022 19:06:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229878AbiHIXGO (ORCPT ); Tue, 9 Aug 2022 19:06:14 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC1C26D9FB for ; Tue, 9 Aug 2022 16:06:10 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id e8-20020a17090a280800b001f2fef7886eso381140pjd.3 for ; Tue, 09 Aug 2022 16:06:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=0dif6Jvy3tqvIXoBURzewg07wJiLTaWlzuiD5tnehZE=; b=jz+mkg4M3KX4TsHlSIFsNKZmwOPj2rmlji2B1M6p3UD/Pk0q2u/6+iy7IF7h04ED9Z ooqEoj9iQZ6vEmtdTYX2RfWKfqUR8vqp/7Hws2yv1o+Su2MDPo4vAmU6/qV3i/1s/JgI JQl2P9f8nFQ1AUjrL9O1hCsDgK5ybki/OmESI= 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:content-transfer-encoding :in-reply-to; bh=0dif6Jvy3tqvIXoBURzewg07wJiLTaWlzuiD5tnehZE=; b=ys0UcS31aoWVKQ/OsrW2Wj5pCZibuDdHij+TJl9AdNJDxZLRge7bccRDhC2T8yQ0W6 Wb+vcmK7D/ZFDtVW4HtcaTWZVruG8YDWcQsjcgEajBJf9ZPZp6BG7X7wR5yp9RZ2jtzD nyvZq8/FvbXJVuGHwj9I2AYTgaK8fnA/JXvLxNFOYcWyIwO5UeG0zHbQZxzRut+U76Oe i7ZtpaSPDtu5VtiDI/vjLq7wv+a8ctL+YTU4e/FCLefzjmvWRIKZ+RaLVlJlyCrDCaNy ZBguIxi3Z/t7zgQNb5g7bfdoRpc61D+WlBBoCh0XNg+EqVra0aFmwfTn05wbQPnUAFax rQrA== X-Gm-Message-State: ACgBeo24jaIPM5DhKdcEWUqNOjSPkapNtHm63dW5f6OEg4pA/q4SmpfC csDf7M1/rGvpDCnDzcgjg2O6nOaIcJtuSw== X-Received: by 2002:a17:903:1110:b0:16b:6968:1d08 with SMTP id n16-20020a170903111000b0016b69681d08mr25432123plh.3.1660086370284; Tue, 09 Aug 2022 16:06:10 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id i14-20020a17090a64ce00b001f2e20edd14sm118690pjm.45.2022.08.09.16.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 16:06:09 -0700 (PDT) Date: Tue, 9 Aug 2022 16:06:08 -0700 From: Kees Cook To: Florian Fainelli Cc: WeiXiong Liao , Linux Kernel , Anton Vorontsov , Colin Cross , Tony Luck , Kamal Dasu Subject: Re: Invalid pstore_blk use? Message-ID: <202208091600.D19DFF9C7D@keescook> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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-kernel@vger.kernel.org On Tue, Aug 09, 2022 at 11:35:08AM -0700, Florian Fainelli wrote: > Hi Kees, WeiXiong, > > On 7/14/22 20:49, Florian Fainelli wrote: > > Hi Kees, WeiXiong, > > > > I am trying to make use of pstore_blk which is BTW exactly what I had > > been looking for to store panic/console logs onto an eMMC partition. > > > > Using the 5.10 kernel plus: > > > > 7e2e92e9861b Revert "mark pstore-blk as broken" > > 01c28bc8f389 pstore/blk: Use the normal block device I/O path > > 2a7507999638 pstore/blk: remove {un,}register_pstore_blk > > fef0b337cd25 pstore/zone: cap the maximum device size > > > > or the android13-5.15 (at Merge 5.15.40 into android13-5.15) kernel with > > no changes and using: > > > > mount -t pstore pstore /sys/fs/pstore > > modprobe pstore_blk blkdev=/dev/mmcblk1p9 best_effort=yes > > > > upon triggering a crash with: > > > > echo c > /proc/sysrq-trigger > > > > and rebooting and remounting the pstore filesystem and loading > > pstore_blk, I only have: > > > > # ls /sys/fs/pstore/ > > console-pstore_blk-0 > > > > which contains the entire console log up to, but excluding the crash. > > The kernel does show that pstore_blk was used for all 3 types of kmsg, > > pmsg and console: > > > > [?? 28.649514] pstore_zone: capping size to 128MiB > > [?? 28.712894] pstore_zone: registered pstore_blk as backend for > > kmsg(Oops) pmsg console > > [?? 28.721145] pstore: Using crash dump compression: deflate > > [?? 28.906253] printk: console [pstore_blk-1] enabled > > [?? 28.911229] pstore: Registered pstore_blk as persistent store backend > > [?? 28.917735] pstore_blk: attached pstore_blk:/dev/mmcblk1p9 > > (134217728) (no dedicated panic_write!) > > > > there is no automatic reboot upon panic, so I just tend to reboot after > > 2-3 seconds manually. The kernel is configured with the default > > CONFIG_PSTORE_* options. > > > > Is the observed behavior a limitation of the best_effort mode? If so, do > > we have any plans to implementing a non-best effort mode for eMMC > > devices? > > Any feedback on my email? I did try to get kernel panics to be dumped out to Hi! Sorry I lost this email originally. :) > a dedicated /dev/mtdblock* partition for which there ought to be support for > mtd->panic_write, but it still did not work any better. Is there something With the mtdblock driver, do you still see: pstore_blk: attached pstore_blk:/dev/... (no dedicated panic_write!) ^^^^^^^^^^^^^^^^^^^^^^^^^ > obvious that I am missing which prevents kernel panics from being logged? Unfortunately it really depends on how the drivers are built. If the block layer is shut down during a panic, pstore_blk won't catch the panic. :( -- Kees Cook