Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1800738pxb; Thu, 28 Oct 2021 10:15:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHYGdv/n80xRmgC21JZWHj4pJaeywzHkZLxb64SCOu4z4S9Xjlpq6qwBq9b045mNFfZTR8 X-Received: by 2002:a62:16c5:0:b0:47b:d7ef:fb4e with SMTP id 188-20020a6216c5000000b0047bd7effb4emr5655123pfw.56.1635441301418; Thu, 28 Oct 2021 10:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635441301; cv=none; d=google.com; s=arc-20160816; b=D+TeHn+yhf37j+GYMuWddgKYrcwzVIluw1ahrik6aT9j+NxezuRJjGiZgB0JifKq+h pB96dZ3lNDgaaQ62J3DqMFfBEFUgiXmD7/FlBYv2e1urD0Bfs+5yYjy45MWjCm++ENUe +NIEGubk7JhPqciKkERgRl6MXpd7xTGw7rxP5r8GdGBIcqGJLEh5AO2llU4pKuK8dUhF nJN+tKEE0tsO1+r4J+wWWt7cnPKfnf5XBTRlSBnE+6o2cPjpYc9uUuAPR20EUjSjHXf+ LVXumrysvISxonWscyx/E5X9fe9a1EfmDIcbUyMmDzXlUFZk8oPhRU48cZkubVVFFy8s /rMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rO/KgEXipkEFOtV4OljWjPnSu+OCWKZ6S7e5cXWpGdM=; b=uk3vkX81Cb2y3Z4Ug0WyDIrRwuOyq/4ufihhbQKBbapMxDT79TvJdme8cYqaEKLi88 xs5/NBkAftcArO4UQxAlVYQOxtCvuCqv2gLdKIcoMDvBgtwVDgjnmntpLU6cn4IPS0B4 u5i2CHYTq9RmLK56q0G/YUMnMsU8IsRvLMBGD7pyu0N9avp8fYQ4J+5eYMg7Y6LVmNCj JOjg09VBMrE9BP4V4RtR9EUaLbe+i7xoRoHFY6xCMYDhzdjkh4n3t2b+SU3EVNT9PQ0q qAA4zao+PWadfXMluelZv/CallZWlJC5mI33g5EJ2fB3mWQyVFmcy2m3ZZRdub8qv8Gq +KTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=E+RG2Kp0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 12si9584337pjl.32.2021.10.28.10.14.46; Thu, 28 Oct 2021 10:15:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=E+RG2Kp0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230225AbhJ1RPB (ORCPT + 99 others); Thu, 28 Oct 2021 13:15:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230223AbhJ1RPB (ORCPT ); Thu, 28 Oct 2021 13:15:01 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 114D4C061745 for ; Thu, 28 Oct 2021 10:12:34 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id i5so4900151pla.5 for ; Thu, 28 Oct 2021 10:12:34 -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=rO/KgEXipkEFOtV4OljWjPnSu+OCWKZ6S7e5cXWpGdM=; b=E+RG2Kp0XaxbrDAcplrk34cq6KscFnOuOWhh/IkBSKWtdOinzE93sAQ1jQyxH/lA/4 Q2aT7OrT1pS4rg1kbOSuna2v1KXwjnCl8++TiRBHXYdzDrpAEXb3zsHCwUh7X1nb5N9m hMyi0/Aky7uDavjOvj+pE5pxSTI6zOml2jflw= 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=rO/KgEXipkEFOtV4OljWjPnSu+OCWKZ6S7e5cXWpGdM=; b=DImQQrK9d5XKQhEauRtWT4yPPDcD0lNrZgOgoETYvyRxmdy0f+FuOtjKPhxuuTp0Dz gu+evtGaiNbBsQbTiVxCpKROnxliI5eU6uUXWeNOLxypP30POgNGTEMxhUUegKYhKI/2 MMwGo/AsMtLOBdfADajfK4MPEsh5jyjVLCtnYMfzL4K1ywojS5WiORfwFFfALiUhq1kZ eFi2l607h+iKaWgbZ+0yLoGI0l0hxcH0xYaxCPQt2X0JhoqxFvxM6G0yTMzIriJQ8K2g Pmu7kArFpLJdxN1wnWhHFYL8mf0dkCo7KNKsKhl69ds9UCnFRttPGXv1Qa36X4aLgwbz 6hUw== X-Gm-Message-State: AOAM530t3+TXaUpVv64hoobFVwd9707miTiTzv3eez/emTV5GK4ZT6rx LlCesVCKZNdFbMPsbbXrXSUzDg== X-Received: by 2002:a17:90a:5b0c:: with SMTP id o12mr14075957pji.11.1635441153641; Thu, 28 Oct 2021 10:12:33 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id b14sm7799796pjo.44.2021.10.28.10.12.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 10:12:33 -0700 (PDT) Date: Thu, 28 Oct 2021 10:12:32 -0700 From: Kees Cook To: Peter Zijlstra Cc: Ard Biesheuvel , Mark Rutland , Sami Tolvanen , X86 ML , Josh Poimboeuf , Nathan Chancellor , Nick Desaulniers , Sedat Dilek , Steven Rostedt , linux-hardening@vger.kernel.org, Linux Kernel Mailing List , llvm@lists.linux.dev Subject: Re: [PATCH v5 00/15] x86: Add support for Clang CFI Message-ID: <202110280958.22E5F74@keescook> References: <20211013181658.1020262-1-samitolvanen@google.com> <20211026201622.GG174703@worktop.programming.kicks-ass.net> <20211027120515.GC54628@C02TD0UTHF1T.local> <20211027124852.GK174703@worktop.programming.kicks-ass.net> <202110270939.F5C79CC@keescook> <202110271430.2A3980217@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 28, 2021 at 01:09:39PM +0200, Peter Zijlstra wrote: > On Wed, Oct 27, 2021 at 03:27:59PM -0700, Kees Cook wrote: > > > Right -- though wouldn't just adding __ro_after_init do the same? > > > > DEFINE_STATIC_CALL(static_call_name, func_a) __ro_after_init; > > That breaks modules (and your jump_label patch doing the same is > similarly broken). Well that's no fun. :) I'd like to understand this better so I can fix it! > > When a module is loaded that uses the static_call(), it needs to > register it's .static_call_sites range with the static_call_key which > requires modifying it. Reading static_call_add_module() leaves me with even more questions. ;) It looks like module static calls need to write to kernel text? I don't understand. Is this when a module is using an non-module key for a call site? And in that case, this happens: key |= s_key & STATIC_CALL_SITE_FLAGS; Where "key" is not in the module? And the flags can be: #define STATIC_CALL_SITE_TAIL 1UL /* tail call */ #define STATIC_CALL_SITE_INIT 2UL /* init section */ But aren't these per-site attributes? Why are they stored per-key? if (!init && static_call_is_init(site)) continue; ... arch_static_call_transform(site_addr, NULL, func, static_call_is_tail(site)); -- Kees Cook