Received: by 10.213.65.68 with SMTP id h4csp2444562imn; Mon, 9 Apr 2018 03:45:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+aXPxr3rrrzexrCdNpN2f75JaaZyqs3SULi14e7243YVZX2L88lmLSqqD33ymQQufOclhW X-Received: by 2002:a17:902:8ec8:: with SMTP id x8-v6mr39011641plo.179.1523270709063; Mon, 09 Apr 2018 03:45:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523270709; cv=none; d=google.com; s=arc-20160816; b=TRSZi1gS6Jy69iWea8gTohwTwvmDS3XKLdgfTYsuAOL9GDVrWLW2k6x4N7FTt88QEK bv/mN7P0t4ck9AGtoEOwMW/LTF48k6qBIvs0FOk8Y0L3U/i9eHSFehfB7e+qU9AySxZv e9xxI4jv8FKzAQCwNk6Jbt4imLJ1CE8rFvwnSBUHcPA50tDOTk60wTlUTkUc/Tasp32D zyV1cm2ifcwhQ0eYenIz19+OLbDlTRjBuxdfNe8xfNAm78Ei8rEHOvjaypVtel47L8jw ccV4qqwSZqdQwzd5sIfTg2ePlyudV7I1nNAvO4dWcHGHzPHcs9JJjOUS0KLaK4Waq43X iOPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=rsERyF8R/uvwVfeqiArJtpByQe4VsOkA9/Jgt0+N7as=; b=m6Tu/rDEE8W1bAmqfA02Cwrfrtxv5RwIz6Ny3ZfVC6n5QxP021RHHyg2M4YEtnxoeH 7hkj2bYx17pAWWYNCeyHBEhH+nzbOn0SqsargQRIzGTLiCUj7JLCZX70ZTP1wmkuC+Tf gWcytKa4wuB1dqgW7FJrFdy0N73k+gcDNvwMBR7wb/3aMXfkzMYQkLNBA3NY3Fu2uIoK Pw1B2Xv8LZ11RWtNJgJpUD41ekaZr1tZ+msFqjtwV8ORPG/dmnzjTZt5S5N4RDlNP3AL kMBllatSAKj+pcNnMX/1mGrhprnxQp0z1wJn4/wVcNR+TaYCxDNlmrbh/xlD8mBoC/Ii 5wMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@essential-com.20150623.gappssmtp.com header.s=20150623 header.b=X0FRObaF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3-v6si6731pld.687.2018.04.09.03.44.32; Mon, 09 Apr 2018 03:45:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@essential-com.20150623.gappssmtp.com header.s=20150623 header.b=X0FRObaF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751774AbeDIKlT (ORCPT + 99 others); Mon, 9 Apr 2018 06:41:19 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:36709 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751456AbeDIKlS (ORCPT ); Mon, 9 Apr 2018 06:41:18 -0400 Received: by mail-pl0-f67.google.com with SMTP id 91-v6so4866682pld.3 for ; Mon, 09 Apr 2018 03:41:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=essential-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rsERyF8R/uvwVfeqiArJtpByQe4VsOkA9/Jgt0+N7as=; b=X0FRObaF/liZJgrZGA5rTyOnOYOgKZ8IHsHesYiYLoVu+uIPGobUweqefUZj1yv/mw 70HrceOIO6IE6zFw7jRwr3lQ9+yaP2MjOSiOPSC7ica1JIpaQiDPO2aTaflNjF0IsDgo +ozyXTLEE6mqBBJsJM/QvzD6jRweIIQqpd09XhpyKltsI3NV/DvMo2pRSmx503pxcEN1 AEgSf9KPBIR71gs6UbnSwQ1xYDU1kbvip11Fd/rKsyze7kIDre8AJrHUIQxBw2oToAlG gbQ4a2CYq9UFXt/+7GZV0x6iRpIqSXcaInr04eh4icTWUI+rKBWRrnI9mt4FRuekpmJS fsPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rsERyF8R/uvwVfeqiArJtpByQe4VsOkA9/Jgt0+N7as=; b=eCtKPDcD5vDcV9GnYMiXGtJ0FwydYtqPjJIGtNnwlQpJ8NkyVqmBThGptImBi8cc4D LGCjsgAKTlzYBvs4p+2zOuviXHQ7tgm0MzboCZAo/T0bmqTZCv2DmS6/5TRYioDD57kk GaVjKf6lESE/TmUVr0qfIH7rX77rpvfDdLFazWlu9sZIcrQW5dppJGW00EmUNqsa5RcU VQyEEiPcHBS9UWj/5A1Iff72zgpZ8pafS9sDplabeI2myZZ/n/0Mu/ZbF2L+N0VQGmtl 259Dj/O00ws1Qk0gQN/gYdJieCzCa+ROb5OOZkiHkSGwlSEhOrqqVuug0nsQEhKSlEf9 oInA== X-Gm-Message-State: ALQs6tAX5/W/E5yjB9gDx++JftpwnrX3g5iDqqIY8q0P9U+vNEt6uYz5 z3U8DMsEOfk/IeM5DYmUBFM02w== X-Received: by 2002:a17:902:6b04:: with SMTP id o4-v6mr19905255plk.332.1523270477805; Mon, 09 Apr 2018 03:41:17 -0700 (PDT) Received: from jbtheou ([203.215.133.124]) by smtp.gmail.com with ESMTPSA id 17sm244262pfo.4.2018.04.09.03.41.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Apr 2018 03:41:17 -0700 (PDT) Date: Mon, 9 Apr 2018 19:41:11 +0900 From: Jean-Baptiste Theou To: Mark Rutland Cc: Ard Biesheuvel , Greg KH , Linux Kernel Mailing List , Will Deacon , Dan Rue , Mark Brown , Marc Zyngier , Greg Hackmann Subject: Re: Linux 4.9.93 Message-ID: <20180409194111.16f69253@jbtheou> In-Reply-To: <20180409100741.pwkflhaslx43slro@lakrids.cambridge.arm.com> References: <20180409180534.1768583293d0abe207168c5a@essential.com> <20180409093028.GA3398@kroah.com> <20180409185751.247a0ac7@jbtheou> <20180409100741.pwkflhaslx43slro@lakrids.cambridge.arm.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 9 Apr 2018 11:07:41 +0100 Mark Rutland wrote: > On Mon, Apr 09, 2018 at 06:57:51PM +0900, Jean-Baptiste Theou wrote: > > On Mon, 9 Apr 2018 11:49:37 +0200 > > Ard Biesheuvel wrote: > > > > > On 9 April 2018 at 11:30, Greg KH wrote: > > > > On Mon, Apr 09, 2018 at 06:05:34PM +0900, Jean-Baptiste Theou wrote: > > > >> Hi, > > > >> > > > >> After this patchset, a kernel built with CFI fails. Disabling > > > >> UNMAP_KERNEL_AT_EL0 fix the issue obviously. > > > > > > How does one 'build a kernel with CFI' for arm64? > > > > From Google work on Android-4.9 > > > > https://android.googlesource.com/kernel/common/+/00a195e7c0752ff5d65c9caadfbcc226270ca232 > > > > I am not sure what is the plan on their side to upstream (Greg?), but definitely > > useful to isolate actual issues. > > > > > > Is this a "clean" 4.9.93 tree or a "4.9.93 merged into > > > > android-common-4.9? > > > > It's a "clean 4.9.93" + whatever is needed for Clang/CFI support > > > > My take is that CFI doesn't like > > > > * void __kpti_install_ng_mappings(int cpu, int num_cpus, phys_addr_t swapper) > > > > and > > > > remap_fn = (void *)__pa_symbol(idmap_kpti_install_ng_mappings); > > > > Maybe just flag this function to not use CFI? I remember that Sami Tolvanen did > > similar changes. > > From a quick scan, it looks like CFI uses shadow memory for function > prologues. Since we're taking the PA of a function pointer, presumably > this no longer maps to valid shadow. > > I'd expect the same to apply to uses of cpu_replace_ttbr1(), but it > looks like the only user of that is marked as __init, and that patch > adds __nocfi to __init functions. > > So you probably need to mark kpti_install_ng_mappings() as __nocfi. > > > I know it's a bit out of context since CFI support for ARM64 is not upstream yet, > > but unfortunate that an stable patchset trigger such failures. > > This is simply the nature of out-of-tree code. > > In future, it would be very helpful if you could provide context for > out-of-tree patches in the initial report. > I can pass the initial CFI failures by tagging the function with __nocfi, but still face issues down the road. That said, it's out of tree, so my problem. Will investigate. Thanks a lot for the quick support. Best regards > Thanks, > Mark.