Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3744947pxb; Wed, 13 Oct 2021 12:03:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7x+1Vk0RtWMzlFRF85+9Hibw9d9UtJpHTPM7L30svhCX1RZTGIW6YYzgmCxII4qcRy8Pk X-Received: by 2002:a17:90a:1507:: with SMTP id l7mr1118939pja.141.1634151836663; Wed, 13 Oct 2021 12:03:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634151836; cv=none; d=google.com; s=arc-20160816; b=ZjP928l4BWI8YJKYKM7H9cStL232V6Pe4/eujabq+KqYbpd8BotkFeJIxsaV+SOGSZ c3t0PewdmJRGN8kcuUmx91klw+dpVSJxy3vGjDZJf731f6/+VC4io449hIaokKMe8w9C 3Bj9FD4/XT0Ij6qsqvypyKsuLcC0uQwayzVMd7TD+1cS57grb0IJXsC0SBckDQm5ScvZ sXnM5fhZ1KnEnC9DMmPD1n5HN8LW+g+4GkFjyghGwIc3eq9unFXov7YngMG9eucg75/W XrJl4u+nSaIfBkt0ZhPKI7Lsnn8tE2ytl9ffTTuoh18k5L+PlT6VM2s4Vog/aEORfBw2 f6UA== 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=XYUZdSbtY3yILKq30armlw/nLFSTpxD7xzR0LPRYz80=; b=uXRk/sVsBVwKO+40FybJICYbcB9dzItUkuZOGcpe5B6RMmp5mHcbbrEGnHv4r1Hd31 eW2VEDmGimaw7Qj9oIBQ1GkiUUZoA9aNOfqkKE5aL4m4qVctK4jdeJnuG4ijXcijFVqc HBLRQSJKE1sgCGc0lmEMhnKW9GhITZA65XPSqfbYaHCuF/qhXvHblBtSE22Kzd79PrYK Miv6W5Py2VQSH/yMa/A+1AsPv+3xuZanV3GH9mP6G/SZZddllqBgf69TYLfUCPIY8yDE W5Zfx1cYhTChsxHXKWWb7R2Lv4rFWF/rPIB+ddP+aG2/ON1a+CyDRXtqYaUNjwL5zpro nV1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gpYKK9FH; 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 o9si621817pfe.322.2021.10.13.12.03.37; Wed, 13 Oct 2021 12:03:56 -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=gpYKK9FH; 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 S231263AbhJMTEU (ORCPT + 99 others); Wed, 13 Oct 2021 15:04:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234061AbhJMTET (ORCPT ); Wed, 13 Oct 2021 15:04:19 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D568C061570 for ; Wed, 13 Oct 2021 12:02:16 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id g5so2491816plg.1 for ; Wed, 13 Oct 2021 12:02:16 -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=XYUZdSbtY3yILKq30armlw/nLFSTpxD7xzR0LPRYz80=; b=gpYKK9FHVxBdFJtwWQViBwA6f8A8yxtHj5zqNEzFZ+S0843PtoWAyD5MADhc+CKcZ4 5ngK1kdS6dIScpdJWiiYbns6hn+I0/aa3zc8aYsrcaVwjDK/PyNeqgmgGZSw1ruKlLVJ KmTGnrOq0PccZ2Svs/+X9fiN4LSaKncO8PW8U= 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=XYUZdSbtY3yILKq30armlw/nLFSTpxD7xzR0LPRYz80=; b=AyhpZKH7AHM+1U1zgVbiwSuRcNRIWHFmhedSzv8quA1+L/ukW3QV4/AxDi8QNoe2U8 2Aw3zTmR7EB+C3eBMmtF8Q2uDUsBWdiCv5lkpYvW+wbEgt1t5nPVrmXvuH4EETCPqh1r vtrUs+AES4fanEFov/69ynV/GtaO+H0+EAsGw+WF5bxmHqG+u65KAsLjTBnmlrVEIILe 8PiMGOnbD1MzblVlR09TaJI9SaM4vpgMXMRCWurBJeuGhF96RTXKGer0G4H5WZNJ38cJ CDYnvd7qPDm+frqlu6/pbTLZch7l+80MrrA5LVD/065t+YI1ipwYA+b08HVc8d40AGbe fxyA== X-Gm-Message-State: AOAM532S4qG6hDOPI+AHXedArvx9y7G30blspWMxg0fvzAyPQrN3JT2P dMHYsq8cToJI5j7sX/Hmkn/bsBuTCCCcLw== X-Received: by 2002:a17:90a:1548:: with SMTP id y8mr15961214pja.151.1634151735724; Wed, 13 Oct 2021 12:02:15 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id d138sm251374pfd.74.2021.10.13.12.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Oct 2021 12:02:15 -0700 (PDT) Date: Wed, 13 Oct 2021 12:02:14 -0700 From: Kees Cook To: Sami Tolvanen Cc: x86@kernel.org, Josh Poimboeuf , Peter Zijlstra , Nathan Chancellor , Nick Desaulniers , Sedat Dilek , Steven Rostedt , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: Re: [PATCH v5 04/15] cfi: Add DEFINE_CFI_IMMEDIATE_RETURN_STUB Message-ID: <202110131200.5D551C2D@keescook> References: <20211013181658.1020262-1-samitolvanen@google.com> <20211013181658.1020262-5-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211013181658.1020262-5-samitolvanen@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 13, 2021 at 11:16:47AM -0700, Sami Tolvanen wrote: > This change introduces the DEFINE_CFI_IMMEDIATE_RETURN_STUB macro, > which defines a stub function that immediately returns and when > defined in the core kernel, always passes indirect call checking > with CONFIG_CFI_CLANG. Note that this macro should only be used when > a stub cannot be called using the correct function type. > > Signed-off-by: Sami Tolvanen I remain a bit worried about this exception infrastructure, but it's the best way forward right now. One thought: add DEFINE_CFI_IMMEDIATE_RETURN_STUB (and maybe other things to watch closely) to MAINTAINERS: diff --git a/MAINTAINERS b/MAINTAINERS index abdcbcfef73d..2c9a24fd6a3c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4553,6 +4553,7 @@ B: https://github.com/ClangBuiltLinux/linux/issues T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/clang/features F: include/linux/cfi.h F: kernel/cfi.c +K: \bDEFINE_CFI_IMMEDIATE_RETURN_STUB\b CLEANCACHE API M: Konrad Rzeszutek Wilk Reviewed-by: Kees Cook -- Kees Cook