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 X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6E93C433E0 for ; Fri, 22 May 2020 17:34:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C689A206C3 for ; Fri, 22 May 2020 17:34:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mrLZoriV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730806AbgEVReV (ORCPT ); Fri, 22 May 2020 13:34:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730648AbgEVReU (ORCPT ); Fri, 22 May 2020 13:34:20 -0400 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2171CC061A0E for ; Fri, 22 May 2020 10:34:20 -0700 (PDT) Received: by mail-pg1-x542.google.com with SMTP id u5so5293973pgn.5 for ; Fri, 22 May 2020 10:34:20 -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:in-reply-to; bh=vpvOtYEoQPYr60AvQ4lbOXVaOz+PqOzSuTIlFxZC7hs=; b=mrLZoriVWpSjIlqWcoKRs7Vf38HcNAIbk1aA1aj5M9bm3Kplf4mG3Nlg9o2f8mXie9 Fzh3k6kQqtcs2C2Z92Xjo5uCe7mXGGZJ7OhLbKqmeBdBJLXUSvy785BjEvi9KRPXlUyV Jt9fS28KExNgHI2bGC8ZrNS0cBGoCgm/quS1o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=vpvOtYEoQPYr60AvQ4lbOXVaOz+PqOzSuTIlFxZC7hs=; b=tr0Jk8xrlGbOXc8wepMg57RH0zYN2wowrbhtEqGJPXanqARXKiB6UnuZK0RXbDpO0O cG8sYkn95IE8fnCoDlJRB8zzSab4Yx/MHseZkV4TS5tZMrYAkNl0ZdrvoHuhJO2At4bU +wU8grC4CYfJz/yUQ2b7YBGs16Q/9HMzrZhKll9lz4Gok+kFiUmBSPJAJ4w3XxWCZZbL D8eWmnK8yes+2D6nKJH2g6JoBxwzeGI1e3IW/6/5DjCTESs2OHOU2UnZI2X7Cq++62b/ PUdBgjWMUWa4s6bO1zc7Y8HCMnzZQ3gTnhG4VgtoeysQ6PxzGqKjIszi0SrnjYCgboYH LFQA== X-Gm-Message-State: AOAM5331ChWGhjC62VMPJ+8wnmHklpNXUmXSmVZY0zKsHEEaFQw+7mt2 ztPhNv5HSpCUdv1OBJaOZvyA3w== X-Google-Smtp-Source: ABdhPJw3mEZJxGUEwT+YtZuRAtkaUC2r/G5yxPoHLWK7Hcz3C0nz+4i4d6ISwNAJSlDeH54wMalB+Q== X-Received: by 2002:a63:b64e:: with SMTP id v14mr15087127pgt.164.1590168859526; Fri, 22 May 2020 10:34:19 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q4sm7769112pfu.42.2020.05.22.10.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 10:34:18 -0700 (PDT) Date: Fri, 22 May 2020 10:34:17 -0700 From: Kees Cook To: Petr Mladek Cc: Pavel Tatashin , Anton Vorontsov , Colin Cross , Tony Luck , Jonathan Corbet , Benson Leung , Rob Herring , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Enric Balletbo i Serra , Sergey Senozhatsky , Steven Rostedt , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v4 2/6] printk: honor the max_reason field in kmsg_dumper Message-ID: <202005221032.859452DFA0@keescook> References: <20200515184434.8470-1-keescook@chromium.org> <20200515184434.8470-3-keescook@chromium.org> <20200522165120.GL3464@linux-b0ei> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200522165120.GL3464@linux-b0ei> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 22, 2020 at 06:51:20PM +0200, Petr Mladek wrote: > On Fri 2020-05-15 11:44:30, Kees Cook wrote: > > From: Pavel Tatashin > > > > kmsg_dump() allows to dump kmesg buffer for various system events: oops, > > panic, reboot, etc. It provides an interface to register a callback call > > for clients, and in that callback interface there is a field "max_reason" > > which gets ignored unless always_kmsg_dump is passed as kernel parameter. > > Strictly speaking, this is not fully true. "max_reason" field is not > ignored when set to KMSG_DUMP_PANIC even when always_kmsg_dump was not set. > > It should be something like: > > "which gets ignored for reason higher than KMSG_DUMP_OOPS unless > always_kmsg_dump is passed as kernel parameter". > > Heh, I wonder if anyone will be able to parse this ;-) Ah yeah, good point. I've reworded things like this: kmsg_dump() allows to dump kmesg buffer for various system events: oops, panic, reboot, etc. It provides an interface to register a callback call for clients, and in that callback interface there is a field "max_reason", but it was getting ignored when set to any "reason" higher than KMSG_DUMP_OOPS unless "always_kmsg_dump" was passed as kernel parameter. Allow clients to actually control their "max_reason", and keep the current behavior when "max_reason" is not set. > Otherwise, it looks good to me. With the updated commit message: > > Reviewed-by: Petr Mladek Thanks! -- Kees Cook 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 X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5FB1C433DF for ; Fri, 22 May 2020 17:36:58 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5983B20723 for ; Fri, 22 May 2020 17:36:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="mrLZoriV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5983B20723 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49TDFM6jGczDqhl for ; Sat, 23 May 2020 03:36:55 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=chromium.org (client-ip=2607:f8b0:4864:20::543; helo=mail-pg1-x543.google.com; envelope-from=keescook@chromium.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=mrLZoriV; dkim-atps=neutral Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49TDBT4KhdzDqvN for ; Sat, 23 May 2020 03:34:22 +1000 (AEST) Received: by mail-pg1-x543.google.com with SMTP id f4so5282554pgi.10 for ; Fri, 22 May 2020 10:34:22 -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:in-reply-to; bh=vpvOtYEoQPYr60AvQ4lbOXVaOz+PqOzSuTIlFxZC7hs=; b=mrLZoriVWpSjIlqWcoKRs7Vf38HcNAIbk1aA1aj5M9bm3Kplf4mG3Nlg9o2f8mXie9 Fzh3k6kQqtcs2C2Z92Xjo5uCe7mXGGZJ7OhLbKqmeBdBJLXUSvy785BjEvi9KRPXlUyV Jt9fS28KExNgHI2bGC8ZrNS0cBGoCgm/quS1o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=vpvOtYEoQPYr60AvQ4lbOXVaOz+PqOzSuTIlFxZC7hs=; b=Wwev+qrHmrQYspER2kMqXQtLE07CGjBWM2+urwp7ARxVpxJXk/DarHthIy674zx4Gz LZoE0o1gBhIdKKjAxgRw2LCOEdbCdVtA6B4MuZYYQW5aBOuT+8KHTz+z9GMZai9YJPo3 HkqscQLvnec0Zqw9DuzlFqDC2zZMn5PrM7qMHKwBVvQus15UdYTU74yJdLwDYudRSdEk qZFnnCCMCNJSivJql37eN7oAQ7kfGoHwac6pysDbBiDSlTmL3Be+MC8KHiBMciBTZDhW nxAP8DY7OJamX4CreY/5wkno89Qq/QuQWI/SPASRO3nJ153MRM1vK9/tYyMauA6/PHue zWLg== X-Gm-Message-State: AOAM533tiQrDxPs1vDitMpMdLAlNs64hw861O6JNeUrhwtmFW0nytNiK 7QuJXEKPvw7uBInVu3DibutL6w== X-Google-Smtp-Source: ABdhPJw3mEZJxGUEwT+YtZuRAtkaUC2r/G5yxPoHLWK7Hcz3C0nz+4i4d6ISwNAJSlDeH54wMalB+Q== X-Received: by 2002:a63:b64e:: with SMTP id v14mr15087127pgt.164.1590168859526; Fri, 22 May 2020 10:34:19 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id q4sm7769112pfu.42.2020.05.22.10.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 10:34:18 -0700 (PDT) Date: Fri, 22 May 2020 10:34:17 -0700 From: Kees Cook To: Petr Mladek Subject: Re: [PATCH v4 2/6] printk: honor the max_reason field in kmsg_dumper Message-ID: <202005221032.859452DFA0@keescook> References: <20200515184434.8470-1-keescook@chromium.org> <20200515184434.8470-3-keescook@chromium.org> <20200522165120.GL3464@linux-b0ei> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200522165120.GL3464@linux-b0ei> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Tony Luck , Pavel Tatashin , Jonathan Corbet , Anton Vorontsov , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Steven Rostedt , Sergey Senozhatsky , Rob Herring , Paul Mackerras , Colin Cross , Enric Balletbo i Serra , linuxppc-dev@lists.ozlabs.org, Benson Leung Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Fri, May 22, 2020 at 06:51:20PM +0200, Petr Mladek wrote: > On Fri 2020-05-15 11:44:30, Kees Cook wrote: > > From: Pavel Tatashin > > > > kmsg_dump() allows to dump kmesg buffer for various system events: oops, > > panic, reboot, etc. It provides an interface to register a callback call > > for clients, and in that callback interface there is a field "max_reason" > > which gets ignored unless always_kmsg_dump is passed as kernel parameter. > > Strictly speaking, this is not fully true. "max_reason" field is not > ignored when set to KMSG_DUMP_PANIC even when always_kmsg_dump was not set. > > It should be something like: > > "which gets ignored for reason higher than KMSG_DUMP_OOPS unless > always_kmsg_dump is passed as kernel parameter". > > Heh, I wonder if anyone will be able to parse this ;-) Ah yeah, good point. I've reworded things like this: kmsg_dump() allows to dump kmesg buffer for various system events: oops, panic, reboot, etc. It provides an interface to register a callback call for clients, and in that callback interface there is a field "max_reason", but it was getting ignored when set to any "reason" higher than KMSG_DUMP_OOPS unless "always_kmsg_dump" was passed as kernel parameter. Allow clients to actually control their "max_reason", and keep the current behavior when "max_reason" is not set. > Otherwise, it looks good to me. With the updated commit message: > > Reviewed-by: Petr Mladek Thanks! -- Kees Cook