From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 369CCC77B73 for ; Mon, 1 May 2023 20:05:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232985AbjEAUFV (ORCPT ); Mon, 1 May 2023 16:05:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232796AbjEAUFU (ORCPT ); Mon, 1 May 2023 16:05:20 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 669DD2107 for ; Mon, 1 May 2023 13:05:14 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 341Jn1WM004531; Mon, 1 May 2023 20:04:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2023-03-30; bh=QFKA+3/130sUfw9zbI8zOCFg1HPtODAw+5lLoo7bOGw=; b=P5J1ihUEm33csHKtqm3dKAPigh6jOM0W5yT9/BPYGhw1tMYcdyKHoYBwK+7fllloCPNo i6XYDuoB2l10pVG06rBWMT4/Rv22gIBUd0Xtxxr6Ic9QuJF9oPtEyr15wjt0CqONsjcR jj4DfMxNfAOJoeu+rKt8q9jfM+pSm2DE51ZwwGzNeVDeaseEpkO+ZpKsIaN4lWpxRtE7 a4LMq0yAm5VvFG59UYGleP8dt3Q640y/KaQ8HTfeETgugfYwGUQOOVBHTrlm5JqW9R1F 1eaGFtK7gGwkB1lmRabhorZM1JoJ8NfJnaEwTWoUfrt/xjtNC12bhXVXvv8bWIUh1uTC sg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q8u9cu53s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 01 May 2023 20:04:56 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 341IAl2e036003; Mon, 1 May 2023 20:04:55 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2169.outbound.protection.outlook.com [104.47.55.169]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3q8sp4uwct-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 01 May 2023 20:04:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K5MuHHw7rbNwjbigVTS3Cgk/5bDrItRr04SU5nf8OOTteSitZmWQAOjfuah4fRULIrcSeA48k8VGYeUz/dMey0cUlyACCtd9VoHxNxHvLn8x/x7TlUlqLSlpZH27XB73PNgmS+YtN++aUr9Gxrzt20YRxalIvNyQLOnGdiXWw7uI6GJ3E1nKiSOGkaRKGt4XagKZ9+gz7DBBRxsdlGXvRqTT3uAexMeHGTi7B0JAQrHVB0NA90Y9K16zO8T04hoTwHpnM4G8k95lZfAC7b8sp8A+/HuRN9Kqk39/w08gccoxPCJylFmGsdadeSb44SWehdPfxN1pn11U91VDShA5nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QFKA+3/130sUfw9zbI8zOCFg1HPtODAw+5lLoo7bOGw=; b=NSxThgvluN9BCaRWMcaZeIBffWeMuDZqUNslUSZqzBY+iV9t2hheLcGcp5S3oG6oJ4g0mJjkwSbCpPMzZfrPcbacvljos1NPAyeGFPaTXOIqO8x/ZMLneL74TEKk+B7j68T1lz17E3xu8t+YzI41QmmD0jtcGqWwgthI0x8aw98usZcScDENc4D7An7065agXO0iH6lBiJ8soE369COVWHGTLTq0SUHWmNbF4oPpHid/3UqbSAPxY5FVR670NA8AcS0iFc8oQRa4AHs2GPZT/n/DSbEeiYqap8EcTJ0t7hKLrWLqNwtu9b0i5rmtXh7ndZenm0ka7BkZaniKG1TLJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QFKA+3/130sUfw9zbI8zOCFg1HPtODAw+5lLoo7bOGw=; b=EXzi69yC/PhwjnrXYbXTuzDijoMqgsA+p/hf2WJiEiPnldWsrAaOORhtUaepmXFZnoeIsRHBM+oepT3cQcidSacc2i2gcFqx7WToLT7RC/Uv+RDQfMy+teHfOU6s9yCDOge0GWYtEgm3W1NDAk8/erHIuhShWCu9l1qql0s3px0= Received: from MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) by SA2PR10MB4505.namprd10.prod.outlook.com (2603:10b6:806:112::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6340.30; Mon, 1 May 2023 20:04:53 +0000 Received: from MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::ff1c:f1fb:8db9:22e2]) by MWHPR1001MB2158.namprd10.prod.outlook.com ([fe80::ff1c:f1fb:8db9:22e2%6]) with mapi id 15.20.6340.030; Mon, 1 May 2023 20:04:53 +0000 From: Indu Bhagat To: linux-toolchains@vger.kernel.org Cc: daandemeyer@meta.com, andrii@kernel.org, rostedt@goodmis.org, kris.van.hees@oracle.com, elena.zannoni@oracle.com, nick.alcock@oracle.com, Indu Bhagat Subject: [POC 5/5] x86_64: invoke SFrame based stack tracer for user space Date: Mon, 1 May 2023 13:04:10 -0700 Message-Id: <20230501200410.3973453-6-indu.bhagat@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501200410.3973453-1-indu.bhagat@oracle.com> References: <20230501200410.3973453-1-indu.bhagat@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4PR03CA0208.namprd03.prod.outlook.com (2603:10b6:303:b8::33) To MWHPR1001MB2158.namprd10.prod.outlook.com (2603:10b6:301:2d::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR1001MB2158:EE_|SA2PR10MB4505:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ecd1881-48f6-4111-24a8-08db4a7f53d4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x5xanWjdEhgJKU3WyhI4on+kVmh1jAh5S/4omSli8IRc+lRVz2zKKuFV4t6Sqwcf5Dygk77EGuDagpXNlznr8XNYTDcEa058IYhhQqE9XsR67JvJ5jQvjuYNtDQyoe3cHcUPoWklfsh+j9ytl0krPYGEKdDhHHkMS8eadeKNPTnfAt4sq1e5WRjWcdj86J4HFv+wkINZipQOfPM5XFwkv5XzfEeGw8nNRlyt1zaHCNhfodM8xoLMyWwj7bi2OTBYbNCaoSOXEutjc8fuKXH/gyR2wRURNjT3QprUix6PjC3SvrGYY06p/fRQ10OE/jcIM2krOHxd0cJNe/uEKg6wFUKg+nEGNdyO1qZM/vSWMc/qg1Tl/Owt0q3SL/hSwc/iWsvBwPV/Ru3fQlcTcgUAVf3gWq8daEQH9chSwq6rPnf5NQUmB5rhzDpTNjP5TVoODdRJ3K9x8uPhElWBMLIT7JRrGA8Nb+ddVfyH4ukj2BtstVNBv2SijjaW7bHPrhvaBrJ5ENWfxCu4lG5GDhJEyNw7fhI7NMO3Qw/qkxZwpGDkVljn5t/A0dsiasU+Wdk+ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2158.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(376002)(136003)(396003)(39860400002)(366004)(451199021)(107886003)(6666004)(36756003)(6486002)(2906002)(6506007)(6512007)(1076003)(66946007)(66476007)(6916009)(4326008)(66556008)(38100700002)(186003)(478600001)(316002)(2616005)(8676002)(8936002)(41300700001)(44832011)(5660300002)(83380400001)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?3ICbviICish0w1gUZGAeFkRTCLb5cZyCNYRrmhYUCyOgQ3EdMxu+O7v9cFWp?= =?us-ascii?Q?jk1YyBHxYTC0+hcFoiw670xNcA3r6v92G9j3HvgDeMz5+HTVfXpsT7B/pufe?= =?us-ascii?Q?dQDwmxrvcnF61z8SvvTEjcS1XJSZrF0RTKbBV4LA4GLLY24f5H6jMmEVKY0r?= =?us-ascii?Q?32naJgcJF+iazXrmkQyrVZEJw/sqtpOtyxagQeoWmRiL83II3b70uxXGvsIg?= =?us-ascii?Q?/Rusl8c7s/JFGq12jrAD0NbUurvIS19qdplcxSC5us2cbT6wnZSE2+i86kO8?= =?us-ascii?Q?byQgQq36d9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C/K35uoGaGmaZ72JdARgK4wQZ+CExZOiB0r/pOJUX3ibWn2AV347pmVEsfxEijv7HDRYZyVPziMh+xp5zJWpQkqvf4ImXumgxpYZtXCOzVYwu5e1/4kJxLRjCfpmiynbwE+0TfhKHPlX5acu+gFm9bxxj03uepHO2Wp00OIcKxXgp13u/HMDdypHJ4zsPqBdXrwH9hv4jS1n3/wAzJvWJMgro/3T4lCfo7lqBCH/Kq5yYPvc8DXpu2QU5wCcuwusbT3XnbWTBHd7WzpB4XZJChObYXH/7ph8GOlZbYh2qjF7cmD4rz0c0vN+HS+hJ+e5t9tos2P0L9F1CGfNRw3ymCiPSWMZHAgWb7qNN04abHXswFQ17YiCwpLBAc1edINjBad2/w6TpM8MA1qGYWodtrfCUgcngkgl5eUAPW2vKmcTT5TzBGDA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0ecd1881-48f6-4111-24a8-08db4a7f53d4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2158.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 May 2023 20:04:53.2673 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mhH1FTBCRfCFxgp2EMbI5gRRNJ55x9wWvvPsGo+m45Ofgdj9/SeBve35D0wNSG5YgLSiE6f4IXMXbFu7Ixks4g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4505 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-01_12,2023-04-27_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2305010161 X-Proofpoint-GUID: tu1l5OHDBRWjPAWwcZ6P_MVK5hnx09Ld X-Proofpoint-ORIG-GUID: tu1l5OHDBRWjPAWwcZ6P_MVK5hnx09Ld Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org The task's sframe_state is allocated and initialized if a phdr with type PT_GNU_SFRAME is encountered for the binary. perf_callchain_user() will fall back on the frame pointer based stack trace approach if: - SFrame section for the main program is not found. - SFrame state for the task is either not setup or stale and cannot be refreshed. Finally, the sframe_state is cleaned up in release_task(). Signed-off-by: Indu Bhagat --- arch/x86/events/core.c | 51 ++++++++++++++++++++++++++++++++++++++++++ fs/binfmt_elf.c | 39 ++++++++++++++++++++++++++++++++ kernel/exit.c | 9 ++++++++ 3 files changed, 99 insertions(+) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index d096b04bf80e..4be9e826714a 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2860,11 +2860,54 @@ perf_callchain_user32(struct pt_regs *regs, struct perf_callchain_entry_ctx *ent } #endif +#ifdef CONFIG_USER_UNWINDER_SFRAME + +#include + +/* Check if the specified task has SFrame unwind state set up. */ +static inline bool check_sframe_state_p(struct task_struct *task) +{ + bool sframe_ok = false; + + /* FIXME TODO - only current task can be unwinded at this time. + * Even for current tasks, following unknowns remain and hence, not + * handled: + * - dlopen / dlclose detection and update of sframe_state, + * - in general, any change in memory mappings. + */ + if (task != current) + return false; + + if (!task->sframe_state) + return false; + + sframe_ok = (unwind_sframe_state_valid_p(task->sframe_state) + || unwind_sframe_state_ready_p(task->sframe_state)); + + return sframe_ok; +} + +#else +/* Check if the specified task has SFrame unwind state set up. */ +static inline bool check_sframe_state_p(struct task_struct *task) +{ + return false; +} + +static inline int sframe_callchain_user(struct task_struct *task, + struct perf_callchain_entry_ctx *entry, + struct pt_regs *regs) +{ + return 0; +} +#endif + void perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs) { struct stack_frame frame; const struct stack_frame __user *fp; + bool sframe_avail; if (perf_guest_state()) { /* TODO: We don't support guest os callchain now */ @@ -2887,7 +2930,15 @@ perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs if (perf_callchain_user32(regs, entry)) return; + sframe_avail = check_sframe_state_p (current); + pagefault_disable(); + + if (sframe_avail && !sframe_callchain_user (current, entry, regs)) { + pagefault_enable(); + return; + } + while (entry->nr < entry->max_stack) { if (!valid_user_frame(fp, sizeof(frame))) break; diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 1033fbdfdbec..8a932bc9ad5d 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -820,6 +820,34 @@ static int parse_elf_properties(struct file *f, const struct elf_phdr *phdr, return ret == -ENOENT ? 0 : ret; } +#ifdef CONFIG_USER_UNWINDER_SFRAME + +#include + +static inline int sframe_state_setup(void) +{ + int ret; + + /* Allocate the SFrame state (per task) if NULL. */ + if (!current->sframe_state) + current->sframe_state = unwind_sframe_state_alloc(current); + + if (!current->sframe_state) + return -ENOMEM; + + ret = unwind_sframe_state_update(current); + + return ret; +} + +#else +static inline int sframe_state_setup(void) +{ + return 0; +} + +#endif + static int load_elf_binary(struct linux_binprm *bprm) { struct file *interpreter = NULL; /* to shut gcc up */ @@ -842,6 +870,7 @@ static int load_elf_binary(struct linux_binprm *bprm) struct arch_elf_state arch_state = INIT_ARCH_ELF_STATE; struct mm_struct *mm; struct pt_regs *regs; + bool sframe_avail = false; retval = -ENOEXEC; /* First of all, some simple consistency checks */ @@ -861,6 +890,14 @@ static int load_elf_binary(struct linux_binprm *bprm) if (!elf_phdata) goto out; + elf_ppnt = elf_phdata; + for (i = 0; i < elf_ex->e_phnum; i++, elf_ppnt++) { + if (elf_ppnt->p_type == PT_GNU_SFRAME) { + sframe_avail = true; + break; + } + } + elf_ppnt = elf_phdata; for (i = 0; i < elf_ex->e_phnum; i++, elf_ppnt++) { char *elf_interpreter; @@ -1342,6 +1379,8 @@ static int load_elf_binary(struct linux_binprm *bprm) */ ELF_PLAT_INIT(regs, reloc_func_desc); #endif + if (sframe_avail && sframe_state_setup()) + goto out; finalize_exec(bprm); START_THREAD(elf_ex, regs, elf_entry, bprm->p); diff --git a/kernel/exit.c b/kernel/exit.c index 34b90e2e7cf7..e9b461f689a4 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -70,6 +70,10 @@ #include #include +#ifdef CONFIG_USER_UNWINDER_SFRAME +#include +#endif + #include #include #include @@ -241,6 +245,11 @@ void release_task(struct task_struct *p) struct task_struct *leader; struct pid *thread_pid; int zap_leader; + +#ifdef CONFIG_USER_UNWINDER_SFRAME + unwind_sframe_state_cleanup(p); +#endif + repeat: /* don't need to get the RCU readlock here - the process is dead and * can't be modifying its own credentials. But shut RCU-lockdep up */ -- 2.39.2