Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1861647pxb; Sun, 18 Apr 2021 09:18:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6qHh/fedqRy/R8Jr/UOACFG3mFJA9g0hA9gIZYDYbDryKt9Ck+olKPTEuVj+OQjSKvOCO X-Received: by 2002:a17:90a:f303:: with SMTP id ca3mr12449545pjb.145.1618762733923; Sun, 18 Apr 2021 09:18:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618762733; cv=none; d=google.com; s=arc-20160816; b=WS2zQyHpBRpKIV8vgkpY4fK/xA5pkSA34O7LeiE+OsQf5YQwCvtPExm+zm4ACETs/c WQUs7pNsVMaZMqlUaKpGtKfAP4zQdPH1w3MozEnNLyjSMXAwhyCQQPmAx6H9lwH3Hp8v TlFM58u5jkXxL1rcYsnrdJe25a3o8j4fIAmprf1RhcwBYIK58qxRTUOVf+woaD31UM3Q s1rWz5yuuRJjatnl7DMeQ8Ln5nlQFx8Iix0zApINgeGivpvc5tflGQxWO02VoxGWXpvv 9DtckKByhA7Y6oZtg1lik2ArU6O/WwurijcoDR1QM445WG0INmnoPa82f3dPEF8tPbUN 9S+w== 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=Ei/Yss7OFKyCWpzQUujDkbmPdYqeOzmRTpmtbyzHOFs=; b=Bl7A5ZZdL+AGLoP5xxQR5II6XjRdx3stA6h/vp4fRNW6isrGtA0/+GVG1ilooD8DhY 2Yw72iFeIfAGfnwGblq7ywYufG56/fKJ2VdVyPn9o5E/WKvPYpodEuOi7uQIDJRqCiua 096ZkePw+IZOGqaIMc1y7yZSYx1NRD9GAWPGqqTQfr+f1AbnSSePr+guHfJhlAFLwXfh YrvynkyZ3asjr6EHym3t9a/Ph1JLPb4R77Tjk1NgNi5YCG0QmNhdVm6urobhkDmcJ7A5 ubK9gQcud6zcO7HyTT0w0j3q56bnZ6uAcPpA7p7UjalHawx2vYHvrBbYl05PJ07EDvXo z6EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=rjgvKYr9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=ZHc1LZMd; 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 y187si3840316pfb.77.2021.04.18.09.18.21; Sun, 18 Apr 2021 09:18:53 -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=rjgvKYr9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=ZHc1LZMd; 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 S231820AbhDRQRi (ORCPT + 99 others); Sun, 18 Apr 2021 12:17:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231368AbhDRQRh (ORCPT ); Sun, 18 Apr 2021 12:17:37 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8FC0C06174A; Sun, 18 Apr 2021 09:17:09 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1618762627; 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=Ei/Yss7OFKyCWpzQUujDkbmPdYqeOzmRTpmtbyzHOFs=; b=rjgvKYr9h78j1MuB5D/+W6idRHFi77UwZew2dozCKWJV2YAydjXGvLWoCYijq05UxWD19D q8xszVkvx1JZAE6F1EAvVkoBkq8m6aMft64Mu/4gG2lVCi/dsNKINs20W/RnFgPs+g+YxP e7tImWSrNQfXo4BNdY6fH5q8J5/CzbyhmfcAJOckU+can1rXgB4gGKKsRutqAiAzFwC52l wLXeIvKZa475luTNjDoAyD7RQj4+b4J51A3rCvGpd8MSA/jOCvhRFjqz8V3Q2u7j1GjLI8 zzb3ReAs3zoCfBgnKZA5g+mZtKRwFKGZvvMRY3Fxp4CO4NCEM3u/E+eajoM2YA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1618762627; 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=Ei/Yss7OFKyCWpzQUujDkbmPdYqeOzmRTpmtbyzHOFs=; b=ZHc1LZMdaSerWD1GG9gYwNALAQtKzJ47jKGIhNNW3iT/6ExK7HuXCCLi5M4MDn6MukLt7w K4QBzPu1Ykvgy0Dg== To: Andy Lutomirski Cc: Andy Lutomirski , Kees Cook , David Laight , 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: References: <20210416203844.3803177-1-samitolvanen@google.com> <20210416203844.3803177-6-samitolvanen@google.com> <20210416211855.GD22348@zn.tnic> <20210416220251.GE22348@zn.tnic> <202104161519.1D37B6D26@keescook> <202104161601.CFB2CCF84F@keescook> <877dl0sc2m.ffs@nanos.tec.linutronix.de> Date: Sun, 18 Apr 2021 18:17:06 +0200 Message-ID: <871rb7sh31.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 Sat, Apr 17 2021 at 17:11, Andy Lutomirski wrote: > On Sat, Apr 17, 2021 at 4:53 PM Thomas Gleixner wrote: >> which works for >> >> foo = function_nocfi(bar); > > I agree in general. But right now, we have, in asm/proto.h: > > void entry_SYSCALL_64(void); > > and that's pure nonsense. Depending on your point of view, > entry_SYSCALL_64 is a symbol that resolves to an integer or it's an > array of bytes containing instructions, but it is most definitely not > a function void (void). So, regardless of any CFI stuff, I propose > that we standardize our handling of prototypes of symbols that are > opaque to the C compiler. Here are a couple of choices: > > Easy one: > > extern u8 entry_SYSCALL_64[]; > > Slightly more complicated: > > struct opaque_symbol; > extern struct opaque_symbol entry_SYSCALL_64; > > The opaque_symbol variant avoids any possible confusion over the weird > status of arrays in C, and it's hard to misuse, since struct > opaque_symbol is an incomplete type. Makes sense.