From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Vq46GZiAnmq8kjMAWB0awg (envelope-from ) for ; Mon, 07 Sep 2026 05:15:04 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aMoCu5cb; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aMoCu5cb; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 0946B1E09E; Mon, 07 Sep 2026 05:15:04 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 88EE61E091 for ; Mon, 07 Sep 2026 05:14:59 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C38DD4A9E065 for ; Mon, 7 Sep 2026 09:14:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C38DD4A9E065 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aMoCu5cb; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aMoCu5cb Received: from GVXPR05CU001.outbound.protection.outlook.com (mail-swedencentralazlp170130007.outbound.protection.outlook.com [IPv6:2a01:111:f403:c202::7]) by sourceware.org (Postfix) with ESMTPS id 33D594BB58B3 for ; Mon, 7 Sep 2026 09:14:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 33D594BB58B3 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 33D594BB58B3 Authentication-Results: sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c202::7 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1788772466; cv=pass; b=KfUv1AovlTtjgv2zZ9kamvAu80CxogJZaP62QbzkHfFdj7dlS+61bW8OzSP9t+NS48w/GEB3TjnQ/0jOaqzpvE3tWGNKZW4HU8q8lEYu40PjgilS0Dq09p12PQPj9tJ/8LlQ+znCCwFNLn4n1ek/ZkcMkgpQNgxn0qf8pLuJAVE= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1788772466; c=relaxed/simple; bh=vdNUH+4hl6C3hQuE+ouVaoZ2ajumDF8Et32Bec2xu9o=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:Subject:To:From: MIME-Version; b=p6qOXclXOrWIyQqRltwIi+/TLzAjNlf69kn6yW4MnP025248D3mIMn3WR5RMxShFrOpy0ymA24+48wE7hUM58Nuq7IN2CdEKGop2dO4T4IO7YkWIaRix5VYEzX3qln8D1Sjjg+iCathA+MOafcfG+uUe+h3ZUVO9l+IDARhN5RM= ARC-Authentication-Results: i=3; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aMoCu5cb; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=aMoCu5cb DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 33D594BB58B3 ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=YIp8yEvI/d5WBGME/TP34PNG/4AtZrcPSL9qAFV8xSHtiumXtIQ+b9rBsdBs9ak8QSu4RLNIQ5QvELncSR5Bpi2eJdvV0otrhwTH6ObaL0H7QvQU/kEvtucb4LKIvYYLpe8GrfcMQhTS5G+QRwqP6tw6Oz7fWzWu5poBTJBciPpN1q77JHBaSt3coKy54sq0OObYBS3a3C88JIfwLslX115ZsXPXXSM2q/EOIv3uRDkH1/khKzEagF9Jmpz5oi+GO17BVE6FMmcSV2b+n7jFDGZorLtigjOPmQ16rr83DdVXAQIWXPFlp8VziLbdtQNJm9qjzPiib2IL7Cs/5uojcg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=BQqGABzPGwZA3Np7hpeFyLSVnvNloCA6yvqs6hb5mKY=; b=T0Pw6d52UnrZnupY0bYRH5D8AJOA18LXA+nPbSUDct8OGz37yq2+zx6L/Z1pGlU39zy23FvbCoN3hwem5N3uS1TkqbNws63jVLxSxq6SDeGxNlexCPlx0vT8qeqzFjfW2FHnVhF3+vMM1xgrSw+efZBtM3ydoRMuSW30pA++ODTa3iMhpYjA0PLMLaxYuL290P/HGfwbsk+iZ8RTDyoXHZLenjGzo9jDLfApGXZ9gyEFD7w7dvdjtNcFV403mI+wNUnN7CG8fTNfYEUmCQktbAOAcbly5R/CN4VbQLi5EehxEIjtPhzjf6RK3fSkMjNk08BSSbEtCIoywc9QSTTn+A== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BQqGABzPGwZA3Np7hpeFyLSVnvNloCA6yvqs6hb5mKY=; b=aMoCu5cb0o44sWmJdYM3wxrboJrk3kHKy92XsfXJY6te45z095ni2WcR53BQln7lHkbF1XTNoonXxlugwm8KP04Yn6+C8x/Hy5wl85VYr6ywxWTrL6S0j2Z2X+Z68as8aIoc+TBpjotv2TtizKOofEVcNEscpozZP/Mzrzc+jFE= Received: from PR3P192CA0029.EURP192.PROD.OUTLOOK.COM (2603:10a6:102:56::34) by MIWPR08MB315980.eurprd08.prod.outlook.com (2603:10a6:290:e6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.382.10; Mon, 7 Sep 2026 09:14:20 +0000 Received: from ZR1PEPF0000E45F.eurprd04.prod.outlook.com (2603:10a6:102:56:cafe::14) by PR3P192CA0029.outlook.office365.com (2603:10a6:102:56::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.382.15 via Frontend Transport; Mon, 7 Sep 2026 09:14:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 4.158.2.129) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 4.158.2.129 as permitted sender) receiver=protection.outlook.com; client-ip=4.158.2.129; helo=outbound-uk1.az.dlp.m.darktrace.com; pr=C Received: from outbound-uk1.az.dlp.m.darktrace.com (4.158.2.129) by ZR1PEPF0000E45F.mail.protection.outlook.com (10.167.241.55) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.5 via Frontend Transport; Mon, 7 Sep 2026 09:14:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=P3aeCXjw+hDzY31XBLTfGibSWKPq4bjyEEba8YStqLlufS50b6e3kFNGeryfQdK1qxEWRV6PKC33MrKgXfCE40/5SoNNNH1qk9I7pwX2khnTGdlmMgdcmeKK0ff18+SNSOPU9dWZfd6gNe6ahHpCSafNve0dTpgvKIKu9OqSfHeRfda/ZKlH4Y9r6Q6eDvj1BYLoFihnFylYuoCboKEKLr8pCiu6HRyQLjj2w/TL/ajLEzbEqsBl0IoOKjfBZm+u52SyReNQaXusVWnsWTUCqdr7jaMSWz3ZwkkNAUP1G+5BhZex1aRtk+QrftHggZQGn3xqHgh7t8UV5lGi/kDwmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=BQqGABzPGwZA3Np7hpeFyLSVnvNloCA6yvqs6hb5mKY=; b=ES+XpkP8UjYRsw995POye4gT0sH8GN11x0SQULeBYzcSRMOC01kXmpXAO0xHJiwK28H35NAz+Yf1ah5+ENw2Ih432E9hYXuP5nRFu0eP3wa8h+0uikOAWwnMKQlyOMBhnI79K0dk5QXotDkx0lvo7hYaj6rdnt/G30nHiWn/xoEuFClqsmZfAGHbZgTuC2CdVbC5AqUCAiq/OwTjnUeLr7qyhRFWEXf4ltLVYdqiGAowVh/d6BTFlNcZuHYl/arbudgw6qFkhfGwlgKK2UyWZ32mlVi5tlimF8NWRi2sMWLogg2jBUABkrOsMr3v3+zyOhJaEZKHdgFIk/vbYRYtzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BQqGABzPGwZA3Np7hpeFyLSVnvNloCA6yvqs6hb5mKY=; b=aMoCu5cb0o44sWmJdYM3wxrboJrk3kHKy92XsfXJY6te45z095ni2WcR53BQln7lHkbF1XTNoonXxlugwm8KP04Yn6+C8x/Hy5wl85VYr6ywxWTrL6S0j2Z2X+Z68as8aIoc+TBpjotv2TtizKOofEVcNEscpozZP/Mzrzc+jFE= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB8659.eurprd08.prod.outlook.com (2603:10a6:20b:563::10) by PA6PR08MB10693.eurprd08.prod.outlook.com (2603:10a6:102:3d3::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.6; Mon, 7 Sep 2026 09:13:45 +0000 Received: from AS8PR08MB8659.eurprd08.prod.outlook.com ([fe80::96bf:2de3:5eab:70ae]) by AS8PR08MB8659.eurprd08.prod.outlook.com ([fe80::96bf:2de3:5eab:70ae%5]) with mapi id 15.21.0406.002; Mon, 7 Sep 2026 09:13:45 +0000 Message-ID: Date: Mon, 7 Sep 2026 10:13:44 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] gdb/linux-tdep: display ProtectionKey in info proc mappings To: gdb-patches@sourceware.org Cc: Luis Machado , Luis Machado , Thiago Jung Bauermann , Srinath Parvathaneni References: <20260728152921.256276-1-matthieu.longo@arm.com> Content-Language: en-US From: Matthieu Longo In-Reply-To: <20260728152921.256276-1-matthieu.longo@arm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0181.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a4::6) To AS8PR08MB8659.eurprd08.prod.outlook.com (2603:10a6:20b:563::10) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: AS8PR08MB8659:EE_|PA6PR08MB10693:EE_|ZR1PEPF0000E45F:EE_|MIWPR08MB315980:EE_ X-MS-Office365-Filtering-Correlation-Id: 729de9e1-fe23-4672-a01e-08df0cc0664c x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|366016|1800799024|23010399003|376014|10067099003|6133799003|22082099003|18002099003|56012099006|11063799006; X-Microsoft-Antispam-Message-Info-Original: AiM+y69Gb7DN7vNV28tjTOQ1octeZRbTqeSI5AwfqMg7Xrwk/rWoClG28W9/S0kDWOSiIKHhDrefjx4b3FYZNHW5IJYC0PsLhXtn0PmToeREauAaWOpY+qpx//i9svhKMq+2BnwRHrutwPxFr2Gb7ZWriojpCxUc7uNbL3PgUrz0GNVqcS1RGSQa+NcJeEsckwcRhaYJtszRDcfqeWxUC7h0EnWFPu1sjT4lhHlMQeoNqEUWrMzA2Tmzo1irRRSR3gz2bbQr5J8ZPYDrPnDyXNPu46zWSSDwQfWPHridfnvmomW8HTqO6lotfH4LG5gVkPVN/uo3ept2Vy+imdmO171YH3/jScqoSiTTsXw/kWvs5Qe4E+zRM7uiBlz+Xi8YdZTF0DZH/dNnYCvWG4E5HejaCT4iBaf3bS3pWr4AUed375ort0uWUUg1RJk+ZMYFgo3HdKoU8+4fHhF/JL7fP4MGOovaBviOb6WiA+B5kO5Byu3NV68+yqci+zTHPzblrrwK9DSitlVrIqn0IJDYThV2ZgNW9isQpYlheIAmG9fgfSA+N/I8sdGTJffkpnnTZBvECLOtxNREVSK6pc00TuWv1dQvwHVGFmzYslmtX6OoBVH0gUm5ROaOBEgmSfLO X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB8659.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(1800799024)(23010399003)(376014)(10067099003)(6133799003)(22082099003)(18002099003)(56012099006)(11063799006); DIR:OUT; SFP:1101; X-Exchange-RoutingPolicyChecked: KLQNZ5TboVjOYJ+OS7M9DNi/FUPUJ8vt//bRQa299bbI2WNI3BslRGphZAEkE6DARxh36rZ95VMD7Y72Hyh+u3XMw++PTuXsapJ8lZXwBG3IoSvE6hQ+vNlgxM4GnhoDnQfJ4JeW3voRKBn/g1iAYCCZhVdANEY1rW2fdZN+7s3Yd2BRfykgvuMQzg9CBH9RQqv2+kIxszshhKXzX3+9sLkxqFIotTtifxqDEWGtCkmbf98SFrFXe84/lvkiYg3vfc/NBK81Oyha6WsPEF3XJo0A2Ozjsa5CR4p0AenPeEIZjZ3RArNcQbQN4lMQ7vFVwk3iOnDYtpIdwSF/fhvHFA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA6PR08MB10693 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: ZR1PEPF0000E45F.eurprd04.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 0462e43b-af9f-49f7-73ce-08df0cc0516c X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700016|1800799024|23010399003|35042699022|14060799003|82310400026|6133799003|10067099003|56012099006|11063799006|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: 3o5NSujAZmvbQj/Ger1M+2MP7+AEIoEfHHA/bjJii63Q6kxdYSovCo0nMlL5oriLRbtA06+Hvf6xvePebxuiIsf9jDBEsnfP/rei5C1n9wz23UwaCUc9rMpxTtmZlm8IXNOf2yZGRx48irwjy7jZXKIb3ftQEOK9EUMGjKG+XQK2LVnSnXLF4NaZco7qI/enyd7fBae9+Npi1ykXJuacdyn4nk1lIAGGAtwuCkXnBJc2IucIMyuNTpDJbOXUDFZqN+Tnuj0ovhyPliEgQdDMG7j4zJBU4FgTdDK7apLZQCoQNRVMuU69p9YwoDPf5Vr6BoIupC59s8hUQe020XorhjQ/ZXcx3xZryF+8tOIJp/MvugUEVGELBehXVrqVRIP+o2mzmOISMcMcyf4k1IxfDk6eEY/zykVOLYIkk0aEBlU54IGFl39JG35stdUYLKweEKAgorGZGLfK4RKO8oSPkLZwMI1FZXsFr1Xqm3IMqDEF+N/rU10HvCxFEQzvwN80Z6T2UM9MPRlOKpa+4tPJEs+hpeeuIopO2TN96D8LJXQu3zWaAsqQQT9spxl+LZPvbCzVMqmZEpZPd06rYyfveBTBJdW26pBAWOTGOc0hAFfuMx7yyqi13yxqa14YAwuyfRY6rVcNkyL3BnH26h1N7txm4yj9pCeWrSmT70efHZI= X-Forefront-Antispam-Report: CIP:4.158.2.129; CTRY:GB; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:outbound-uk1.az.dlp.m.darktrace.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(36860700016)(1800799024)(23010399003)(35042699022)(14060799003)(82310400026)(6133799003)(10067099003)(56012099006)(11063799006)(22082099003)(18002099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Cr8WxGXr814mVxzmrKvURiBvyxP9DqPUNDttOhuFTMtp+ApIpNVy1eyU1E82oPU/CC6+dr1d/PjM9Cd2HfWOSwYOFCt2Nql0I+y0zAulAL2YZIAmdeKrx7n13JgMajhNwsSz8pim9LULiDtsaFyGkb03C/vbC1Zg5zK/7vfDiKgAK4B+YPM0WMKBERBExlawW+PG4unF99Jp4dbECD/u1HR+UmbxJ77JfmdOFpd0DOYJit7nmKR6ExduGkvoZCnXP0r8YPVSyyJrx2bIQ9m1kL8sL6LHwqxbfTBaQwhkrFCL6UaWcS21cxXyOe2lHpaMQ68vs7DDCsfzE6NhU7ZlXeLyj9Pau3PE/B+yuQEjN5lpz83Qz9zbrTYlPFxNZyaV8ZwjQlG7D6IHMIiJXw9NugQQ4ndRTiYb2bmvhbjN9O6Ii1vCHUxNj4e8zTL7fehr X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2026 09:14:19.7630 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 729de9e1-fe23-4672-a01e-08df0cc0664c X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[4.158.2.129]; Helo=[outbound-uk1.az.dlp.m.darktrace.com] X-MS-Exchange-CrossTenant-AuthSource: ZR1PEPF0000E45F.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MIWPR08MB315980 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 28/07/2026 16:29, Matthieu Longo wrote: > Memory Protection Keys provide a mechanism for enforcing page-based > protections without requiring modification of the page tables > when an application changes protection domains. [1] > > The "ProtectionKey" field may be present in /proc/PID/smaps on x86_64, > PowerPC, and AArch64 systems since Linux 4.9, when the kernel is built > with Memory Protection Keys support. > > Store the parsed PKey in smaps_data as an optional value on systems > where the kernel reports memory protection keys. > > Parse /proc/PID/smaps alongside /proc/PID/maps when printing 'info > proc mappings', and add a PKey column when at least one smaps entry > contains a "ProtectionKey" field. > This lets 'info proc mappings' show the protection key associated with > each mapped address range. > > [1]: https://docs.kernel.org/core-api/protection-keys.html, > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/ > linux.git/commit/?id=c1192f842841 > --- > gdb/linux-tdep.c | 93 ++++++++++++++++++++++++++++++++++++++++-------- > 1 file changed, 78 insertions(+), 15 deletions(-) > > diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c > index 2e9cb14d5bf..2cdf93f3193 100644 > --- a/gdb/linux-tdep.c > +++ b/gdb/linux-tdep.c > @@ -124,6 +124,7 @@ struct smaps_data > > ULONGEST rss; > ULONGEST swap; > + std::optional pkey; > }; > > /* Whether to take the /proc/PID/coredump_filter into account when > @@ -907,6 +908,11 @@ extract_string_view_from_buffer (gdb::array_view &buffer, > return {gdb::array_view (start, it), next_start}; > } > > +/* Forward declaration of parse_smaps_data used in linux_info_proc below. */ > + > +static std::vector > +parse_smaps_data (const file_reader_t &freader); > + > /* Implement the "info proc" command. */ > > static void > @@ -1010,33 +1016,69 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args, > } > if (mappings_f) > { > + /* Parse the content of /proc/PID/smaps. */ > + bool pkey_column = false; > + std::vector smaps_data; > + file_reader_t smaps_freader > + (string_printf ("/proc/%ld/smaps", ptid.lwp ())); > + if (smaps_freader.error ()) > + warning (_("unable to open /proc file '%s'"), > + smaps_freader.c_filepath ()); > + else if (smaps_freader) > + { > + smaps_data = parse_smaps_data (smaps_freader); > + > + /* Check whether "ProtectionKey" field is present. */ > + pkey_column > + = std::any_of (smaps_data.cbegin (), smaps_data.cend (), > + [] (const struct smaps_data &d) -> bool > + { return d.pkey.has_value (); }); > + } > + > + /* Parse the content of /proc/PID/maps. */ > + std::vector maps_data; > file_reader_t map_freader > (string_printf ("/proc/%ld/maps", ptid.lwp ())); > - if (map_freader) > + if (map_freader.error ()) > + warning (_("unable to open /proc file '%s'"), > + map_freader.c_filepath ()); > + else if (map_freader) > + { > + auto content = map_freader.view (); > + for (auto it = content.begin (); it != content.end ();) > + { > + auto [line, next_line_begin] > + = extract_string_view_from_buffer (content, it, '\n'); > + it = next_line_begin; > + > + /* read_mapping() expects a null-terminated string. */ > + *std::prev (it) = '\0'; > + maps_data.emplace_back (read_mapping (line.data ())); > + } > + } > + > + gdb_assert (maps_data.size () == smaps_data.size ()); > + > + if (maps_data.size () > 0) > { > gdb_printf (_("Mapped address spaces:\n\n")); > - ui_out_emit_table emitter (current_uiout, 6, -1, "ProcMappings"); > + int n_cols = (pkey_column ? 7 : 6); > + ui_out_emit_table emitter (current_uiout, n_cols, -1, "ProcMappings"); > > int width = gdbarch_addr_bit (gdbarch) == 32 ? 10 : 18; > current_uiout->table_header (width, ui_left, "start", "Start Addr"); > current_uiout->table_header (width, ui_left, "end", "End Addr"); > current_uiout->table_header (width, ui_left, "size", "Size"); > current_uiout->table_header (width, ui_left, "offset", "Offset"); > + if (pkey_column) > + current_uiout->table_header (4, ui_left, "pkey", "PKey"); > current_uiout->table_header (5, ui_left, "perms", "Perms"); > current_uiout->table_header (0, ui_left, "objfile", "File"); > current_uiout->table_body (); > > - auto content = map_freader.view (); > - for (auto it = content.begin (); it != content.end ();) > + auto it_smaps = smaps_data.cbegin (); > + for (const auto &m: maps_data) > { > - auto [line, next_line_begin] > - = extract_string_view_from_buffer (content, it, '\n'); > - it = next_line_begin; > - > - /* read_mapping() expects a null-terminated string. */ > - *std::prev (it) = '\0'; > - struct mapping m = read_mapping (line.data ()); > - > ui_out_emit_tuple tuple_emitter (current_uiout, nullptr); > current_uiout->field_core_addr ("start", gdbarch, m.addr); > current_uiout->field_core_addr ("end", gdbarch, m.endaddr); > @@ -1047,15 +1089,21 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args, > m.endaddr - m.addr)); > current_uiout->field_string ("offset", > paddress (gdbarch, m.offset)); > + if (pkey_column) > + { > + if (it_smaps->pkey.has_value ()) > + current_uiout->field_signed ("pkey", > + it_smaps->pkey.value ()); > + else > + current_uiout->field_skip ("pkey"); > + } > current_uiout->field_string ("perms", m.permissions); > current_uiout->field_string ("objfile", m.filename, > file_name_style.style ()); > current_uiout->text ("\n"); > + ++it_smaps; > } > } > - else > - warning (_("unable to open /proc file '%s'"), > - map_freader.c_filepath ()); > } > if (status_f) > { > @@ -1605,6 +1653,7 @@ parse_smaps_data (const file_reader_t &freader) > int mapping_file_p; > ULONGEST rss = -1; > ULONGEST swap = -1; > + int pkey = -1; > > memset (&v, 0, sizeof (v)); > struct mapping m = read_mapping (line); > @@ -1705,6 +1754,18 @@ parse_smaps_data (const file_reader_t &freader) > mapping_anon_p = 1; > } > } > + > + if (streq (keyword, "ProtectionKey:")) > + { > + if (sscanf (line, "%*s%d", &pkey) != 1) > + { > + /* Remove the trailing column when printing the warning. */ > + keyword[sizeof ("ProtectionKey:") - 2] = '\0'; > + warning (_("Error parsing %s's value in {s,}maps file '%s'"), > + keyword, freader.c_filepath ()); > + break; > + } > + } > } > /* Save the smaps entry to the vector. */ > struct smaps_data map; > @@ -1724,6 +1785,8 @@ parse_smaps_data (const file_reader_t &freader) > map.inode = m.inode; > map.rss = rss; > map.swap = swap; > + if (pkey != -1) > + map.pkey.emplace (pkey); > > smaps.emplace_back (map); > } Ping.