Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp190076rwb; Thu, 6 Oct 2022 16:52:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Mo8m3J3yBV5kRrRODe6iYiPvGZ5TWLHTwZ2dw/qNUFWwl5bOAUe1LmGe8c8DoiiB1zDIJ X-Received: by 2002:a17:906:6a0b:b0:783:1c53:a034 with SMTP id qw11-20020a1709066a0b00b007831c53a034mr1853180ejc.496.1665100367314; Thu, 06 Oct 2022 16:52:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665100367; cv=none; d=google.com; s=arc-20160816; b=Zi7AoC5qCybUs7BwQxmTbQaY+ZdMfxfIb72JCwyK2HLBCMisuPr0PMZb1Oi2dg5LhM GMq5no7pVU97lG3+I8yIQRdFlhq85eK42PN1cDEvorkXqLbdTVFu33h+vF5gGR1FaTGs LyiUEjv5L4fmBvMxCQ/jtBI0bOAXHCuf27QSVaoDOtQn5fM/wUqetxcsF0TG/oHf/RCJ ByND6eRxoR9iwHqLKoOmFVFucgnQPUWSnbq/S6Ze/BTJoWNord+4ykFeZqt3JgI5Q2VB FxvtIhgn/xtd0OrlB+fG9Xz+HSvXu2qIxSToyMYo3dizrgNsvlfdpMmUFxweMz8a7IZU JVjQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=G+pKJ+NYwNy31R5rVBG8O8KRq78K+Bn0ef6gLvXvUsE=; b=msuTCBTALYKNCQnhZ9YzgcFqaFFtblZ5rwcUJ7IIs3bMyKEQOG2DrUKNYtxgKYkika LxoTUMBdVznARXKtx4KayJalBAFLq46q6V8Yv7/husDjY4L4kO5jyb9Atmr+Z7OIgLlP Mvj01iP/GGy8ZHe6qtXeSeRqygRuO14IFKrctsbIGLQjJYbP5cX0hGOe0tmlaAo45pRY WeyBOjjvcb8VwxPr/0l6FUanX9KPo1BH+EEaqCvDdDCyO0iRJ8+9S90DZFzogCPYoKtR kqiAd2AMCUqU5Y1ZNpYpMftZD8q9r9rKaePtRpjdRkWlk0uycUHMupJZ+wfLc2/Zpcbh 9lIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=cyvZiiLN; 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 l2-20020a170906a40200b0072b1964e54esi578652ejz.1007.2022.10.06.16.52.22; Thu, 06 Oct 2022 16:52:47 -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=cyvZiiLN; 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 S231896AbiJFX1J (ORCPT + 99 others); Thu, 6 Oct 2022 19:27:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231693AbiJFX1H (ORCPT ); Thu, 6 Oct 2022 19:27:07 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82092CD5F5 for ; Thu, 6 Oct 2022 16:27:06 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id e129so3130409pgc.9 for ; Thu, 06 Oct 2022 16:27:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=G+pKJ+NYwNy31R5rVBG8O8KRq78K+Bn0ef6gLvXvUsE=; b=cyvZiiLNNQN/k/ffseKyT75ziBYKP8mMW8GgUSdfuh4H9u968RjQEtqo+5U2ngbvc1 0pU7TY2xZIfb2TNiAO3CEn6l9kV0bj4tfD85+rPCLL79EQbQypkn+nDCpXTC54wOrPLF 4x+JWeZIj6SUVDu1yIu2GtFF1oCEKHS3gE70c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=G+pKJ+NYwNy31R5rVBG8O8KRq78K+Bn0ef6gLvXvUsE=; b=m1WTmB4j4mV8KQP30MJI6PzW1sb7gx5tEsxunFY37qHB9ssIUI4xJn4xv1jL03myTO hdKnrZzu9pVjTpAgSL1prl2dq1aY6gzfw1C2nFoAGopBUP7ZTOu7RhzH9Wj/lx8zz4J/ g/9SRiS5eqKf9SNTwYJ0AYP3o6aLDOiTxdey2hZZAJ2Vsz/lKLPdg+K0Dt9sNUDraasA p0YRedvNs7i1J1zjbTzsLFiGqj9eI1fbu4zLfp/gwzlTcuYAbh/xXp3/toedtQOCgje0 wwvuIj88CMVi2eRlBtI3bVa8Zz2ojuWpINSHZbMqAJMIX3wXYnvNBLsfVbj2gM4U/xaK IqRQ== X-Gm-Message-State: ACrzQf3FbYJOdR1gijPI4iC98iFdLq8bq/c3eYRh+SOdVkRDendZWhO6 AhA7tNi9NfjBCw6SYIEdoF7/0A== X-Received: by 2002:a63:2f45:0:b0:457:dc63:68b4 with SMTP id v66-20020a632f45000000b00457dc6368b4mr1930448pgv.228.1665098826001; Thu, 06 Oct 2022 16:27:06 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id f6-20020aa79686000000b00540d03f3792sm172347pfk.81.2022.10.06.16.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 16:27:05 -0700 (PDT) Date: Thu, 6 Oct 2022 16:27:04 -0700 From: Kees Cook To: "Guilherme G. Piccoli" Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, kernel-dev@igalia.com, kernel@gpiccoli.net, anton@enomsg.org, ccross@android.com, tony.luck@intel.com Subject: Re: [PATCH 4/8] pstore: Alert on backend write error Message-ID: <202210061625.950B43C119@keescook> References: <20221006224212.569555-1-gpiccoli@igalia.com> <20221006224212.569555-5-gpiccoli@igalia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221006224212.569555-5-gpiccoli@igalia.com> X-Spam-Status: No, score=-2.1 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 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 Thu, Oct 06, 2022 at 07:42:08PM -0300, Guilherme G. Piccoli wrote: > The pstore dump function doesn't alert at all on errors - despite > pstore is usually a last resource and if it fails users won't be > able to read the kernel log, this is not the case for server users > with serial access, for example. > > So, let's at least attempt to inform such advanced users on the first > backend writing error detected during the kmsg dump - this is also > very useful for pstore debugging purposes. > > Signed-off-by: Guilherme G. Piccoli > --- > fs/pstore/platform.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c > index 06c2c66af332..ee50812fdd2e 100644 > --- a/fs/pstore/platform.c > +++ b/fs/pstore/platform.c > @@ -463,6 +463,9 @@ static void pstore_dump(struct kmsg_dumper *dumper, > if (ret == 0 && reason == KMSG_DUMP_OOPS) { > pstore_new_entry = 1; > pstore_timer_kick(); > + } else { > + pr_err_once("backend (%s) writing error (%d)\n", > + psinfo->name, ret); We're holding a spinlock here, so doing a pr_*() call isn't a great idea. It's kind of not a great idea to try to write to the log in the middle of a dump either, but we do attempt it at the start. Perhaps keep a saved_ret or something and send it after the spin lock is released? -- Kees Cook