From patchwork Thu Nov 17 23:43:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13047479 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24655C4332F for ; Thu, 17 Nov 2022 23:43:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BCFA58E0001; Thu, 17 Nov 2022 18:43:31 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B519F6B0072; Thu, 17 Nov 2022 18:43:31 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 97FE68E0001; Thu, 17 Nov 2022 18:43:31 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 85D8B6B0071 for ; Thu, 17 Nov 2022 18:43:31 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5E24B1C6479 for ; Thu, 17 Nov 2022 23:43:31 +0000 (UTC) X-FDA: 80144563422.30.50C1399 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by imf15.hostedemail.com (Postfix) with ESMTP id 16E34A000C for ; Thu, 17 Nov 2022 23:43:30 +0000 (UTC) Received: by mail-pg1-f176.google.com with SMTP id r18so3485729pgr.12 for ; Thu, 17 Nov 2022 15:43:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LQKoNHkwXKQHXK1Rm3137rvxsN3jeB7ychTw9wiMCoA=; b=gzgQ67tGphKg9LC8dXQMsOdp6988Jh6y4uQ4wq39wUd2vtbr/8gxP0dLkj/cYJSQfU oJVP225UVvh8eZGzkuRft1/5qPdhlpTQCB04Dhk8Pza+YxTN6AkGI7wxVQ888beABqKJ 7xM3YRAsM7rHhiSI+nNyQa/rVKea7ZVGyyzy8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LQKoNHkwXKQHXK1Rm3137rvxsN3jeB7ychTw9wiMCoA=; b=74Y/0tiW9k+7xCutVcuYsaJ7hmDiIL1TDLXiGhmlNQXhoOcgaPtk1Ias2xBCFLjAx/ 66xfzdGU4/WFb6s7UzUOMp9ipeotWBfm04q88PccTy5FJnLgtcGulN566QJaPbQw9djJ OI1u2Yb2g1nIn2cc8B4gIvdVVbyUg9bIJWs+tF2vU8AVF/WAmI9fNbFeWEQWh89t3YHR Yyg2KZwheYbpJIaGnDuldYUm1/GrZc3oLtTqAcb2Ke8rBhI2xXuVBO3TrtufzZhbW6qP dVfZiAFma8cNaCzb3XC+X7ENgJr1KYvqkXk6aU3H6jyzXaUK0C2eICeVQyJaMYpSQ2PQ a4Og== X-Gm-Message-State: ANoB5pmOmgjUvTNXfKpkvlkocHH6NZnN+QOkHbpfX3ZupgfzCW2R1HtT PZyUG8h16snJlGrKXOJZuTeyoQ== X-Google-Smtp-Source: AA0mqf4dMrpHROtIgMnip0OIwSGPEYdtdDWFsBd6CpaiKHR5PBA7FaDdD8tvh8Nw0f5yBbrJCuHeXA== X-Received: by 2002:a63:3d8:0:b0:476:eee6:d394 with SMTP id 207-20020a6303d8000000b00476eee6d394mr4235676pgd.228.1668728610079; Thu, 17 Nov 2022 15:43:30 -0800 (PST) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id o9-20020a655bc9000000b004582e25a595sm1614221pgr.41.2022.11.17.15.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 15:43:29 -0800 (PST) From: Kees Cook To: Jann Horn Cc: Kees Cook , Seth Jenkins , Greg KH , Linus Torvalds , Andy Lutomirski , Andrew Morton , tangmeng , "Guilherme G. Piccoli" , Tiezhu Yang , Sebastian Andrzej Siewior , "Eric W. Biederman" , Arnd Bergmann , Dmitry Vyukov , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira , Valentin Schneider , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Vincenzo Frascino , Luis Chamberlain , David Gow , "Paul E. McKenney" , Jonathan Corbet , Baolin Wang , "Jason A. Donenfeld" , Eric Biggers , Huang Ying , Anton Vorontsov , Mauro Carvalho Chehab , Laurent Dufour , Rob Herring , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-hardening@vger.kernel.org Subject: [PATCH v3 0/6] exit: Put an upper limit on how often we can oops Date: Thu, 17 Nov 2022 15:43:20 -0800 Message-Id: <20221117233838.give.484-kees@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1558; h=from:subject:message-id; bh=Mevv31fJaznFTh44cD9Wkn2q46wN2KwgT2JblND2tEw=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBjdsccuB5/7Dud9dthXxlatod2tm4x+MLt8lSkzhG8 v6L92dWJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCY3bHHAAKCRCJcvTf3G3AJuVdD/ 0eNAawmC+gMqkT2rEKRxW1q1K4WlSNG660mYF+W/EAMANgbt6w31eLw4F1zcWZUz+34y5smj0BBaCU y5rzvHB47A7fuA9hXjcwb8TuxsSnjq3pkDquhBH7Y3KFkj90GGVkL/Mh9gVP+uOLjCYvc48iwOt2eG YHZ/y3jAgGhcr2jxeAYCwOwalTeHyyCeurbdvX7Oq+a45aPDWcVfffZbFVfHn8DxxTVcNQ7N/628uE z2kYsHca4qJwFAzPpArSYyVloSVtbEW5ckjt+Iq6kLO3u+oTgu+PvJpLJ9F8bnjbFIklvAwkomHvfV fixggchvSkevDB43e+wQvPrcKfiNN71mlbGfuMLs2VVFuzNQUGAZXRhHR3lwG9UIaNDuCzzxa1UWr9 3ktCososbPal1YX12fJhSFl8vzBMk7JLQEbTTHcYUAbjWHdpNJodiID252O9pAdmG1E9muAIZGy4qC tcH0IouHdUSPs2DP9Y16vdrEMok25wZU7rIjZ0VxdtGIMrgiqMZmxweeRnhXSgy/HFG+1IXtXgb9Ir Ro+U3RGzEYBu6Wklay2Dr6Gca6606I6a51/zw0fPXanLvL+dGU0ZHeXbx7SaSYZ0n2zPaL+1ET1p19 gLeTIC7R+E3l0BJ0ilq4VBoffYDaepF8i1hdfUaDnHhkEMaoDGmjbuFOnslg== X-Developer-Key: i=keescook@chromium.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668728611; a=rsa-sha256; cv=none; b=PRdr0V3O3WlXG1UnnUr6Yl1sissYRyN0qhbpiL2A5kjmBmY3DwrCPZlwtMqaDTRMHK7adB VwvjRQngD+A/gCjxmfvxZRybw7smm1/88gTUYp3W7/TUGbVofVWGRNURHgrdtGeKKpMfin 0+EhhNaF0+IV7euBzlVi8SJ2qRaR5W4= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=gzgQ67tG; spf=pass (imf15.hostedemail.com: domain of keescook@chromium.org designates 209.85.215.176 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668728611; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=LQKoNHkwXKQHXK1Rm3137rvxsN3jeB7ychTw9wiMCoA=; b=U/c5yoJe+Ll8MuTm7XesEDeGmW03XIC6+DEWwHWS2BDuQQqKM1QsaO/XiDgO2x07rwiEOL A795r7oddyJw3rPIYqHn2lS8K84DFec/bVyORC+rzHAgHAUDGGWCxg4ibrxW7PEBZDykvz LFTxyMDILYp6S1WarRJkC3vBwPd72i0= X-Stat-Signature: xcfip3hu71y6bczqbmzk7qmw3ak3b48s X-Rspamd-Queue-Id: 16E34A000C Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=gzgQ67tG; spf=pass (imf15.hostedemail.com: domain of keescook@chromium.org designates 209.85.215.176 as permitted sender) smtp.mailfrom=keescook@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1668728610-779209 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi, This builds on Jann's v1 patch[1]. Changes in v3: - fix #if/#ifdef confusion (Bill) - rename from "reason" or "origin" and add it to the warn output (Marco) v2: https://lore.kernel.org/lkml/20221109194404.gonna.558-kees@kernel.org/ Thanks, -Kees [1] https://lore.kernel.org/lkml/20221107201317.324457-1-jannh@google.com Jann Horn (1): exit: Put an upper limit on how often we can oops Kees Cook (5): panic: Separate sysctl logic from CONFIG_SMP exit: Expose "oops_count" to sysfs panic: Consolidate open-coded panic_on_warn checks panic: Introduce warn_limit panic: Expose "warn_count" to sysfs .../ABI/testing/sysfs-kernel-oops_count | 6 ++ .../ABI/testing/sysfs-kernel-warn_count | 6 ++ Documentation/admin-guide/sysctl/kernel.rst | 17 ++++++ MAINTAINERS | 2 + include/linux/panic.h | 1 + kernel/exit.c | 60 +++++++++++++++++++ kernel/kcsan/report.c | 3 +- kernel/panic.c | 45 +++++++++++++- kernel/sched/core.c | 3 +- lib/ubsan.c | 3 +- mm/kasan/report.c | 4 +- mm/kfence/report.c | 3 +- 12 files changed, 140 insertions(+), 13 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-kernel-oops_count create mode 100644 Documentation/ABI/testing/sysfs-kernel-warn_count