From patchwork Tue Nov 22 19:53:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 24532 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2410502wrr; Tue, 22 Nov 2022 11:56:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Cw+nXe9acGaS0MebjfaE6j5TXgJabAW5TkQlDSmyCfVRxEamHsXKrGnxTt5wWm040qtSo X-Received: by 2002:a17:903:3254:b0:189:2184:62f6 with SMTP id ji20-20020a170903325400b00189218462f6mr5775375plb.24.1669146979106; Tue, 22 Nov 2022 11:56:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669146979; cv=none; d=google.com; s=arc-20160816; b=fiqtAVvKh1N8muv3aBsZr+wKZo/gcbV4dfV9i+Qo3oM4rfoy2rwD0AcHpzdviabKJw DoGlg9WfhLg8YSHXUNHaPf6W/yzbD5Doixqyr/BMtSbplQ/wnMHOfNU0ZLx2AmUd4nBc iIq0qApogJQ0p/0344qsXmp90SOK4B2vRZYnFcCs9KsB9xU7YozwNYBc8XrXj0rVWw1S abUqj78uQCr7k3mdjUzHr0/QN9nAd8kYZBqrxbXTj1pcVHK8kIeg/F7/ug3JCcYaMLaK UjvCi/4lZlCFBaWB5oCMWkXawHy19CO38R7MPhRH3XffntkO3QYKLCQDjyx3BxsPNSkz ELZg== 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=nn7aMM2ad863pOwZNew/EvwCgnDwcAXHi2MWDQYfDjI=; b=UThfeevINSPAeXAORWp1pizHyHsPSXMQBPj9ULH99gqSyXdAWaySk/tHOdN+Zw5+12 TFZ7z9q++kraQ3W4FO7bQ/gkxIw+X9Kdd1ndvdbc9yOxKXcWdk4rinECfgSruRxF+pXa 9Y20dNQSwFC7dPzQKTGCOn1ZxdhoYuxrWwo7sfujZ0PTW3lB6H6nkcD3vYMVQcyGOHyS 1Y5V/EjklTq1HuqiJ2Wue1/YzW+UMMpK1frSeI+OTh1fsvs12eZ0hbylwBKcY7Im09n4 mAqqZEJEsuO8vCpBVVANFRwoESXCkFzfUJW7ffkVXlYqpvPoHIvipPlT/eg4ZLHZGgcC /dyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RWz8sQLT; 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 v186-20020a6389c3000000b0047767ddcdcesi7185082pgd.566.2022.11.22.11.56.06; Tue, 22 Nov 2022 11:56:19 -0800 (PST) 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=20210112 header.b=RWz8sQLT; 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 S234468AbiKVTyx (ORCPT + 99 others); Tue, 22 Nov 2022 14:54:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234733AbiKVTyW (ORCPT ); Tue, 22 Nov 2022 14:54:22 -0500 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 50BFD87569; Tue, 22 Nov 2022 11:54:19 -0800 (PST) Received: by mail-pg1-x532.google.com with SMTP id s196so14970078pgs.3; Tue, 22 Nov 2022 11:54:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=nn7aMM2ad863pOwZNew/EvwCgnDwcAXHi2MWDQYfDjI=; b=RWz8sQLTQNvwgI2df8iLxqTr+sEw2wL39ea4kS0x0CprI1Kazflsy25JZbcrvSVApe /J8BU2BdqPBAPvrZwiFyTsF2oCcIaJupZWYCUmQpgc6w7Mci0k796A2l5q76RE9EdXTA Y5Jj086CqiUiB+OQPu8JUCbvrxhw976thH2TDil0rbo40+rwg9yMA9TmoS6O7Ol5eP0M d/kKVs7mx9Y2/nqKZ4BSB8geM9Ng39PiXZ7FjJWo1AqWLj4/Qm9gyHpiz7oo9Yj1tmpT wKNk/r5X7uwX8DtW9DnIcUHEJ5XGFAzB8j7SPddwv5jfphWDzG5VNfg85Tbz35un/sdx gXMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=nn7aMM2ad863pOwZNew/EvwCgnDwcAXHi2MWDQYfDjI=; b=rBCVGZH+vZjRvVNdIIcBL63B0GxsmHq2dQjK5fuK9c3WxmEZZnyqnwOoCr9x4seHtW uOtWENm/d63znGDAispuUNKP30KWQDX2d2VDJMH54KPido6TLKPcJI6zi/B0ts0hsTmu KXZ3FrNE/qsMBvE4gE17hGD3oTpJjAOzzQYYyYUNv44Ktl4Ke3FqZm66XoSrCzY8Kcz0 Blvchhi8HRN22FUngzqLlcIAvi+Yw6S+no1pUOE0WGIi1Q0cXnany6tEVqQDHLyexRe2 NB2hHVaFsqmyE6kYKO+zC+z1DImUWe+9yypRPPOo/s0tF8hGkboFVctxtvG1dekQLbo/ qr1w== X-Gm-Message-State: ANoB5pnoLSzrpBEU6mH7kHnmp3Mq5XNqOC0VsfXpmiIOY3gHzv4A3c+d esihhYK+gYfpPg9mY4Zv1qQ= X-Received: by 2002:a63:cd09:0:b0:476:d44d:355 with SMTP id i9-20020a63cd09000000b00476d44d0355mr5437893pgg.289.1669146858593; Tue, 22 Nov 2022 11:54:18 -0800 (PST) Received: from sc2-haas01-esx0118.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id a8-20020a63d408000000b00460fbe0d75esm9699252pgh.31.2022.11.22.11.54.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 11:54:18 -0800 (PST) From: Nadav Amit X-Google-Original-From: Nadav Amit To: 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@vger.kernel.org, linux-mm@kvack.org, Andy Lutomirski , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Richard Weinberger , Anton Ivanov , Johannes Berg , Arnd Bergmann , Andrew Morton , Nadav Amit , Marcin Nowakowski Subject: [PATCH 1/3] kprobes: Mark descendents of core_kernel_text as notrace Date: Tue, 22 Nov 2022 11:53:27 -0800 Message-Id: <20221122195329.252654-2-namit@vmware.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221122195329.252654-1-namit@vmware.com> References: <20221122195329.252654-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 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?1750227462468010613?= X-GMAIL-MSGID: =?utf-8?q?1750227462468010613?= 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 a2b31d91a1b6..a32ca8fcab5a 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -331,7 +331,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 fc4e4217e87f..e3d63d3d3e59 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 4af81df133ee..68ebad6abd2b 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 cafd01f730da..cfec8b00b136 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 649faac31ddb..7ee6a734b738 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 bfac5a166cb8..36a938c10ede 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3186,7 +3186,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 Tue Nov 22 19:53:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 24533 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2410525wrr; Tue, 22 Nov 2022 11:56:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf4NSYwrtioaS8SI7crO8MSBcm3/kalF6cSaZuGePZWxbmkKG7+MaXjxhKoF/dNhwvSI7Tqs X-Received: by 2002:a17:902:b691:b0:17e:fb19:63ba with SMTP id c17-20020a170902b69100b0017efb1963bamr8062056pls.160.1669146982256; Tue, 22 Nov 2022 11:56:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669146982; cv=none; d=google.com; s=arc-20160816; b=eG+L8ngCgZReZCYsnY46cVyXxdwB/pJBvjCndebPVRhbFP+M+oD+GIt0mFksRj1zAI j0g+OLw2fFmKaSMpU3aPDuV7MPuFZk8sgY8mrQFOTRcSiV93rvnLRSmbP0P3A3+Fkz0E CKXuVsPQV3PPQ8B75oxgy23wml3G+fRYGQLLPX3wTrEQ2oK5CkxrxtvwiUC23OK1IEQp 796VNhqetQovRq/w6SW/IyToJiW5qdDTKVyBZeXv6/jZ04bZq6oPw39AEhqkeR1FDOdg IpN7dN2fiujAtlZefopnf41bT1IEEDlwY6O+5UYguee17QE+0LW1vHtkdKQtUeKYXd7X WTHQ== 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=2RI1x4addaxeSG0Ueh/t7m47u+roOJv2baaQ7rL2Moo=; b=aRzuPugrBf2AVyjnT1DMwZEau8h85GFR2Emd9VvkX3IGfnLkXxzTXuRbKhOJbTuxxP wiH5mgDicisdhavyBLwMK4UPuuIdE3QnBz+TEtQB4s4lmQcIFx1kHY8h+evDMynO/V6s DZUgrr51JmIJnnGrz4tQC/RyYkcg5ipfwK2rvO++36sq6dizjU8KwOZXKSJCtUwuFIs/ mR5wWH8C7lYRWADO+sVQB9gXLDdM+xSYEbtb3boDuEVVJjbHsTLTZVxfxCy7XSJvBb9F 0CB1swWmAnykWbBpOe2eTuruUXN+ExQYyDbLQQHWEBfoKiC/JQcDh/dpz1kpNMz7iNMe ujCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kc07iCXU; 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 mw14-20020a17090b4d0e00b0021425cf457fsi16194005pjb.32.2022.11.22.11.56.09; Tue, 22 Nov 2022 11:56:22 -0800 (PST) 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=20210112 header.b=kc07iCXU; 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 S234580AbiKVTy5 (ORCPT + 99 others); Tue, 22 Nov 2022 14:54:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234739AbiKVTyW (ORCPT ); Tue, 22 Nov 2022 14:54:22 -0500 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7C81A3403; Tue, 22 Nov 2022 11:54:20 -0800 (PST) Received: by mail-pl1-x633.google.com with SMTP id y10so13489262plp.3; Tue, 22 Nov 2022 11:54:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=2RI1x4addaxeSG0Ueh/t7m47u+roOJv2baaQ7rL2Moo=; b=kc07iCXUBXT3CNeUNFgib2mQbobrmSlPnkO4hN7UDBjXdC593YuLhpAL+DvPmXFPHb ffu3DQ6vyxfbPxVHXCSQm2IAXJFMQuRCUahdFTR9xRFILUYT373IjzHdYc2+AP+YbxU5 fX607CPAdRphk1/UEff3UfGp1v/Madb3BUV1xh+t8qys49zCgEOqZe3PbbBZRXXGyv+j 2dLRm6aPOlxoXIBXIGtJXS8/G2hOqqmL57XCoCY5hZ8Zv6LLflyp7vIMbXfNBD93QMi4 8eWzyhXMrbTTXHUV60Q9/OxTaQJOi+iEV1mFypFCLCZT89646tZ6q3b3DkpmRQ8LoYFx 2JwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=2RI1x4addaxeSG0Ueh/t7m47u+roOJv2baaQ7rL2Moo=; b=a7g46kqkT5MnL2FfaNziZQR7ZgMTQILt/9dNvJJSxmmS4jMdDbUiYhEHju9NmjW7cx Z+LXeawuFEEMW3ucDrLvmXEcuGYCsJe2FJCzzqsWBEE7F1uhD2Vvd9mbl7r1YQYM0ren ady/s7lL883wJgSZmA1hkIJJ1FEdxMl/YdWiVFWu7F0N6Ua6F+udEipK9m7WeUZCA0EO ljbrYChu4/mCrE2QJHUgWkVjmEt1iBEpn1oM7AxhR+2gkTfoVshIB6OYOtUDXdgAlek+ DE8Bb04SqwG2HO7BaxFWxm92yZcSxfyfL2UmRU0pWAhYT5OulIYXuwVpnoLveZ66pB89 kAKw== X-Gm-Message-State: ANoB5pnX2oVQbTE3T5FIIPUzu4n3qE0lVO94VT+g2wSkR7oP1PAZDVbx YT8cBn5DHFqkyIeeMOQD1sY= X-Received: by 2002:a17:902:ab4b:b0:186:7b95:f773 with SMTP id ij11-20020a170902ab4b00b001867b95f773mr6266579plb.152.1669146860203; Tue, 22 Nov 2022 11:54:20 -0800 (PST) Received: from sc2-haas01-esx0118.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id a8-20020a63d408000000b00460fbe0d75esm9699252pgh.31.2022.11.22.11.54.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 11:54:19 -0800 (PST) From: Nadav Amit X-Google-Original-From: Nadav Amit To: 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@vger.kernel.org, linux-mm@kvack.org, Andy Lutomirski , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Richard Weinberger , Anton Ivanov , Johannes Berg , Arnd Bergmann , Andrew Morton , Nadav Amit Subject: [PATCH 2/3] lib/usercopy: Allow traceing of usercopy, xarray, iov_iter Date: Tue, 22 Nov 2022 11:53:28 -0800 Message-Id: <20221122195329.252654-3-namit@vmware.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221122195329.252654-1-namit@vmware.com> References: <20221122195329.252654-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 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?1750227466190456721?= X-GMAIL-MSGID: =?utf-8?q?1750227466190456721?= 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Makefile b/lib/Makefile index 59bd7c2f793a..32766aa26670 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -27,6 +27,8 @@ 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 +44,7 @@ lib-$(CONFIG_SMP) += cpumask.o lib-y += kobject.o klist.o obj-y += lockref.o +CFLAGS_usercopy.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 \ From patchwork Tue Nov 22 19:53:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 24534 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2410552wrr; Tue, 22 Nov 2022 11:56:26 -0800 (PST) X-Google-Smtp-Source: AA0mqf79UH6OMtahxnpu5+tWpcsnyiwyKMAELDQ2A8JY5jecWoON/T7D3t7QXLXYBJJbtoUnsQNA X-Received: by 2002:a17:90a:930f:b0:218:9107:381b with SMTP id p15-20020a17090a930f00b002189107381bmr20313497pjo.75.1669146985760; Tue, 22 Nov 2022 11:56:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669146985; cv=none; d=google.com; s=arc-20160816; b=sh65K2NM92jzSL9YDsNApbKNWTE/rk9sfWjs6wd9Fk4N2WpCzW67vbAUzx+kV2DMqQ 4ZiujaDBKGtw/BiUXvnoKElnhYPy9zVn06L/rieUa76shj+hKDu2d2ZdyqSdVpfJurYB 7FStVmfwZdewy7FHiOgv3VZoOR/iJ0UHE4zdTh9NyFfkujgrc8ixBZlQg2b+w3il9dC3 mC72ONdP+sl848DpAjrxYN4XjwmwDUNfzH7XSz8AjABMSvz7MvRiQm5zyCn9O0N/cwBn +Pe30QBFQFgREPFI5nTA7m2gGDz0T/ccvLix3MXG0gW6VqfEr6R7iGLJi4kppxQZ8yvL D1lQ== 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=GY0uNCRJFDIBd1b/0xpSh6r2iyqgkDnm0VnIWHblR1Y=; b=h3+r8ffjPJ6jCkMkvAXdJIhwqZbFJOQW4uCbBAYANcC2nIkc3vPlOPCw5SZYNDNBTS MVPzGrYohV/MRnErs2wphk7ZA6/JcIfM+HaD4kSMborAHasNBvHRFxpfKtE3NcEM/PZe B4WGdz6fTWhWyyZjvODofDqQhIlihMuefhF7nSlllbfWqp5/U5sgrxOj6wdQH/rVWEVS b4+gdUEOZ07+WE8JZNV7ac82uyJLIL1ASjdrV1EBs4bEe7EdtByFMPP4yv1onG6PhCtL NHC1lS4GKvbP+prUP7nsPlHzBy4vSQcALnCarfyi44KFJvWtIffmQ20QeWVx7a6VGZSc Pxsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="bKvIp/q0"; 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 k185-20020a6384c2000000b0046eed3142cesi14803342pgd.350.2022.11.22.11.56.12; Tue, 22 Nov 2022 11:56:25 -0800 (PST) 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=20210112 header.b="bKvIp/q0"; 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 S234598AbiKVTzF (ORCPT + 99 others); Tue, 22 Nov 2022 14:55:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234746AbiKVTyX (ORCPT ); Tue, 22 Nov 2022 14:54:23 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFCECA3422; Tue, 22 Nov 2022 11:54:22 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id w4-20020a17090ac98400b002186f5d7a4cso14707506pjt.0; Tue, 22 Nov 2022 11:54:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=GY0uNCRJFDIBd1b/0xpSh6r2iyqgkDnm0VnIWHblR1Y=; b=bKvIp/q01sksIgeTfgdSxVX+C8Z+5Q5VPnMnDw6OkhkC00cIjOlJc/ZKdvrNIZSuH4 zMlcdUwGyDqTO6G1LZzPLT9BnwQR8xtwtay3S85AFcj3Ih7Zwm8JuOrJofoPHiGDVUZn lfRF+Ji3Kjjbe3ne+2nHL5KjZXaDbKqLtDX/gW1qDNG8WoTknVg2lZWK+8qZ3lb6ZvRb i8AKbdnE/wzihMT1RF1KcEEAIrVCAAfZ1oSiTvtqo2qeTOLx5bwTTTeOA1fUj87O8jXW B2T84l9rtNUraM2bgG5WNhOSSFktEVM2kiDnXa+8QBdCYNhK88WuMRca5+ysknNexuhF c7xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=GY0uNCRJFDIBd1b/0xpSh6r2iyqgkDnm0VnIWHblR1Y=; b=FGTfT+8tHodQKSWKsGTlvcL4WSuOEPVWN0MAuvwUshEBy2bI9NpJe+V50Y9MlIvsQu 9GQZVztxjFkLRteVrGRFi+KU263rRAt8GSRNS/kluccMBrUSd2nhepG5krNP+fTEBMXU dnzy8EpzuPAWuXqsMl27M19Pgmh0exdogQrWPXCCP+I8lMaY56pQMAzBnBt38Fr8+dhD iygch5rkf9zTrhpnJWbCpUIn8mIaOA2N2ihdJ1ysfRhaV0eTaOa9M6UJybOTb8ihykMp R58KRsaa4OCaw5GkSlKGMB66JqYUt4zfzlGN3sDqqDZRxNFqWAesTRP/mQCfaqPQDanc heqQ== X-Gm-Message-State: ANoB5pmS3bx/6cLTWPbI0UOr/113qkac1sO8IaSNlMzTdgwfO1t8ihNK m2tMJTG4LKeixNLXF9+VRNc= X-Received: by 2002:a17:902:d2c7:b0:189:d3b:61fe with SMTP id n7-20020a170902d2c700b001890d3b61femr5484441plc.168.1669146861753; Tue, 22 Nov 2022 11:54:21 -0800 (PST) Received: from sc2-haas01-esx0118.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id a8-20020a63d408000000b00460fbe0d75esm9699252pgh.31.2022.11.22.11.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 11:54:21 -0800 (PST) From: Nadav Amit X-Google-Original-From: Nadav Amit To: 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@vger.kernel.org, linux-mm@kvack.org, Andy Lutomirski , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Richard Weinberger , Anton Ivanov , Johannes Berg , Arnd Bergmann , Andrew Morton , Nadav Amit Subject: [PATCH 3/3] compiler: inline does not imply notrace Date: Tue, 22 Nov 2022 11:53:29 -0800 Message-Id: <20221122195329.252654-4-namit@vmware.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221122195329.252654-1-namit@vmware.com> References: <20221122195329.252654-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 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?1750227469627878046?= X-GMAIL-MSGID: =?utf-8?q?1750227469627878046?= From: Nadav Amit Functions that are marked as "inline" are currently also not tracable. Apparently, this has been done to prevent differences between different configs that caused different functions to be tracable on different platforms. Anyhow, 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 eb0466236661..36a99ef03a1a 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -158,7 +158,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