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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1879DC43334 for ; Mon, 13 Jun 2022 16:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ttvjuytelLU9AfWEFbQ4vbDcx/aBHMKlFdaKBSefMd4=; b=Ke4Oib5Qjm7XaG ihcdFbubRzIvhwO2NAR+CQz0SNcWdDhUshhWgKdNVO+V6H7/xm4d/x4yerJ/jmDpN00W7Tn4lMHu5 rDCaVRglX11gOlRfBnpVM4LmzcSPM2zmXsXKRHiuqbhwhI5eR6EDygqLOwP5odOUtea01M17F3H1s l2vevwtv4I2anRv9F8tySVrqED9C52BchqaykWXlKhBGj3fgfZXUDc8qrIyrKWXAoCy1TlMcD8bXT 2rdkv4V4o9v456ERpmxi3JcIbJ5+jD5dQa54ojs1GVbM7G/rZ93bBwjtlW2x4/ha57zxe2lYQyktT Fzk6CTozGxBkoTL+pc+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o0mxu-004iM1-0N; Mon, 13 Jun 2022 16:30:58 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o0mxr-004iLM-48 for linux-arm-kernel@lists.infradead.org; Mon, 13 Jun 2022 16:30:56 +0000 Received: by mail-pf1-x434.google.com with SMTP id 15so6205915pfy.3 for ; Mon, 13 Jun 2022 09:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=jg1eKPU1uEURhS3+Z80pFZCk2yX3Lcx0TI8Jd4OtwLs=; b=Q9FrisIWEPV8NA59XodMQu1kJXFEPcMCF9jAlznlo9iJ0BAJYYOcZb10qJbvJFMEYK Wn486nH5hRe5EFND8RakyM/DxMb5LMn40b2VOsjMPQW2kFbDx940CyVhtoQFusXoTi2I 2GJqmzDGWz7uG++e4x5QlTnLlv8Yq/ZIcUe0w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=jg1eKPU1uEURhS3+Z80pFZCk2yX3Lcx0TI8Jd4OtwLs=; b=DZDyTeIN2kJeJXjE6PQc+1blihovh4l8L11BRZ87Q34tUILbP5UZ1h7k9zUl9PDlqp gKkkSq0gdFW6FCBZGjU8kf4bBmMZFKSSRpwmCbdX1dpBIxMKUMO/UKvjfSqaKfma/+2w LMVwuHl711hABo6oAB9Ycx9CCL9m+kVBk2NDTkvEHzLpGXRpI1hcOfI0ZXL/SlbgIWb8 gyft7UDsZQRrEUHEAnSEfu16f7UyWAf3m7PRlz7pLAPcARdNWfFZIqe9+vHOBOdlHwpw 0lyy60tstwuLxmpjehBF6sE119NziNptX2N70kXjNh/kReW+PBJG0zc65r5l5UTySKey x2yA== X-Gm-Message-State: AOAM532Ux78QKB0UusKZFbOBCRqgeXy4OAtzv5stvTqGYlj56jjTFLEW +ZWnuhN5NRt+N7dXmgFSWrnxHw== X-Google-Smtp-Source: ABdhPJxi5yej5QalMelE9Pw95MOEkmJyIDtPZ+E97ji9QbaPeLa+TP4q9ctEEHDQ4iVhMDEQlLyL1A== X-Received: by 2002:a63:f206:0:b0:3fe:49ec:7ee2 with SMTP id v6-20020a63f206000000b003fe49ec7ee2mr365430pgh.309.1655137853197; Mon, 13 Jun 2022 09:30:53 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id r10-20020a170902ea4a00b001637997d0d4sm5328983plg.206.2022.06.13.09.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jun 2022 09:30:52 -0700 (PDT) Date: Mon, 13 Jun 2022 09:30:51 -0700 From: Kees Cook To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, maz@kernel.org, Sami Tolvanen , Fangrui Song , Nick Desaulniers , Dan Li Subject: Re: [PATCH v3 3/3] arm64: implement dynamic shadow call stack for Clang Message-ID: <202206130927.C1BF21FB83@keescook> References: <20220613134008.3760481-1-ardb@kernel.org> <20220613134008.3760481-4-ardb@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220613134008.3760481-4-ardb@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220613_093055_205969_C2226C7F X-CRM114-Status: GOOD ( 13.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jun 13, 2022 at 03:40:08PM +0200, Ard Biesheuvel wrote: > Implement dynamic shadow call stack support on Clang, by parsing the > unwind tables at init time to locate all occurrences of PACIASP/AUTIASP > instructions, and replacing them with the shadow call stack push and pop > instructions, respectively. > > This is useful because the overhead of the shadow call stack is > difficult to justify on hardware that implements pointer authentication > (PAC), and given that the PAC instructions are executed as NOPs on > hardware that doesn't, we can just replace them without breaking > anything. As PACIASP/AUTIASP are guaranteed to be paired with respect to > manipulations of the return address, replacing them 1:1 with shadow call > stack pushes and pops is guaranteed to result in the desired behavior. Specifically, the "PAC available" benefit is the per-thread memory savings (no shadow stack needs to be allocated). Thanks for getting this working! > Signed-off-by: Ard Biesheuvel Sami, can you test this for the cases you've needed this for? In the meantime, Will, can you land this for -next so we can get maximal test time? -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel