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 X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 714AFC34056 for ; Wed, 19 Feb 2020 20:12:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 40FFD24654 for ; Wed, 19 Feb 2020 20:12:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="KZjz6JeV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726851AbgBSUMe (ORCPT ); Wed, 19 Feb 2020 15:12:34 -0500 Received: from mail-vk1-f195.google.com ([209.85.221.195]:42281 "EHLO mail-vk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726634AbgBSUMe (ORCPT ); Wed, 19 Feb 2020 15:12:34 -0500 Received: by mail-vk1-f195.google.com with SMTP id c15so509822vko.9 for ; Wed, 19 Feb 2020 12:12:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=42MaK4n6+CrelpQTjPFZO9NB2S0O1OTsWCtSJ9pIv6o=; b=KZjz6JeV1vFYXt8q0wyrdwBhXZ/8rzg3LVXGgnEjLp0yccOlrd9L+Ok9CSnmEDAScF 5DXgdCokxyl/DepQSJRvQZcSN+CE8Kcr0SWpEfzBMCL7WlKU8JPwmUJCsE2rI7Vb7lKV bgQULZyhEbb7MwpvmgaQHsqZa8CaNOAvokqUXRgGKlW538y3zdoMMZdFUy60Yhv2WJdn xOhNioYtaDA8ydHmJeTzDTHNO8vInpQ9cb9Ph5Mu9jvt5hFURbjsN43FQ7NZbkVfeBb2 LHRWZWKArxzLHQPRZfP/szxqEcv4AqpjRJQcw8TGu10OvO3/JnOO2GhuCUA9yjJvEBPV ehWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=42MaK4n6+CrelpQTjPFZO9NB2S0O1OTsWCtSJ9pIv6o=; b=Z8BhsKge4kFfCpHTxFnaYFm30Z1SnWHzVIPCHHNXPl9EXvQppcGvBILGM3DhwQIGPl RVbLuYoHKEm6+ZJhBXv6OUYDIB+Gw/8/pgWCFqO8gMlyhP7j2TFvzl97NWpcZUPnGXW5 1A3cMi5ZsreplbhzGVjIA0zkfcgbAkCzNV35gZauzjQKjZ7BrB089mkdDjVhPBhrEkjB pUGrcSs5auicTgMRS7Jv+E7MX3/Dw+PiZbaCvnzBMb/YyqlmRIF5Gcsfbfr8Phy96/2g jf+zVPbcDXuwOxLkYT/DDDSc89r3EjZAH5L5DiEGDja9y7aUuE1AbX5qnfbs40g7kj41 /APA== X-Gm-Message-State: APjAAAX+IZrAR8pUqZgGgYYoNGLnrjD5nS6YqNbNFvkefwOsky5M5/72 Aot86DSTWe2hLlbMeZ4p+6M3yLGReDuuNnc9KoYqEg== X-Google-Smtp-Source: APXvYqyTw52gSQ4jw8pztzOwndZ0sk6pyQFwXTfytaf2zPfg719bU3sRcZ3Xjk3tkUfVqd3npa2/1rrBf+K/+C8JeGQ= X-Received: by 2002:a1f:4541:: with SMTP id s62mr12216061vka.59.1582143153200; Wed, 19 Feb 2020 12:12:33 -0800 (PST) MIME-Version: 1.0 References: <20191018161033.261971-1-samitolvanen@google.com> <20200219000817.195049-1-samitolvanen@google.com> <0386ecad-f3d6-f1dc-90da-7f05b2793839@arm.com> In-Reply-To: <0386ecad-f3d6-f1dc-90da-7f05b2793839@arm.com> From: Sami Tolvanen Date: Wed, 19 Feb 2020 12:12:21 -0800 Message-ID: Subject: Re: [PATCH v8 00/12] add support for Clang's Shadow Call Stack To: James Morse Cc: Marc Zyngier , Will Deacon , Catalin Marinas , Steven Rostedt , Masami Hiramatsu , Ard Biesheuvel , Mark Rutland , Dave Martin , Kees Cook , Laura Abbott , Nick Desaulniers , Jann Horn , Miguel Ojeda , Masahiro Yamada , clang-built-linux , Kernel Hardening , linux-arm-kernel , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 19, 2020 at 10:38 AM James Morse wrote: > This looks like reserving x18 is causing Clang to not-inline the __kern_hyp_va() calls, > losing the vitally important section information. (I can see why the compiler thinks this > is fair) Thanks for catching this. This doesn't appear to be caused by reserving x18, it looks like SCS itself is causing clang to avoid inlining these. If I add __noscs to __kern_hyp_va(), clang inlines the function again. __always_inline also works, as you pointed out. > Is this a known, er, thing, with clang-9? I can reproduce this with ToT clang as well. > I suspect repainting all KVM's 'inline' with __always_inline will fix it. (yuck!) I'll try > tomorrow. I think switching to __always_inline is the correct solution here. Sami 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 X-Spam-Level: X-Spam-Status: No, score=-0.7 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5599C34056 for ; Wed, 19 Feb 2020 20:12:50 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 672912064C for ; Wed, 19 Feb 2020 20:12:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="smFaXgzy"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="KZjz6JeV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 672912064C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=um4gfS0w5VqW628/7b2HgN7da6XGljm2zSJc05od/h8=; b=smFaXgzywtnwyO 43ZqerhtMSZopIP/avUiRHwk1WHtDmM+8Eu+sh/tTwLFPP6g08FrXT5MGKj4j7/Atfs/EO26JxNuI EtbRPKyoV0j6BZ4SNlALaLtXPRPkh6G02jg3omz+TBRhr8+CxeoaTBknilx7c9r86qSyJHG64fYkL xjfIzcBIlfcSJe59yjYRH2/M0xm0m4Q2du+zjHVTMuswbYZ5AfOgFbpQw7uLK9hnXxMgnQXUUvLM9 V4Es6egM5TXTDkbq4hghN+v3XHF+4XQ1iOLbCGEiJ4ivotZaL80g8ehFxdDoRcZhR+/2yfXKEZF28 RyIVEuZj32LFoQJ36U+w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1j4Vi8-0002Wj-PB; Wed, 19 Feb 2020 20:12:44 +0000 Received: from mail-vk1-f194.google.com ([209.85.221.194]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j4Vi5-0002O6-Ft for linux-arm-kernel@lists.infradead.org; Wed, 19 Feb 2020 20:12:42 +0000 Received: by mail-vk1-f194.google.com with SMTP id c129so512244vkh.7 for ; Wed, 19 Feb 2020 12:12:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=42MaK4n6+CrelpQTjPFZO9NB2S0O1OTsWCtSJ9pIv6o=; b=KZjz6JeV1vFYXt8q0wyrdwBhXZ/8rzg3LVXGgnEjLp0yccOlrd9L+Ok9CSnmEDAScF 5DXgdCokxyl/DepQSJRvQZcSN+CE8Kcr0SWpEfzBMCL7WlKU8JPwmUJCsE2rI7Vb7lKV bgQULZyhEbb7MwpvmgaQHsqZa8CaNOAvokqUXRgGKlW538y3zdoMMZdFUy60Yhv2WJdn xOhNioYtaDA8ydHmJeTzDTHNO8vInpQ9cb9Ph5Mu9jvt5hFURbjsN43FQ7NZbkVfeBb2 LHRWZWKArxzLHQPRZfP/szxqEcv4AqpjRJQcw8TGu10OvO3/JnOO2GhuCUA9yjJvEBPV ehWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=42MaK4n6+CrelpQTjPFZO9NB2S0O1OTsWCtSJ9pIv6o=; b=lGmNAGjPVH7sOqo2dH4z0sUVysQ7PWUMAarrCjb+oswl+1rP8NRWThZ49I/+7WZyVK zdE7QEvpVWs6wy5B+cwYbRZmxO2MLPfcPEyoFX9T2kvmGNr9gwN25/Jc9Z9+Sx9X36jz sM6zXadbaVrT2ij8ijBvbry6eaOH9YTTr6r5LP6g9F2EB25mSzUy6I9+L5bvNKlUwXLP 6/a5747uJcSbOjPbuCTl1U0L/hfv0W2dSVQow1EI/DMUB5weTg/LmglYX6QE8bQGFB6+ u2qnFL5rbGBRvn+/7zL9xHVgv1j9ui1D/jCtM3vVsg+igbmt0xeaeT0pCuD9zCMF2Z3V jE8g== X-Gm-Message-State: APjAAAWHH/CJGKu5ZH/Tj1Ucc6Id04VtXF7dMhiULzXBK3MnfwfgrV6e 5DrQd20vRY6NOvDZ1DHL7p+rUvOBPJsrY7m+12gNdQ== X-Google-Smtp-Source: APXvYqyTw52gSQ4jw8pztzOwndZ0sk6pyQFwXTfytaf2zPfg719bU3sRcZ3Xjk3tkUfVqd3npa2/1rrBf+K/+C8JeGQ= X-Received: by 2002:a1f:4541:: with SMTP id s62mr12216061vka.59.1582143153200; Wed, 19 Feb 2020 12:12:33 -0800 (PST) MIME-Version: 1.0 References: <20191018161033.261971-1-samitolvanen@google.com> <20200219000817.195049-1-samitolvanen@google.com> <0386ecad-f3d6-f1dc-90da-7f05b2793839@arm.com> In-Reply-To: <0386ecad-f3d6-f1dc-90da-7f05b2793839@arm.com> From: Sami Tolvanen Date: Wed, 19 Feb 2020 12:12:21 -0800 Message-ID: Subject: Re: [PATCH v8 00/12] add support for Clang's Shadow Call Stack To: James Morse X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200219_121241_532238_3621A475 X-CRM114-Status: GOOD ( 11.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Kees Cook , Ard Biesheuvel , Masahiro Yamada , Marc Zyngier , Jann Horn , Nick Desaulniers , LKML , Steven Rostedt , Miguel Ojeda , clang-built-linux , Masami Hiramatsu , Catalin Marinas , Kernel Hardening , Laura Abbott , Will Deacon , Dave Martin , linux-arm-kernel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Feb 19, 2020 at 10:38 AM James Morse wrote: > This looks like reserving x18 is causing Clang to not-inline the __kern_hyp_va() calls, > losing the vitally important section information. (I can see why the compiler thinks this > is fair) Thanks for catching this. This doesn't appear to be caused by reserving x18, it looks like SCS itself is causing clang to avoid inlining these. If I add __noscs to __kern_hyp_va(), clang inlines the function again. __always_inline also works, as you pointed out. > Is this a known, er, thing, with clang-9? I can reproduce this with ToT clang as well. > I suspect repainting all KVM's 'inline' with __always_inline will fix it. (yuck!) I'll try > tomorrow. I think switching to __always_inline is the correct solution here. Sami _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 594B3C34056 for ; Wed, 19 Feb 2020 20:12:53 +0000 (UTC) Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.kernel.org (Postfix) with SMTP id A9A382064C for ; Wed, 19 Feb 2020 20:12:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="KZjz6JeV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9A382064C Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernel-hardening-return-17851-kernel-hardening=archiver.kernel.org@lists.openwall.com Received: (qmail 13967 invoked by uid 550); 19 Feb 2020 20:12:46 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Received: (qmail 13944 invoked from network); 19 Feb 2020 20:12:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=42MaK4n6+CrelpQTjPFZO9NB2S0O1OTsWCtSJ9pIv6o=; b=KZjz6JeV1vFYXt8q0wyrdwBhXZ/8rzg3LVXGgnEjLp0yccOlrd9L+Ok9CSnmEDAScF 5DXgdCokxyl/DepQSJRvQZcSN+CE8Kcr0SWpEfzBMCL7WlKU8JPwmUJCsE2rI7Vb7lKV bgQULZyhEbb7MwpvmgaQHsqZa8CaNOAvokqUXRgGKlW538y3zdoMMZdFUy60Yhv2WJdn xOhNioYtaDA8ydHmJeTzDTHNO8vInpQ9cb9Ph5Mu9jvt5hFURbjsN43FQ7NZbkVfeBb2 LHRWZWKArxzLHQPRZfP/szxqEcv4AqpjRJQcw8TGu10OvO3/JnOO2GhuCUA9yjJvEBPV ehWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=42MaK4n6+CrelpQTjPFZO9NB2S0O1OTsWCtSJ9pIv6o=; b=eGHlL5UDbJOAt2PqutbBh9feg0ZfKAHj8WYmsPga2go5xglC1PxdJ0Y00Uc5VTjok0 QahdtoLu7deK9JyiMq/6OAYKxE03sv7gXfXyYLy8bHJr5jZswSVb4/wDA1WhvLiC2sLw DFzda6+jowWnEM78ocf3n8PmoItCuYrVSrtBzL9Omf30AK4WIIIBw3gTzmf6P8Ra7dDo SNL5TmaESXEjqvKNyuWtHdsfwC9De/g1FmiXQcT7dwKOG1F5jpWzmxPZBYcUIpyV3SJ3 owAckZOMvfYZunjt06Wo1zB4L2g2fBoDpj4PjctqZm2czpUGbTOurRwTJFe52BQ1tBpv S2iA== X-Gm-Message-State: APjAAAXprLcnIXjevpxwom/kasw8jCE8xxhx47Xp+PdgWDAAVOaHwgFZ rQMgWuc5K6jBPJoO/6pd7O6p63k/I0n7WZ8U8KlE8g== X-Google-Smtp-Source: APXvYqyTw52gSQ4jw8pztzOwndZ0sk6pyQFwXTfytaf2zPfg719bU3sRcZ3Xjk3tkUfVqd3npa2/1rrBf+K/+C8JeGQ= X-Received: by 2002:a1f:4541:: with SMTP id s62mr12216061vka.59.1582143153200; Wed, 19 Feb 2020 12:12:33 -0800 (PST) MIME-Version: 1.0 References: <20191018161033.261971-1-samitolvanen@google.com> <20200219000817.195049-1-samitolvanen@google.com> <0386ecad-f3d6-f1dc-90da-7f05b2793839@arm.com> In-Reply-To: <0386ecad-f3d6-f1dc-90da-7f05b2793839@arm.com> From: Sami Tolvanen Date: Wed, 19 Feb 2020 12:12:21 -0800 Message-ID: Subject: Re: [PATCH v8 00/12] add support for Clang's Shadow Call Stack To: James Morse Cc: Marc Zyngier , Will Deacon , Catalin Marinas , Steven Rostedt , Masami Hiramatsu , Ard Biesheuvel , Mark Rutland , Dave Martin , Kees Cook , Laura Abbott , Nick Desaulniers , Jann Horn , Miguel Ojeda , Masahiro Yamada , clang-built-linux , Kernel Hardening , linux-arm-kernel , LKML Content-Type: text/plain; charset="UTF-8" On Wed, Feb 19, 2020 at 10:38 AM James Morse wrote: > This looks like reserving x18 is causing Clang to not-inline the __kern_hyp_va() calls, > losing the vitally important section information. (I can see why the compiler thinks this > is fair) Thanks for catching this. This doesn't appear to be caused by reserving x18, it looks like SCS itself is causing clang to avoid inlining these. If I add __noscs to __kern_hyp_va(), clang inlines the function again. __always_inline also works, as you pointed out. > Is this a known, er, thing, with clang-9? I can reproduce this with ToT clang as well. > I suspect repainting all KVM's 'inline' with __always_inline will fix it. (yuck!) I'll try > tomorrow. I think switching to __always_inline is the correct solution here. Sami