Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp690287pxb; Fri, 16 Apr 2021 16:03:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwN1+zPx5/X7FONaiufgsojqGEI+WBER1BSK+ygivDquYZ1KP/9xtFWedhoQwZ59imun6jm X-Received: by 2002:aa7:8187:0:b029:213:d43b:4782 with SMTP id g7-20020aa781870000b0290213d43b4782mr9909625pfi.26.1618614227767; Fri, 16 Apr 2021 16:03:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618614227; cv=none; d=google.com; s=arc-20160816; b=JaV+EWuFNq+/8LthOGeT00DGsLESzPclvudEby/C0S8LDUb3dAcoRpmZXrFkz/b9Dl sHTh9YxVvN0xxL/Iu8i6ESSuFMdH4mmAlHD57zqniJOJwi+T9erOGTSlFY8T6v8hAYiq l4dys1PVVaOWw9tXFQmM2cvuqzahP6bSV33WZTiaK/LAPbdOi+Ta17Lnnsf3VVJQtzFY j0bhOqQEe+1k8gt8rgRblnTpDLFYJtoGno/Gy8H6Vo3UbEnAdLQ9v+g+gUt1oNKFBzZ9 eo+FAlaY+7EvyaqBSO6mCcLMvH1dncaf0PMc2HJzg2mgjj6JDP776Mj+Tcx4l7nHtLE/ uF3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=zYsmczDUOwFiI2C1OqNRUIH5SZiNDmStN6eTeuq1zKQ=; b=iGg6cg6PRnCNgdFQ8YvpWVJMOsP8F0guU1Q4yavki9dtqaFEUVjeiA26WX4VxXhWqU f7xf1Qihg0NEjOkTF8McZqXmN9g+loBixwwI3bUYWIt/ewPd7qXCGAEAt6SYTd23X1EM 4yga0HkQy+qY3Xd2qVZ8qXlACKemb2AkyTE0QD8Dwm0iJ9SuChEa72n/cWwQKLxdxzyA DIVzis4HOPIhaoMPX3gi86rQugF5F8HK4m2jsmG3g8s8y3ZWdfjwx4jmyezi4HepNemp S974UQJzPG4AoZNWeXIXO9qdyg9k75vRAix0GkhtaVpS55te9lNS6UJBgS+iP3/kht0E 8czA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=unUul3QA; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=7henxW8U; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n5si7449828pjv.127.2021.04.16.16.03.35; Fri, 16 Apr 2021 16:03:47 -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=@linutronix.de header.s=2020 header.b=unUul3QA; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=7henxW8U; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231997AbhDPXDS (ORCPT + 99 others); Fri, 16 Apr 2021 19:03:18 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:60492 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229719AbhDPXDQ (ORCPT ); Fri, 16 Apr 2021 19:03:16 -0400 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1618614169; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zYsmczDUOwFiI2C1OqNRUIH5SZiNDmStN6eTeuq1zKQ=; b=unUul3QAQ0muFW7kvtT9Noo2VD3wluum0qlZXQtmRhJg8EhiZGpWVH4f09Tnga6lPKJeOK N1owE63QqorRqKKhR3IKyz8Sdjf0mtNR4lmzAMZLWE6DAKH0GfyXFfLiQ7a400h1nuFysM UBxwEeXvEX5JFWHmaFPAJ5g8Yytf20WLeLZVYabjAlCZnyeozYagC0d05kjh/G1WaBi8Wl 5UPzx3vawkEQwr74v78kgLrP+5Dbch+hqkpBYPuvVnHAonSsvachHKnmRnRr869KyoGpGH dlP0V2hHkVEz6rx05WariVZC3XNyHIsJIX2MhoJ+t0FmANbGao5sGaiuDzo2ZA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1618614169; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zYsmczDUOwFiI2C1OqNRUIH5SZiNDmStN6eTeuq1zKQ=; b=7henxW8UxJAPgENWbfxYcRSU76wF4NsVoNTZq9xprkuWjOv6OPIbRO2o05VCYhDWZygJwr pZsVaaSlXf4AKTCQ== To: Kees Cook , Andy Lutomirski Cc: Borislav Petkov , Sami Tolvanen , X86 ML , Josh Poimboeuf , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , Sedat Dilek , linux-hardening@vger.kernel.org, LKML , clang-built-linux Subject: Re: [PATCH 05/15] x86: Implement function_nocfi In-Reply-To: <202104161529.D9F98DA994@keescook> References: <20210416203844.3803177-1-samitolvanen@google.com> <20210416203844.3803177-6-samitolvanen@google.com> <20210416211855.GD22348@zn.tnic> <20210416220251.GE22348@zn.tnic> <20210416221414.GF22348@zn.tnic> <202104161529.D9F98DA994@keescook> Date: Sat, 17 Apr 2021 01:02:49 +0200 Message-ID: <87fszpu92e.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 16 2021 at 15:37, Kees Cook wrote: > On Fri, Apr 16, 2021 at 03:20:17PM -0700, Andy Lutomirski wrote: >> But obviously there is code that needs real function pointers. How >> about making this a first-class feature, or at least hacking around it >> more cleanly. For example, what does this do: >> >> char entry_whatever[]; >> wrmsrl(..., (unsigned long)entry_whatever); > > This is just casting. It'll still resolve to the jump table entry. > >> or, alternatively, >> >> extern void func() __attribute__((nocfi)); > > __nocfi says func() should not perform checking of correct jump table > membership for indirect calls. > > But we don't want a global marking for a function to be ignored by CFI; > we don't want functions to escape CFI -- we want specific _users_ to > either not check CFI for indirect calls (__nocfi) or we want specific > passed addresses to avoid going through the jump table > (function_nocfi()). And that's why you mark entire files to be exempt without any rationale why it makes sense. Thanks, tglx