From patchwork Sat Feb 10 23:49:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?=C5=81ukasz_Bartosik?= X-Patchwork-Id: 199349 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1703211dyd; Sat, 10 Feb 2024 16:01:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFoOJFiVE1WbPgDs7eoJdTVSZAnxhEp+0lbPC4pWtJDLDkL3dd5/Kt44WTfoAngwLtxvmvE X-Received: by 2002:a05:6402:33d2:b0:560:8fb7:a720 with SMTP id a18-20020a05640233d200b005608fb7a720mr2038308edc.24.1707609703039; Sat, 10 Feb 2024 16:01:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707609703; cv=pass; d=google.com; s=arc-20160816; b=RLwBVR8DdPE/Ke6W6jGOjBOVbB1DEN4E6DitOe1/ynfn4ECq+kumTvZLyLSzVP6Izq DmoGLv3XwgAHNOWKU5F9mXj2QcsNVQtweA1ZwIXNnG/Tp5+GeMO2O5vwJvNH878LZK3k IR+YzoIWyB4VOpS/Q6/LwWI3vZsM+uWx9ZuLQqFPvwFTOxeAqJVPTWaeG5bZwOHfd6Y/ 2J7CsCUkWvpuoLHC7C9kQXT0hfB0954D+LfDT+JIoQ5rB3DhAmC3X7WsznsiQS8LZwYF s2LzluJiMbucU+n3irO3X8AqCMTEZ4WioE1CESJDYhHyEth8uUQhGQ5nHTneJU7NYtuj Xf+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=87LdGKdo1o52qqAOMkU7XUi8d7iSZPf2NI4GoJJh05A=; fh=7DfwOjwhKk2sZSZFY3JwPsTjoaNKrifwJEzWliX7E6Y=; b=nXGsYrTpyjIMvFGziuF+MRw8JOVoDPWcZ+v6j8v7WK2BMqiu/8aL5aMIMCeGMhoJkK X7+V6Uf9bQg3JXNGJ2h+uZbW5Np6/XCv1sBEGyT3ZgMwz6BXiTW2zn+a4o1oMqhFTipr Q6L4e7NT6AjfuQf3dkVzI2qWtcrNA5Xa6IbYd/HWKRJBMw1SFeqNQ5C1HsQpdf8mRKpB oLlPFFwc58sDR1PvCECT+l2ovSSTit3pIOc3E6zbZYEM/WIlL8QMIb5pD6UEdOjJL3I/ pw2+rtcJcoGIQsVjB68Hic+ihSneUpWcc2xVNMRbL/L2xi45tjB1+B6qzH3BdTHoKhkJ N0hg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=InQ0Ny3W; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60602-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60602-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Forwarded-Encrypted: i=2; AJvYcCW8Eww3w2HAJQt9vcGyNijcW9mARQYMObrmK9EREN9+g0uxHL4NA8CZxXH5db+LEgwReBxVoKjYJQ8FalKTlZRyCh8VbQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id n8-20020aa7c448000000b00561351b6317si1293913edr.635.2024.02.10.16.01.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 16:01:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60602-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=InQ0Ny3W; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-60602-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60602-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 0D92B1F2523F for ; Sat, 10 Feb 2024 23:55:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 108DD626CD; Sat, 10 Feb 2024 23:51:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="InQ0Ny3W" Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9813B61690 for ; Sat, 10 Feb 2024 23:51:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707609064; cv=none; b=c6SsVd722LEuFaqN0OqREyI8VMPuceF+L4yTLiNkyiaRWaTMhVXhPg76QOemJVNVL2m2pP17cGm2Pp//qM6yMetPlZn6FwnbRC2mcWBJkCXB+Id3jFtzAh1FfegR55tStJBEFrxBtlA+qOarv39I4HWEI/mCNLdODh2e9DTYea8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707609064; c=relaxed/simple; bh=nXECD65rD0s/P1xvsdNfQSv3wCJRkijHf1Q3X+aDxVg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tJM/pvSsyhwBgcoK5Unx2HPkVBnJXdz/t4V3lpYBAdz2wBWkBL8YcVnSI/PAbDcDt8FpzvvtGmZMQbpSlLZ3pbuR4mRSPPjCbQJE/TQ8K2IUpaMvx2vMf5ejyqdSiILJZVEuztr4uyJUBxSeEz3TwsSFDikPbv8QJAPPrmXtJ64= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=InQ0Ny3W; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-5101cd91017so2348537e87.2 for ; Sat, 10 Feb 2024 15:51:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1707609061; x=1708213861; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=87LdGKdo1o52qqAOMkU7XUi8d7iSZPf2NI4GoJJh05A=; b=InQ0Ny3WiA2AX0cY9AJSXCQsAT8+oL9ynyFUM2gwDvCaGl+RLZpIyx4LPjKrwzjJMt VA1vCRmvrotwX+WgLPty8kb2XIdk91O5VC93PJDB0M0aSYRfEw/nBo5Yrh5e7hJ3ngbp a7nguu46RnboBWEoLeCi1aFAFOf10964XjlOo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707609061; x=1708213861; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=87LdGKdo1o52qqAOMkU7XUi8d7iSZPf2NI4GoJJh05A=; b=cIysG/J2S4uk3MhTS4TWXg3MMQO4ud0fcN919nuejquwSvlVtyGHbLkzpIqnAygwWB I0gcfCrs+Rqjd94o0TiDVGrcR/ICDWV80Fm/PIbVcYUI46yafCrtpsMkq1MJofGZmexc 7NYRVXhJhqEU696S0nBEw5FQWfqHFtd+qQhYk824x6X5ZzbYejW3UpTiSCmWSJJl443u oHxi359JnguYE3gilzdTvbjKDneqkYyLCBHSVdY6VW2F0XGaXEb7AQEGnoNzAqkdhehd yjxkp96PBYM4Uv9U5CAP9zuDyX/7tSmwR7PC2AyXC+ybOs5Ynp4yzeuh1RBjp0fzWcuv S4Bg== X-Gm-Message-State: AOJu0YygGFeboC395oMjwFBj3PcU3AtjWEacs84/k8Zb9yFtiFM/tT2F /Yw6iqge+ulrpD4iseUoJScDRg8WygbKbzm1nq2o+yFeEQ6tIkhN3vflWXnt X-Received: by 2002:ac2:43d5:0:b0:511:4eda:2563 with SMTP id u21-20020ac243d5000000b005114eda2563mr1744694lfl.69.1707609060849; Sat, 10 Feb 2024 15:51:00 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUYfeFXNc7BY13yOy/AaBbGoVRDaAbyI/u972bYmkBYD3ubr80foQ0xWNpFyqSy8H4iUDoKibWQ2Wb2pSv+sdq2XstMdzS1skZyxrwy+y6jYySz9/1MadhsyKafE0gPqKgcbVCkVEYUglZZ0yJ12yrJEWaGrV+vPL4+SA4hy7yQIciI1njiyhZrzp4uJ57qdaFdc92ckoivTd6t2r7xcWSNnNnps8D5GrRz0pZqPCk9hTZ3XWQJ1Umg9huBIsZYJeXMxxidlZAkUtEArXutsJZwB7AlIsdHiMtIKaflYXXP4MHOEV1xiDi86eOumYiGpjqzZRMD0MXP+/WJlBtm17IzR8PgYVNpkI1DabfLIoUeAmDMjWq6MM25EuAE/qvp5JEAP5hK90m4M7QVaaoPvV+zkaT2ZHM8CnTXSOUzPYl8D+l6fCcaoQAkgPPfKV9ngznFQQfSxBC8pYz/boHlenlHSbGk+Lds03vJ8S32oKdBfYy5kkwh4EclDUzVDV3Vg/P02+JJUYCMtna6OHznYulnu7mSoYVUqOHg4bL21dW5TSCQjsMBrpJD9CriGBwRD9susUUU9jSpedBWWpXY15vfnu9W5+F/01Hijx42Kx7E/TYxKA== Received: from ukaszb-l.roam.corp.google.com (alfa56.extreme-net.one.pl. [213.77.89.56]) by smtp.gmail.com with ESMTPSA id o27-20020a056512051b00b0051179ae1846sm365561lfb.280.2024.02.10.15.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 15:51:00 -0800 (PST) From: =?utf-8?q?=C5=81ukasz_Bartosik?= To: Jason Baron , Jim Cromie , Greg Kroah-Hartman , Andrew Morton , Kees Cook , Douglas Anderson Cc: Guenter Roeck , Yaniv Tzoreff , Benson Leung , Steven Rostedt , Vincent Whitchurch , Pekka Paalanen , Sean Paul , Daniel Vetter , Simon Ser , John Ogness , Petr Mladek , Sergey Senozhatsky , linux-kernel@vger.kernel.org, upstream@semihalf.com Subject: [PATCH v4 19/39] dyndbg: fix old BUG_ON in >control parser Date: Sun, 11 Feb 2024 00:49:49 +0100 Message-ID: <20240210235009.2405808-20-ukaszb@chromium.org> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog In-Reply-To: <20240210235009.2405808-1-ukaszb@chromium.org> References: <20240210235009.2405808-1-ukaszb@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790558551866027628 X-GMAIL-MSGID: 1790558551866027628 From: Jim Cromie Fix a BUG_ON from 2009. I have hit it while fuzzing >control on some other patches, and panic from user input is bad. Replace the BUG_ON with pr_error and return -EINVAL. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 17df4bf6863a..20bfb6de2404 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -682,7 +682,11 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords) } else { for (end = buf; *end && !isspace(*end); end++) ; - BUG_ON(end == buf); + if (end == buf) { + pr_err("parse err after word:%d=%s\n", nwords, + nwords ? words[nwords - 1] : ""); + return -EINVAL; + } } /* `buf' is start of word, `end' is one past its end */