From patchwork Mon Oct 3 22:21:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ali Raza X-Patchwork-Id: 12997835 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 C5231C4332F for ; Mon, 3 Oct 2022 22:22:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 153D78E0002; Mon, 3 Oct 2022 18:21:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0DC918E0001; Mon, 3 Oct 2022 18:21:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E74128E0002; Mon, 3 Oct 2022 18:21:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D373E8E0001 for ; Mon, 3 Oct 2022 18:21:57 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A54C9140ABE for ; Mon, 3 Oct 2022 22:21:57 +0000 (UTC) X-FDA: 79981061874.09.2BD49CF Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2102.outbound.protection.outlook.com [40.107.243.102]) by imf02.hostedemail.com (Postfix) with ESMTP id 4950980017 for ; Mon, 3 Oct 2022 22:21:57 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MZGZLcwrhmMFuxpdSckqK3bo1Ai9/rCChCC4EtP8PXo8hQjEvgYybAxx1xWDNKZkssFMswY87kAJaAKEOYNL5Zw5JQ2252gd3Nec2bV6XX+megjf/IQNrhwEw0ePkPUPGRckXZE4lj70dcEh25xdn+DkFHlCQJVgeRs0JpqIZPbn91x9hdwIJX2ne5jx4DfmhVWKMSumbMSz0SjQqfr0qj0GFWGrzObld7XU8swn1riCGukVPYdG31QIF6zw/rV09SKhJZjrKBhQncO8d9GdV6oYDL42S605c9x8bHGyJww72JbsLvDaRTb2NRmfzfl9+EgatArRGCh3VpvoI3ocPw== 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=J8518zTRI17HbsZNfkeZY1Q6TIPgIuAuW6ZRtNWowSI=; b=Cb9M5X3yNadbrS8qW2e1/869W2L1tz4iauBcswN3aQmKRVMoMwfYecLOg2y5tml/C9xvfEYvJ9OHjCAAbJ64nYbLN44pHlTHU+RKuyMGhbKfGT8U0cbPJXHwaadGBG0cEKIq4DB958K1epuWuanYtnEDDKE0wjplb2jOpQyaKMksbJY9BRb6gD+BgJIJ7ODO7s0r5D48zogk//CwN+/24Ipcd85dBdwOosqZiJdC9MBizeJmne1m+Kh2HsGKgLvpOSc8ArdfiSPUzZU+k+u1GbMf0CVVkDL1Oi8JK84erFLAJs1kciXIFMte/IGmzqBOn+rLDHAUbHPX4UsNXSYyWQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=bu.edu; dmarc=pass action=none header.from=bu.edu; dkim=pass header.d=bu.edu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bu.edu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J8518zTRI17HbsZNfkeZY1Q6TIPgIuAuW6ZRtNWowSI=; b=IGsR7XhAMdFZc0smUKWVtSp/p3/ypRtr6m7Fj7LL/9iSpMWg5own4HwQz2SNxDClPSA+EsllZUpFC+Yq7tlPpEtHoqR0q9+4hiiLh9s7/gzIxvhaviJifkjLQYWA66Dn7h53C8rCTsnTlyg7qfXOXIxNFgqwhCOLhkohZyT0VPGnZS475kKRLr/3WRZ2EhBvXufuBoNUI6vjMM2pCq1CQcpFlLoEXOPf/RP66PMnCTjyadO3WBLk0gbOLaTL4qx6BapgHd31KBa/6oFMkw7mDKB27T4/ZBVOqtCRnEmzGNhEYLKHJQqBP+h6IvI523vVeDksRGy1e5+OBOAMr+v14g== Received: from BL0PR03MB4129.namprd03.prod.outlook.com (2603:10b6:208:65::33) by MN2PR03MB4928.namprd03.prod.outlook.com (2603:10b6:208:1a7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.24; Mon, 3 Oct 2022 22:21:56 +0000 Received: from BL0PR03MB4129.namprd03.prod.outlook.com ([fe80::9e2b:bf05:79ec:581]) by BL0PR03MB4129.namprd03.prod.outlook.com ([fe80::9e2b:bf05:79ec:581%4]) with mapi id 15.20.5676.030; Mon, 3 Oct 2022 22:21:56 +0000 From: Ali Raza To: linux-kernel@vger.kernel.org Cc: corbet@lwn.net, masahiroy@kernel.org, michal.lkml@markovi.net, ndesaulniers@google.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, luto@kernel.org, ebiederm@xmission.com, keescook@chromium.org, peterz@infradead.org, viro@zeniv.linux.org.uk, arnd@arndb.de, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, pbonzini@redhat.com, jpoimboe@kernel.org, linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, x86@kernel.org, rjones@redhat.com, munsoner@bu.edu, tommyu@bu.edu, drepper@redhat.com, lwoodman@redhat.com, mboydmcse@gmail.com, okrieg@bu.edu, rmancuso@bu.edu, Ali Raza Subject: [RFC UKL 02/10] x86/boot: Load the PT_TLS segment for Unikernel configs Date: Mon, 3 Oct 2022 18:21:25 -0400 Message-Id: <20221003222133.20948-3-aliraza@bu.edu> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003222133.20948-1-aliraza@bu.edu> References: <20221003222133.20948-1-aliraza@bu.edu> X-ClientProxiedBy: MN2PR04CA0031.namprd04.prod.outlook.com (2603:10b6:208:d4::44) To BL0PR03MB4129.namprd03.prod.outlook.com (2603:10b6:208:65::33) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL0PR03MB4129:EE_|MN2PR03MB4928:EE_ X-MS-Office365-Filtering-Correlation-Id: a232e0bb-987e-418d-407b-08daa58dae2a X-LD-Processed: d57d32cc-c121-488f-b07b-dfe705680c71,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gmQ+jE4C6SqbijVDVgWeXPjE7uLdhsVrKx2H0MvUo8ES+LKx0+2DIDiOXqmQLROvIygXWl1DrtMIYiynfZkBWImBsm+STauGdbCXC/BVUlQmigelZ0t5eZDpOiTjNURRybr/TU/0U3dLLGwSLNt96FMBG+7qWeet35x1GQTqm/85af24nK2HwzXf36rT4Ad9INugex924IfrBbZ2u037xEMUD0CoeZ3eUWzAfWPQ3VCed4ugZtgGy6O2EfUpH14RF52Tiehn0N76H2w3rFSviLFwYAZWux8KiP49A335GTa+uutT/q8icybuw0bAysOH3w+mrmvmPkjYJV4aJijfVHnTN367e55JKrZVSRZtZRF4Vuo/wkpCWVNQpntch5fPMzTa3E7MbV4dsB5Vj9M8b2G/+bCCXzmiBYbSk43SA2H847LHSFxwjJhnNOKQZvoEEjHOGwDQH8L41pPT3YxcriNwIIGDAnjkCKAEqyzSDcqXR7/PNrUj+CdC8l9k8MvrZLYiVf6qOhqNKskOZANrbEhts6IxOf4rXmqhYfFUhq3hnm6wbQu3d7CTpa6vCxapL14oSXuAdVb8JLVuBpIpoaD2E3AO/rrsLQDGJR2JL5UGVYMHBQbnOjW0PLyIDFbi70MPg34c+Hmh3t9uJqjFt2Z/1k93YNt3y3PWQYK5hgsE3MHrk2bV5/SjVtXEHRAbFQeVsH/qM2RvAeeODVzmod/cqn5Fg+R4d12cfFz7pPi/RyXsJulP7zVJYZpxLNHiS0QaLgpx1H8epMu/qyPSJA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR03MB4129.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(136003)(346002)(366004)(396003)(39860400002)(451199015)(8936002)(7406005)(41300700001)(6666004)(38350700002)(75432002)(66556008)(66476007)(4326008)(8676002)(1076003)(186003)(6512007)(2906002)(2616005)(66946007)(52116002)(6506007)(36756003)(5660300002)(7416002)(26005)(86362001)(41320700001)(6916009)(38100700002)(316002)(6486002)(478600001)(786003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YuYwJLoeVeZXSZUmCeV2JJZZmQkzv+aOOe95Tf+3AEoGIDRys2pbh47l7R23r+0/RGt6vRxze6XA5bw0nxd8f5B0HIe8VZUNEn1QJvAE1ZxzcfyVSqP6d+7ZPIkhMMxOt6sxh3egnCjhJVQImgL8LsDWrIz2TMSM89wCZXEydG83oXhA93wYh1/z2y6A1Za2BxdXXKUsIC6f2NG4PAU0lnFLWmPXqfHlKlndwSGFmwmLGXrfFL4asFNBR7BtsZKjKt48uqJcue1gtVdyRXhSgRiNcg0BAZvukz8i9nmzHMDWHogUR5olwTKBFFxy6u5t/aRa58Y8gdB6kiD/mvSr/TkyOlUGdIHi1sD/gGaSLD0aQvCYcIT5MlhvIE2M+ludu348w3scD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fk1TfnI96+idTss5Pavf/t8jaiK0T1ST5ea87KHyL64E4MLNQaIcMUdvWaYQeyIB28wKOR2SLrzTRlfOnb4z/g1mXJeFwiLvn6yBUam+5RX2Yl/NX24ixj7ty X-OriginatorOrg: bu.edu X-MS-Exchange-CrossTenant-Network-Message-Id: a232e0bb-987e-418d-407b-08daa58dae2a X-MS-Exchange-CrossTenant-AuthSource: BL0PR03MB4129.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2022 22:21:55.9666 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d57d32cc-c121-488f-b07b-dfe705680c71 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rwNLJFU7uVriXvc3j20WELWE0GjNjOITOd7J6aZPS/8+5rMtWFTtT83HhTSaB2ic X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR03MB4928 ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664835717; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=J8518zTRI17HbsZNfkeZY1Q6TIPgIuAuW6ZRtNWowSI=; b=BsBMVkGM65oe65P+YSI3kh81PRrfx951NJs4hR0HihJ3xVnTJpO5j/vvIOlQWctwiw+t4r xJSrcdeWEZIE1lXNivM5hWZjplEPvitohnNtjSJlvwK3r6OkuMzcGCshMq0ckej8nSn3b8 OWjdE2zbNpPHj24JlAarKg1UUyNbTp8= ARC-Authentication-Results: i=2; imf02.hostedemail.com; dkim=pass header.d=bu.edu header.s=selector2 header.b=IGsR7XhA; dmarc=pass (policy=none) header.from=bu.edu; spf=pass (imf02.hostedemail.com: domain of aliraza@bu.edu designates 40.107.243.102 as permitted sender) smtp.mailfrom=aliraza@bu.edu; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1664835717; a=rsa-sha256; cv=pass; b=R0Z4E8YVX0KhvGfvPZa44QcjedQ0UcdnZTOO8mkzWPuw9J0VbT+6+ABpKTztLLAzR2kwmX Gw08+SvOfSGmvBhccwhtK0xxWT6Z6CuVVBVl+rPYaAj9Bm3tqBUNyysiDeRoKBSzecKh5f TyVntgY9vDhwRhdyRD+OsTn+3z1L6Zk= X-Stat-Signature: rp7tmw7dmsx1d1z7cwpby9mhawnfg57z X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 4950980017 Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=bu.edu header.s=selector2 header.b=IGsR7XhA; dmarc=pass (policy=none) header.from=bu.edu; spf=pass (imf02.hostedemail.com: domain of aliraza@bu.edu designates 40.107.243.102 as permitted sender) smtp.mailfrom=aliraza@bu.edu; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-HE-Tag: 1664835717-514311 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The kernel normally skips loading this segment as it is not inlcuded in standard builds. However, when linked with an application in the Unikernel configuration the segment will be present. Load PT_TLS when configured as a unikernel. Cc: Jonathan Corbet Cc: Masahiro Yamada Cc: Michal Marek Cc: Nick Desaulniers Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Andy Lutomirski Cc: Eric Biederman Cc: Kees Cook Cc: Peter Zijlstra Cc: Alexander Viro Cc: Arnd Bergmann Cc: Juri Lelli Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Steven Rostedt Cc: Ben Segall Cc: Mel Gorman Cc: Daniel Bristot de Oliveira Cc: Valentin Schneider Cc: Paolo Bonzini Cc: Josh Poimboeuf Signed-off-by: Ali Raza --- arch/x86/boot/compressed/misc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index cf690d8712f4..0d07b5661c9c 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c @@ -310,6 +310,9 @@ static void parse_elf(void *output) phdr = &phdrs[i]; switch (phdr->p_type) { +#ifdef CONFIG_UNIKERNEL_LINUX + case PT_TLS: +#endif case PT_LOAD: #ifdef CONFIG_X86_64 if ((phdr->p_align % 0x200000) != 0)