Received: by 10.213.65.68 with SMTP id h4csp2411995imn; Mon, 9 Apr 2018 03:11:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Q6h0yguMJaeUKalTAV8kIm8MC1vL0EB5Hiq+Fh4Fs5zvmJa5N3m0uWp5rMaVhPhC1CAWj X-Received: by 10.99.143.3 with SMTP id n3mr24422480pgd.136.1523268661434; Mon, 09 Apr 2018 03:11:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523268661; cv=none; d=google.com; s=arc-20160816; b=SeY9dpyP+4m76VPFUNIHyCKUx9Uf6SDqPUMF44nfzLyAFGzMDTAgdA62Mu6A+jUsER deghq0e450u9PVbfa3ltgWDwed3U2LACEj1D7dQWlTCJQLFnZaFgKG/OyOVYmgAAUKZW WruW3GPchBBKC/647tb8o0ujTLigMjiU4qxnoH8uv1zd4nSSbTSHxYGast2uk2m0o2tQ IiAsJKuEoQwLpJD7/7BmyxAxy90Lvy3/N/Vtl+JQ8nvAr9jX0ad5QM45MJoXpqIF+nOj dvmXB2QrIFdYW/yNt6YpmKjOegxD90rl59JSQMIsbWSyLSuQIU+p5JjM49GBIyu8ika2 oxsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=nNpbrpc1WY8XS3Cz/TVF1ZbskuLQyFyaTTLxM3joF8g=; b=H+VG9oRi+WILjUayPmfFQ8NO4dvUn4xwcM4NXvBv0++BWq5FW/cTi67f5D5dmKFkVK jfn7cacn7SEkIrc6cQL80jMzRtC3tqELUGPxXLR1q5YusG0lBou+YbA5M2aEkiiHjK7Q 2AzxnVAnF3kkWXrnf3Zd7Mj9pzpQstCZjzIifz+T80XuTFiRQA2biOp9QXr2EG2wO2dV a6nwVCJxHZhTlDS09Ou5WUVQjF5ERoF57+DFiufbRIJWYbqJP9+W7b7nPcAvzkV7pWRU Nl2lSVCXAtXIL64R5DxH+n16ygo8xGe5jIjJPWBCGCvhJg47KYJohPDc/KutbxUBKzcD 5acg== ARC-Authentication-Results: i=1; mx.google.com; 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 b3si11009160pgn.665.2018.04.09.03.10.24; Mon, 09 Apr 2018 03:11:01 -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; 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 S1751914AbeDIKHq (ORCPT + 99 others); Mon, 9 Apr 2018 06:07:46 -0400 Received: from foss.arm.com ([217.140.101.70]:53938 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751505AbeDIKHp (ORCPT ); Mon, 9 Apr 2018 06:07:45 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9D07A1529; Mon, 9 Apr 2018 03:07:45 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 016493F592; Mon, 9 Apr 2018 03:07:43 -0700 (PDT) Date: Mon, 9 Apr 2018 11:07:41 +0100 From: Mark Rutland To: Jean-Baptiste Theou 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: <20180409100741.pwkflhaslx43slro@lakrids.cambridge.arm.com> References: <20180409180534.1768583293d0abe207168c5a@essential.com> <20180409093028.GA3398@kroah.com> <20180409185751.247a0ac7@jbtheou> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180409185751.247a0ac7@jbtheou> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Mark.