Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1421885pxj; Sat, 29 May 2021 13:04:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyED/DARs96mRjzV5FR9DJROQjbIKov26yVdoS3+pMKQlbHy7KymbuVyQW51eLA8wZ7Zh45 X-Received: by 2002:a05:6602:72f:: with SMTP id g15mr11586551iox.5.1622318699716; Sat, 29 May 2021 13:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622318699; cv=none; d=google.com; s=arc-20160816; b=IWwqNN90yQkoKumbAVF6fYhNDABUrNFnl3c2NnPvAOPkJvHrRriVYOt7mWTy8MHAJL D2Kr55iORBJ+3BPxoymh8oMREvXHCo2jm6SP5xUhpoL5vkEdA1ss0lWC1OyIQrq62uq3 48iDzEHtmsihDSjELZDVHg+PsU0xZY4QFVvtL9ziQoX9moNjBv3L99lbFrkFhlAi/57j hTUbb17szTKQUNBuG+rP8Ebucjvrp316lUqd7E2sCHOtF0frt9E2m1w2f613LcRo/ZvQ s9TlCj5a5iDE0exzW6oMT98qoualX2qx6fXIJL8Z5T2MM8U/L7wpEF64pfzYv174boeY By2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Yqwu612kTu5Af3QIKB6umBBpyq371/vnuyT/AM/LZqI=; b=WT+VnOoKQbr/yrOsqqNMkuYz7Pl+SfUlavTuRtdoly43W4q093pe3O7DkVVBeGeT4K 3dWSAb7iu4qZlB6OLnEDOyX9taHqvg5weeGOoc9QdLMxm6rDsDn8JQjWiNi8nGfHavwJ 5an6lF7FPvb61r7eemK0E+D8sBDQEEe/slOBoz/5D2bK2rIBJIj3iV6rB+K1LVc+6vgn m8S5KdH5a+XUZ7izzv0usmEzVSDN9Pb815lNgI2hi9ZJKpr6zAWQ38+kspBA8nZ7aAyg Occ6gf7VGn72zzJ7/21+CAPGknl1AVG+IoaP29eN1OGuUm/AztX29Gw+6R+7Zz9cCRXZ Mzeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MGUEbQrq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si9747398jak.57.2021.05.29.13.04.39; Sat, 29 May 2021 13:04:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MGUEbQrq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230327AbhE2UFQ (ORCPT + 99 others); Sat, 29 May 2021 16:05:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230035AbhE2UET (ORCPT ); Sat, 29 May 2021 16:04:19 -0400 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EED92C0613ED for ; Sat, 29 May 2021 13:02:41 -0700 (PDT) Received: by mail-ot1-x329.google.com with SMTP id 69-20020a9d0a4b0000b02902ed42f141e1so7005543otg.2 for ; Sat, 29 May 2021 13:02:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Yqwu612kTu5Af3QIKB6umBBpyq371/vnuyT/AM/LZqI=; b=MGUEbQrqu6ahrGE+/bWJcjcLTGhKPWYZP/wuLvkOM3pUMG6MGsCqwwoOIJ34Dnj/7h G7I5jQnT/CQ8KkOqwZVEAwmBG2G2G2xXvAVKmWJ2+V7rroVrE8nkUABvmaFYpl5NxGTU MHWNl4SZtwXcPgtV2LbfzEuJ3fhUQ91ZrbtL58EBpFszI7aHbNWZPQkrZj5X0HlZcfU2 iWM87NmxpNCMYrUVe4omt2ioL9QNaL/tJH+H2iDURHaQLvtgCzB9bVjeXJrkH3h6SfR5 VjuEGOvvpNwF5TS30Z48NZBE9CyRNv7VFZ+m7NMhyOd3mA+Yf89+M6EcAYhFOWyEzX2E T/yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Yqwu612kTu5Af3QIKB6umBBpyq371/vnuyT/AM/LZqI=; b=XIYNDP/WOKs/GTrAVU9C4nLimpgIkd+oCHBRxkI3dgv1nqCKNnlpFJy628jXRup2C+ OvwaRZUnKD42bxr7T9p0kMq/mOe9HzPXLU+d4Z609RF3SNKCBH44tdl9bn/JvZJjXT+K XweWRA86ocV4SFTEAJzdqUCpAKlAbRfPTHbvqmM55NCYg4l155c8LxA0L7X68QUGRXOp Co3DxCzfYCA9YttnbKOqR3uPSuWomR/rUqVa8eudPgeh6PpLv5hoRT+bP7llUMma+787 6H0OM9y/OFGWFQqrbuMUAuS4+oB7Ie9oXFcu7OqzxvjIFDOnummk7Ld9MP4mqJ2uKVad XyFg== X-Gm-Message-State: AOAM530aPz1aGISUHBnXjlRHCcwJEaM9KjZf1TaLTJYKFsW2E3VH82w8 D9P/sSH3SSXy4Rr/vpSO9o4= X-Received: by 2002:a9d:12ee:: with SMTP id g101mr11977217otg.84.1622318561336; Sat, 29 May 2021 13:02:41 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id t39sm1868064ooi.42.2021.05.29.13.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 May 2021 13:02:40 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: Jim Cromie Subject: [RFC PATCH v6 27/34] dyndbg: fixup protect header when deleting site Date: Sat, 29 May 2021 14:00:22 -0600 Message-Id: <20210529200029.205306-28-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210529200029.205306-1-jim.cromie@gmail.com> References: <20210529200029.205306-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org fix a null-ptr-deref when .site info is deleted. $> echo +D > /proc/dynamic_debug/control This protects the header.site pointer from zeroing; we need it for all the SITE_CHK sanity checking. Probably should protect against toggling the static_key too (in the same function), but this smaller change fixes the crash. Signed-off-by: Jim Cromie --- lib/dynamic_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 659e864837ad..f2f6f2b20d01 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -247,7 +247,7 @@ static void ddebug_alter_site(struct _ddebug *dp, #ifdef SITE_CHK /* delete site info for this callsite */ if (modifiers->flags & _DPRINTK_FLAGS_DELETE_SITE) { - if (dp->site) { + if (dp->site && !is_dyndbg_header_pair(dp, dp->site)) { vpr_info("dropping site info %s.%s.%d\n", dp->site->filename, dp->site->function, dp->lineno); dp->site = NULL; -- 2.31.1