From patchwork Thu May 25 21:00:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 99192 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp42243vqr; Thu, 25 May 2023 14:03:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7CDqjTAMqSnJtvWcxkjoCgCwu9z0uVdU5Xr4Zwst6VSPCSFWA9lL5x7QjZrAHIgBwdQedH X-Received: by 2002:aa7:888e:0:b0:63b:8eeb:77b8 with SMTP id z14-20020aa7888e000000b0063b8eeb77b8mr56221pfe.13.1685048615297; Thu, 25 May 2023 14:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685048615; cv=none; d=google.com; s=arc-20160816; b=rQ8KjjF16np87W0AiaI3Nk2Dojq7S6Lyq6jbb9VeUMmjamGwywS2ZsLT7g4Nwyi6V4 5ltfxqGi3cu4vqTZmNqn/ZM9HMy4ni7F9AWT8p0v0rWTmmTIjIA3w0QYtmw1s2a9NVal sypc9Tb04c7okIThCt4ZbwxnqR/HaDVAEXOE6Q14Szb2FdUvShNhzX1d1GT4I+1nMqnJ 78Dcvj/fuMhRHwPbHsF2b9UFnCJm9G/VCeqkrrLQ89FYueCgCEDV9fFE0IPn2EFwPrNZ AldHh/b4wimrRfBbkYcag84exuGU6TcQi2ODIzt1Bg24hcYk/bgOjo820SfrUr6sBf5O kFTw== 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=uUEkNGDX6cV0iQXAiFNgFjvKJpYklaG2ZlRS0uxR5ls=; b=jO0TJzDLo3VJ7AlpYOnRE3UUfEV+w2YgY8NZBzTGXs/8ADA7RlFdpn6uRxmHumVLrf DvZHXC5Hdy+8FtRaovIGARi4cFxUwRf0q9IgN4ANihmZbLs/Fe4jOTz4SsTEnha785QY 8ZdYsRN8Vf5/PO51PsXiHpaDcPc+Rf/roASwiVrV6ya5NcCR8QUirIiztO8+mVIK2RGR VY8I+Nt6H9+FK9tACdbhEOltijH4LNEa0e0cElerFPoOEKrWVmQGkuvkh1+PI/7g7qpM ClcIJphHRef4XUnWA9ypv9sOGQyuKNQ4cP0OukzNkHkwSiugcGV6KJUOD++2kni9jzUv pXGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=DW4DzSXO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z21-20020aa79f95000000b0063d23b80e00si2255287pfr.392.2023.05.25.14.03.22; Thu, 25 May 2023 14:03:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=DW4DzSXO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S241853AbjEYVBD (ORCPT + 99 others); Thu, 25 May 2023 17:01:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbjEYVA7 (ORCPT ); Thu, 25 May 2023 17:00:59 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 604D519C; Thu, 25 May 2023 14:00:58 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-530638a60e1so7775a12.2; Thu, 25 May 2023 14:00:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685048458; x=1687640458; 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=uUEkNGDX6cV0iQXAiFNgFjvKJpYklaG2ZlRS0uxR5ls=; b=DW4DzSXOAJLOeRF0iu9R3lD0WFtF3jtGW7qacMd4+bka2yvmy8GA9YJgnYThxgpsWe 0xzSvWUjLpozTCpKpRUpRRcolyUUtizjzM2WKTIlPv5CoJc3eaFzzxHZwlkKyqnVTLcI PCWByPN99ekQtdSEFPOea+7eFoNUYEiui8cNcj3ylIF1MYDAw8dz9PdvylaYvi4yHym6 D8AOvQNLzvdBosadCjBUWCjq1WW1ZHDdGhw+KHMxPz7AZIKh3JMCew1BlAabLkFpAtpA 4yEorxwCA+KB+Cm0x36QqoKmIeG3hU4okiesEWRw3EnPN8ZqxiszGkloDo3BDNgKijCi 1wqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685048458; x=1687640458; 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=uUEkNGDX6cV0iQXAiFNgFjvKJpYklaG2ZlRS0uxR5ls=; b=UzpZa0IQf1Qro4duA/DjNlaxBqsID7f+ZtQCga6peNKg3oQF2ziz3vsvs7p/o6VPzm 5ggUnf8b+9+lySotMZrME4DlyEC2tgGh2vwmtwC/iNOwGnDHDD8f2msGioP777aqewWo 2g5zm6KWDSgtBQ1GUqFhIhuI/UFNNBVJtXKpJzfNABgatLw14f6ClLgzojI3HpmoViB5 kXTtGBQuffYgn4K7h5aVfC8IaYEkQSCaOuzun4FMEqTAcdw1RqGsbdpOwHootl3g52Rm ahDN/3WXAa+RgJx6CUativRvz7hcYKHmDB7qlkPS8reX4b4+pj16k0JAYN1sDzIv5wzh EBWA== X-Gm-Message-State: AC+VfDw5+GaZKqfZsnmiHSr8A8M4J5tKdzK3Z1NjCGXX21R/HgdhhqCo EwyYE4et1Ekj2evqRu+F/DQ= X-Received: by 2002:a17:902:f7c6:b0:1ae:8892:7d27 with SMTP id h6-20020a170902f7c600b001ae88927d27mr2842006plw.42.1685048457437; Thu, 25 May 2023 14:00:57 -0700 (PDT) Received: from sc2-haas01-esx0118.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id j21-20020a170902c3d500b001ae8587d60csm1807673plj.265.2023.05.25.14.00.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 14:00:56 -0700 (PDT) From: Nadav Amit X-Google-Original-From: Nadav Amit To: Steven Rostedt , "Arnd Bergmann" , "Thomas Gleixner" Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-um@lists.infradead.org, Linux-Arch , linux-mm@kvack.org, "Andy Lutomirski" , "Ingo Molnar" , "Dave Hansen" , "Borislav Petkov" , x86@kernel.org, Peter Zijlstra , Nadav Amit , Marcin Nowakowski Subject: [PATCH v2 1/3] kprobes: Mark descendents of core_kernel_text as notrace Date: Thu, 25 May 2023 14:00:38 -0700 Message-Id: <20230525210040.3637-2-namit@vmware.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525210040.3637-1-namit@vmware.com> References: <20230525210040.3637-1-namit@vmware.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766901536543468751?= X-GMAIL-MSGID: =?utf-8?q?1766901536543468751?= From: Nadav Amit Commit c0d80ddab899 ("kernel/extable.c: mark core_kernel_text notrace") disabled the tracing of core_kernel_text to avoid recursive calls. For the same reasons, all the functions in the dynamic extents of core_kernel_text should be marked as notrace. Cc: Marcin Nowakowski Signed-off-by: Nadav Amit --- arch/arm/kernel/process.c | 2 +- arch/ia64/mm/init.c | 2 +- arch/x86/entry/vsyscall/vsyscall_64.c | 2 +- arch/x86/um/mem_32.c | 2 +- include/asm-generic/sections.h | 6 +++--- include/linux/kallsyms.h | 6 +++--- include/linux/mm.h | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 0e8ff85890ad..a8c0d0a06664 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -330,7 +330,7 @@ int in_gate_area(struct mm_struct *mm, unsigned long addr) return (addr >= gate_vma.vm_start) && (addr < gate_vma.vm_end); } -int in_gate_area_no_mm(unsigned long addr) +notrace int in_gate_area_no_mm(unsigned long addr) { return in_gate_area(NULL, addr); } diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c index 7f5353e28516..6dbd3acbe837 100644 --- a/arch/ia64/mm/init.c +++ b/arch/ia64/mm/init.c @@ -284,7 +284,7 @@ struct vm_area_struct *get_gate_vma(struct mm_struct *mm) return &gate_vma; } -int in_gate_area_no_mm(unsigned long addr) +notrace int in_gate_area_no_mm(unsigned long addr) { if ((addr >= FIXADDR_USER_START) && (addr < FIXADDR_USER_END)) return 1; diff --git a/arch/x86/entry/vsyscall/vsyscall_64.c b/arch/x86/entry/vsyscall/vsyscall_64.c index e0ca8120aea8..2d1d09877f0c 100644 --- a/arch/x86/entry/vsyscall/vsyscall_64.c +++ b/arch/x86/entry/vsyscall/vsyscall_64.c @@ -340,7 +340,7 @@ int in_gate_area(struct mm_struct *mm, unsigned long addr) * context. It is less reliable than using a task's mm and may give * false positives. */ -int in_gate_area_no_mm(unsigned long addr) +notrace int in_gate_area_no_mm(unsigned long addr) { return vsyscall_mode != NONE && (addr & PAGE_MASK) == VSYSCALL_ADDR; } diff --git a/arch/x86/um/mem_32.c b/arch/x86/um/mem_32.c index 29b2203bc82c..1f92840af2f3 100644 --- a/arch/x86/um/mem_32.c +++ b/arch/x86/um/mem_32.c @@ -28,7 +28,7 @@ struct vm_area_struct *get_gate_vma(struct mm_struct *mm) return FIXADDR_USER_START ? &gate_vma : NULL; } -int in_gate_area_no_mm(unsigned long addr) +notrace int in_gate_area_no_mm(unsigned long addr) { if (!FIXADDR_USER_START) return 0; diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index db13bb620f52..d519965b67bf 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -188,7 +188,7 @@ static inline bool is_kernel_rodata(unsigned long addr) * * Returns: true if the address is located in .init.text, false otherwise. */ -static inline bool is_kernel_inittext(unsigned long addr) +static notrace inline bool is_kernel_inittext(unsigned long addr) { return addr >= (unsigned long)_sinittext && addr < (unsigned long)_einittext; @@ -203,7 +203,7 @@ static inline bool is_kernel_inittext(unsigned long addr) * Returns: true if the address is located in .text, false otherwise. * Note: an internal helper, only check the range of _stext to _etext. */ -static inline bool __is_kernel_text(unsigned long addr) +static notrace inline bool __is_kernel_text(unsigned long addr) { return addr >= (unsigned long)_stext && addr < (unsigned long)_etext; @@ -219,7 +219,7 @@ static inline bool __is_kernel_text(unsigned long addr) * and range from __init_begin to __init_end, which can be outside * of the _stext to _end range. */ -static inline bool __is_kernel(unsigned long addr) +static notrace inline bool __is_kernel(unsigned long addr) { return ((addr >= (unsigned long)_stext && addr < (unsigned long)_end) || diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h index fe3c9993b5bf..e11743e68124 100644 --- a/include/linux/kallsyms.h +++ b/include/linux/kallsyms.h @@ -24,21 +24,21 @@ struct cred; struct module; -static inline int is_kernel_text(unsigned long addr) +static notrace inline int is_kernel_text(unsigned long addr) { if (__is_kernel_text(addr)) return 1; return in_gate_area_no_mm(addr); } -static inline int is_kernel(unsigned long addr) +static notrace inline int is_kernel(unsigned long addr) { if (__is_kernel(addr)) return 1; return in_gate_area_no_mm(addr); } -static inline int is_ksym_addr(unsigned long addr) +static notrace inline int is_ksym_addr(unsigned long addr) { if (IS_ENABLED(CONFIG_KALLSYMS_ALL)) return is_kernel(addr); diff --git a/include/linux/mm.h b/include/linux/mm.h index 27ce77080c79..e71ea764659c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3485,7 +3485,7 @@ static inline struct vm_area_struct *get_gate_vma(struct mm_struct *mm) { return NULL; } -static inline int in_gate_area_no_mm(unsigned long addr) { return 0; } +static notrace inline int in_gate_area_no_mm(unsigned long addr) { return 0; } static inline int in_gate_area(struct mm_struct *mm, unsigned long addr) { return 0; From patchwork Thu May 25 21:00:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 99200 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp48029vqr; Thu, 25 May 2023 14:14:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5beube7lGEfhawqUIeZoaY3+5nDRkErQdWgH+/mmv3QxTCeMMxxEd5XlxRYVKwOTC7TVId X-Received: by 2002:a05:6a21:338d:b0:10f:8798:9ff3 with SMTP id yy13-20020a056a21338d00b0010f87989ff3mr567457pzb.8.1685049244478; Thu, 25 May 2023 14:14:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685049244; cv=none; d=google.com; s=arc-20160816; b=CDuMTQ1Lpcvla7mmIZOX+u2p/paLOF+X2i9SduwiXUCLXzOD40+JycE0XM+2lryraU fAqVUsqph5s6GMcISBJuQG7SGKOBVndni46mvAiT1aSs/KaT3j+oR5BQ+fdbn8NumtPy Fzls0ysZLJbz87b7Rcg/tyg/ylpY9W2LM0PZrDWcdYt3zcfMIVN3ChQUgIitTRD+5y+3 7ItYRqpHFa8zcdgFyMsQ+x+6Vp2D4wh2AioF/ZsPtzKiIcdbOQDMvcCAFtIFfS3BPlUG ll8IwNfaYgUaGzCcawxqpFpcvsEwFPAd2XsYxDsvV/K0pCDMcGWwUzT7BXQhfkHCr5Pq +V7w== 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=plByf+i5Fok3NQ/XAuXTsKM1rTLN/fzcmyU+yIiV4ic=; b=PJrqi+tdUFC3/Gu1FPFfFmgklGDVXD3r9Pmw/9wAiQ3OHBs8kCUQ5bfaT2FjAl3t8P 98gW5+uo0eNVHOOyY5HT5ddLEczuDm+SsodZC3dn3pWTOcSjnt9Mvw5legQO+bi643T1 hUTiAgHloRiJ7RyKvxrsruoBmr3h+9QgQfOpv46Gk3ZlIpdcEkR0CI2QZ3cTGhuaSIwp z2TT14jngNhSoSteJgtNlBwHYohO08lCcpZJQ1Y8cX5XzTuVGCvL4oqBwYZD4RIlyEtX 5nOxj0dIUkLN22d/k63s/ASZRRS+9AfoVc3E7254OpzJx5AAYkSDlZbRBOB1J5OYbvUR rZzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ky1DBxa8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g9-20020a63fa49000000b00524eef20da6si1363440pgk.642.2023.05.25.14.13.48; Thu, 25 May 2023 14:14:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ky1DBxa8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S241879AbjEYVBH (ORCPT + 99 others); Thu, 25 May 2023 17:01:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232445AbjEYVBC (ORCPT ); Thu, 25 May 2023 17:01:02 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6D9F1B0; Thu, 25 May 2023 14:00:59 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-53f448cde66so224a12.1; Thu, 25 May 2023 14:00:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685048459; x=1687640459; 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=plByf+i5Fok3NQ/XAuXTsKM1rTLN/fzcmyU+yIiV4ic=; b=ky1DBxa8WM/81sXdcWNsMFPfMbMP9MSiSdnrHilDQ/bSg2mSQmbDjXxAj/wajJaFUp 2gHwA6b91A/ZdrHsNZAZV/2bMQXTNbmu9qNkC/KU0o1CB4hFllmUSgChAccRy4BFisHs hhRd6ZfPQ5bTE1jlxQYbLXLkgZLIfV6YYgsMjhvW2xuU5vMy2ZmzUrBc+/kZRMeVcMKg ff9XqIFg5W3W3DzqWq0SHrWXHHv2SgUDWGPxuba7+I5YkxQLmn1ay4zak4VMFOxDzlFF 5hQWwXHIqlw1J2bO7BYDEhq6PJu3rAiTxW0yUtTf9WOJj4FDfs0Aywdwxa4b9BY73ZPN esRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685048459; x=1687640459; 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=plByf+i5Fok3NQ/XAuXTsKM1rTLN/fzcmyU+yIiV4ic=; b=WMI2MKRo6aQegeV7QGyseWvYbH72NEEEvIjkHllQI1sOc2lsGzrZ5/esqKtD3mrS6j 2QSW0fkXrWhjwv1eEEPPIJpnfQsOKS2bU3xvk3jCKTuZpreA+6tm/fyTlJG6ia2vzuC3 PY99HicvJd+rtuSHo0c1GVUDgzJfhh3TEptrU7g1oPPAniO9TGosHiaZTlun6QrdGrM0 x6JNoVWlAisSgmjKNzz5xaPHzlIbILDocWinXkf5u7rfgRPwCws381FjUl9wKYKciB+3 1en1FpYZciPgbLLkREfHwVdvfSrcuNTDx2nXb2VcEHEagtk3trN9HifqOVP4hsgjoKO3 jW+g== X-Gm-Message-State: AC+VfDybzzIfzv80vN+i5u+YK9kgc9sGH6uIQZ1RahZ9w/Dn2Ifa8HJf aO8cVc6OE4757UfMR3X82Dc= X-Received: by 2002:a17:903:32c3:b0:1af:9b8a:9c79 with SMTP id i3-20020a17090332c300b001af9b8a9c79mr3676440plr.34.1685048459053; Thu, 25 May 2023 14:00:59 -0700 (PDT) Received: from sc2-haas01-esx0118.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id j21-20020a170902c3d500b001ae8587d60csm1807673plj.265.2023.05.25.14.00.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 14:00:58 -0700 (PDT) From: Nadav Amit X-Google-Original-From: Nadav Amit To: Steven Rostedt , "Arnd Bergmann" , "Thomas Gleixner" Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-um@lists.infradead.org, Linux-Arch , linux-mm@kvack.org, "Andy Lutomirski" , "Ingo Molnar" , "Dave Hansen" , "Borislav Petkov" , x86@kernel.org, Peter Zijlstra , Nadav Amit Subject: [PATCH v2 2/3] compiler: inline does not imply notrace Date: Thu, 25 May 2023 14:00:39 -0700 Message-Id: <20230525210040.3637-3-namit@vmware.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525210040.3637-1-namit@vmware.com> References: <20230525210040.3637-1-namit@vmware.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766902196674382686?= X-GMAIL-MSGID: =?utf-8?q?1766902196674382686?= From: Nadav Amit Functions that are marked as "inline" are currently also not tracable. This limits tracing functionality for many functions for no reason. Apparently, this has been done for two reasons. First, as described in commit 5963e317b1e9d2a ("ftrace/x86: Do not change stacks in DEBUG when calling lockdep"), it was intended to prevent some functions that cannot be traced from being traced as these functions were marked as inline (among others). Yet, this change has been done a decade ago, and according to Steven Rostedt, ftrace should have improved and hopefully resolved nested tracing issues by now. Arguably, if functions that should be traced - for instance since they are used during tracing - still exist, they should be marked as notrace explicitly. The second reason, which Steven raised, is that attaching "notrace" to "inline" prevented tracing differences between different configs, which caused various problem. This consideration is not very strong, and tying "inline" and "notrace" does not seem very beneficial. The "inline" keyword is just a hint, and many functions are currently not tracable due to this reason. Disconnect "inline" from "notrace". Signed-off-by: Nadav Amit --- include/linux/compiler_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 547ea1ff806e..bab3e25bbe3f 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -184,7 +184,7 @@ struct ftrace_likely_data { * of extern inline functions at link time. * A lot of inline functions can cause havoc with function tracing. */ -#define inline inline __gnu_inline __inline_maybe_unused notrace +#define inline inline __gnu_inline __inline_maybe_unused /* * gcc provides both __inline__ and __inline as alternate spellings of From patchwork Thu May 25 21:00:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 99199 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp46659vqr; Thu, 25 May 2023 14:11:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5QzloVqSLcXl+wFINnCO0ChwBWO3WQJ2400d/c05/DT+trUNJotZayuCmOy5jazrY/wNFX X-Received: by 2002:a17:90b:1c08:b0:255:b07a:3d55 with SMTP id oc8-20020a17090b1c0800b00255b07a3d55mr3415026pjb.28.1685049072481; Thu, 25 May 2023 14:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685049072; cv=none; d=google.com; s=arc-20160816; b=p7eW1mnf4EeosGxVLFdr4lJmzrIyS1IPAI9WW8G2UoZZoqgDV+XdK39x4oQqyyS+RQ LVXlFqJKnEKGvQ0j6mWubEbly0uQHq6tnCYP/dFfNDQSvuiyzz4Eb82Sun67HIqSXKuN 67yCy810Mm7NFn7wHTeK1Fkb499B/T7RBVuD1L+zl4Ngn4DRcDM6rH6ieg14+HZ6rBXZ W9kBGwNVSEbpRkLfVm+spc2Hn4hYpfLYuw2R//rBtaoAcPE5xUq1Zpc1g4GtJehahihO BHF7GIo+urEskagmANjkpBxxF6+rxGlkGkEXMVGHIex3MP1HlUFKnBkPghlWQ4ofU0CG kFKA== 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=5+zfwXmZs7on+rhgyTI9s9jH0CR5rkGZ9aJZCDn5M88=; b=jEvDaZicFGZIOsrB6URcsf2220SzveuF/yln3AkkdQznUQj/E/Qf5Ws3z9lt82Jt0B Uuzb7Vs7EVDPnmlndjygGMYKGhfnGoogRGMdvtDY6gDWpBenWrcvvAgfXcPeljMFHJ1I zg6uc2nysqMUtILNKG5s5Q6MKe9OhfxEDhrSzbZ8u89GbALlnzp1GBzYTBpfIPYQBLSC pOplA/LI5SKY+gxDU5ZGoTko6ewGa02dAdeUYbaYd0DKXEJzY1GGdCLM2wgM5nn3sFEv mDH9Nq1lYT8Ybp+K/cyYV9k2isQMoF7WTeuEBHP1fq+EK38Iw9Bvd8jEmFVm5C8xyPre 4AZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mU7K5hQE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v8-20020a17090a898800b00247992c3cf6si249219pjn.71.2023.05.25.14.11.00; Thu, 25 May 2023 14:11:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=mU7K5hQE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229734AbjEYVBR (ORCPT + 99 others); Thu, 25 May 2023 17:01:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232203AbjEYVBI (ORCPT ); Thu, 25 May 2023 17:01:08 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55B961B6; Thu, 25 May 2023 14:01:01 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-53f448cde66so263a12.1; Thu, 25 May 2023 14:01:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685048461; x=1687640461; 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=5+zfwXmZs7on+rhgyTI9s9jH0CR5rkGZ9aJZCDn5M88=; b=mU7K5hQEZ44NsT0+5VXofyw6qEDSPgD8wBkX7n613X0GzbWLqpmZC3VJfMwNx6m/tq nnfiSAnDqXg2POPsu6CCB/gzZ0hd00mUuaPE+wCpcwaSz8z7oc89KKDtJz7qu8LL0mFn S+jgvx9ju/DapGofobgM+AK3Axd4+Sc4U5KjNwRTJHheCODSmqZjtYzqbwgiWlD2FgMF srcMN9K8JH7pV8rjvzbVKic2ZONIx6t1veprRCepvX3TDcKPRo9Y07bOKmCyV0LvyjJw gbGeTnFOlGb6asM++1XIHud54i9VTyzPItSSun7x2eo35b2AKXgtMS5KXFv8bAflCIg7 ysIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685048461; x=1687640461; 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=5+zfwXmZs7on+rhgyTI9s9jH0CR5rkGZ9aJZCDn5M88=; b=Plew69F6gnqLSoJ/bbamJq5mgfBLeVEz9Rdy5MwzAohMxJ9piwR8FFzFcpyjGmW5Fp u9AtrakaxQq1r2CE/ghuzCMdlZWMsb6qsuKdZQcGyCjH6bEaQSCQjOcSi9SlZ0C3jQH4 GxUSQD/quw7iE39aL8w4RV+Wpro6NUsq4B378ECBxsahe6IsldWaZdHuVKkzfiyoE9k+ J8lLG2s09IzXJgHqHI5IJhvyRtIUdns80X2XsgH4LvbFICQ9/xPM5CjQtIS7JpwA7jfK P6yp6tDKGcme+UK+bmXQwwODiBhL9IcWhfUrOJ9s8cpKsmnqNAgRcqry3XxQhTSgg2mb 7HsQ== X-Gm-Message-State: AC+VfDxGyW/Ww9ig3e/9e5AF/wXqL8nUQW1SV6uuHeRoObIf1K+n/5GK KpsMqRxNS+jw/7zUVxADnK8= X-Received: by 2002:a17:902:e810:b0:1ac:5c90:23e with SMTP id u16-20020a170902e81000b001ac5c90023emr71805plg.7.1685048460660; Thu, 25 May 2023 14:01:00 -0700 (PDT) Received: from sc2-haas01-esx0118.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id j21-20020a170902c3d500b001ae8587d60csm1807673plj.265.2023.05.25.14.00.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 May 2023 14:01:00 -0700 (PDT) From: Nadav Amit X-Google-Original-From: Nadav Amit To: Steven Rostedt , "Arnd Bergmann" , "Thomas Gleixner" Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-um@lists.infradead.org, Linux-Arch , linux-mm@kvack.org, "Andy Lutomirski" , "Ingo Molnar" , "Dave Hansen" , "Borislav Petkov" , x86@kernel.org, Peter Zijlstra , Nadav Amit Subject: [PATCH v2 3/3] lib: Allow traceing of usercopy, xarray, iov_iter, find_bit Date: Thu, 25 May 2023 14:00:40 -0700 Message-Id: <20230525210040.3637-4-namit@vmware.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525210040.3637-1-namit@vmware.com> References: <20230525210040.3637-1-namit@vmware.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766902016063788552?= X-GMAIL-MSGID: =?utf-8?q?1766902016063788552?= From: Nadav Amit There is no reason not to allow the use of ftrace for usercopy, xarray and iov_iter. Enable tracing for these compilation unit. Signed-off-by: Nadav Amit --- lib/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Makefile b/lib/Makefile index 876fcdeae34e..00450e1cc97d 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -27,6 +27,9 @@ KASAN_SANITIZE_string.o := n CFLAGS_string.o += -fno-stack-protector endif +CFLAGS_xarray.o += $(CC_FLAGS_FTRACE) +CFLAGS_iov_iter.o += $(CC_FLAGS_FTRACE) + lib-y := ctype.o string.o vsprintf.o cmdline.o \ rbtree.o radix-tree.o timerqueue.o xarray.o \ maple_tree.o idr.o extable.o irq_regs.o argv_split.o \ @@ -42,6 +45,8 @@ lib-$(CONFIG_SMP) += cpumask.o lib-y += kobject.o klist.o obj-y += lockref.o +CFLAGS_usercopy.o += $(CC_FLAGS_FTRACE) +CFLAGS_find_bit.o += $(CC_FLAGS_FTRACE) obj-y += bcd.o sort.o parser.o debug_locks.o random32.o \ bust_spinlocks.o kasprintf.o bitmap.o scatterlist.o \ list_sort.o uuid.o iov_iter.o clz_ctz.o \