From patchwork Mon Jan 13 03:07:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhuxiaohui X-Patchwork-Id: 13936673 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 3FC0FE77188 for ; Mon, 13 Jan 2025 03:07:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E8136B0085; Sun, 12 Jan 2025 22:07:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 898816B0088; Sun, 12 Jan 2025 22:07:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 760376B0089; Sun, 12 Jan 2025 22:07:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 56A816B0085 for ; Sun, 12 Jan 2025 22:07:15 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0343FC1A1A for ; Mon, 13 Jan 2025 03:07:14 +0000 (UTC) X-FDA: 83000942430.30.7B18337 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf28.hostedemail.com (Postfix) with ESMTP id 269CAC000E for ; Mon, 13 Jan 2025 03:07:12 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BzdkYpiY; spf=pass (imf28.hostedemail.com: domain of zhuxiaohui400@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=zhuxiaohui400@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736737633; 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=rPXC9M6H1WCUFlmMOfkbZqE3JGlgWI1hOtqPKw92q2o=; b=lhc2Msz7OlRKVr146cDpzbUqFjT05CtVPPxh7umbUETbYcIhyqKFQj7Z3USnykdh8qbSsj kWmDXUWetZ56FSMz86q+s+BU5L1ixeGLsPmZTsTDE93xLSNSoIK06cuxFOGp5e3eUL679e /rvHD/tKTheKpfIuunCTuUCzuMAggCg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736737633; a=rsa-sha256; cv=none; b=DazqWullihxEeyBYMvvWQxzZMpdxmD69sNj3+gBy8T9lMvkWuc6GP9ilmYFiDitDYdPenR NmseCzMPXxLbEN/qk8HQaoTb8yE4nmeuig8MTFd5+b9v6b1ijnxSsUEJF2Q8bKsTR64wVy fokmDEoHc7KriEWrl4663c9YdyRqeGw= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BzdkYpiY; spf=pass (imf28.hostedemail.com: domain of zhuxiaohui400@gmail.com designates 209.85.214.178 as permitted sender) smtp.mailfrom=zhuxiaohui400@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-21644b473ddso7316735ad.0 for ; Sun, 12 Jan 2025 19:07:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736737632; x=1737342432; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=rPXC9M6H1WCUFlmMOfkbZqE3JGlgWI1hOtqPKw92q2o=; b=BzdkYpiYqbzpL0SdMUmcCBttnAl6BTKj9C9VJCfjmeXRc1lo9RB8zZKV7AUNN6Syhg NgWPoLX/ZxJy9kUysdCWtSrkRZ+bIm+xQvoaSjXsbbYGZeRs1Pmrgg8NkBexZcpcIfJN wKxGBFwaNOffg2q0+uO5RpiW9snTwxb4aKV7LJ5z2Fv5k24zew/anM8wqO0W71UhLseH ce/qcmdx3zAHAnPHWIa1WQkL3z7T3cts8UmnXKwKxORmgjmphLB+9W2wHN9luNABfsUR 5agLH8s/7akixmjjDAuyTkUPgxrcorxTP/k186LGtWd6GGxSj3AwtdJiD844hTo4K2y2 ViYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736737632; x=1737342432; 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=rPXC9M6H1WCUFlmMOfkbZqE3JGlgWI1hOtqPKw92q2o=; b=GrU3hns0K5Fqrqn7X3rbnknD4eJY4Ip0aD42HYPOjFac9pYk1C210dcuoGZGo4yXYC VfhWTh2ZeXkG+y9Xk3nIZX9X/SmPfEwSb5VSFb+z0xWCCsu7J+DwvwakoqhhpxzWxP0J uLdZRjkyRgGKuv+Yklz9FzDL+nuOuUo4xyimMwWwvx0vRT9HVCqps/4ADmqhiGWUuCtJ 7DfF5RtPrnGQI47n5eB70VpsLzgWlspNYraEg8zJibEZuwQkE8vJMpv+CCNsA2vxRroW HwGVanhFJ6NCc0lDHiDijdbilwoYeFtND2eVSxxrZikvvT4LOlF0Zydg/LS5cBeaIeOm 9ItA== X-Forwarded-Encrypted: i=1; AJvYcCXWM2ptFEpyPjxSW9L/07gADrdzhaRkSybI99sR4Ci1RY9NcoUJY2Th4oezm/zVm30bvU+k99N1hg==@kvack.org X-Gm-Message-State: AOJu0YwySRAeHQ/QCyLktZYmwINUjPw6clRNyIXtSFLYsA7wBNFSGFhy fn7RB9dN+ZRHE/YQNtU5XeGSKBuaeyrD+nkxzEclh7VbGRpr6Crg X-Gm-Gg: ASbGncuOrYpmWdBoGxtDaGS6hz6zHy2wkvfHuxVTTqUB3YUuoJrmxH768YwSwN7dgXN ypAO+kVZscV9ng0oJ/8N/zu6TcTHJDHJOtALxaxsnLF+2V9+WM/tWnWVzBSHPXUDXjYzDnGCDll /jy0rFvb4/MMJ26Qefr6PMe3vNS6pasOuh951vEkOfFdRSrnzmoV1F5/m1XfeTNWAKWe0AwVa2+ eZup8ZaOsA/q3ejBcJ5neKTRSFPW883M7Mh1GpjqKi1qWY5kVrbl43mKx8fxuHgum+D7kHfE9H8 eNOLtTjhLMBBCjX1bRDjm5KvfKD2flu1wnVCt5M= X-Google-Smtp-Source: AGHT+IG5b6OhLzdHbJdJXEwxQ6DouYarrAWGsXZCvbCGviVG00oWuF3S2JAES2dB4BG/Cj7GxeW8og== X-Received: by 2002:a17:902:c951:b0:215:a3e3:c857 with SMTP id d9443c01a7336-21a83f32d5emr110983345ad.3.1736737631637; Sun, 12 Jan 2025 19:07:11 -0800 (PST) Received: from localhost.localdomain ([61.213.176.57]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-21bb2a5b2afsm16304635ad.28.2025.01.12.19.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Jan 2025 19:07:11 -0800 (PST) From: zhuxiaohui X-Google-Original-From: zhuxiaohui To: muchun.song@linux.dev, rostedt@goodmis.org, mhiramat@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Cc: lihongbo22@huawei.com, Xiaohui Zhu Subject: [PATCH] hugetlbfs: check dir in trace_hugetlbfs_alloc_inode Date: Mon, 13 Jan 2025 11:07:02 +0800 Message-ID: <20250113030702.58502-1-zhuxiaohui.400@bytedance.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Rspamd-Queue-Id: 269CAC000E X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: 53fy6oucbpqdy4cu3x7rcxy1dgiirfda X-HE-Tag: 1736737632-404479 X-HE-Meta: U2Fs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f068+u3Ek2Lh5m59kPw2+sG3tZcWYZz6E/1HII/zm/Rc85Rg6tvPvkNbBVbp38084NlYSGEHrZWSYkbjtVCb0IwaeH2yHQZYshr0a65GdImvoBOO7e/HwinhL4s3tJykaUjtiIlmvZFVy+4nq7sghOaKrJInM8ZdstGTuQcqiCsNP4xuqL4BRAQ6FHabQNtcHkLogb+pGJo06uZi3jSbGd2OK+7fWoS/YfQK1bsgft2EX+zSo+8fqGysGAX/MzpLGPhCoJ/B01JSHyAfl7jRDLPZGRaPNSQ756mbT/AgpeQcDbHc1B7V/dZDS0oLkxi+RemFNp0JdNNq1zVz7mBUAnLOx6GA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.060281, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Xiaohui Zhu Anonymous huge page has no corresponding directory inode, which cause a null pointer crash when access dir with the stack trace_hugetlbfs_alloc_inode hugetlbfs_get_inode hugetlb_file_setup ksys_mmap_pgoff Signed-off-by: Xiaohui Zhu --- include/trace/events/hugetlbfs.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/trace/events/hugetlbfs.h b/include/trace/events/hugetlbfs.h index 8331c904a9ba..5daa52053edc 100644 --- a/include/trace/events/hugetlbfs.h +++ b/include/trace/events/hugetlbfs.h @@ -23,7 +23,9 @@ TRACE_EVENT(hugetlbfs_alloc_inode, TP_fast_assign( __entry->dev = inode->i_sb->s_dev; __entry->ino = inode->i_ino; - __entry->dir = dir->i_ino; + __entry->dir = 0; + if (dir) + __entry->dir = dir->i_ino; __entry->mode = mode; ),