Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3747800pxb; Wed, 13 Oct 2021 12:06:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYHgQAhgWrzYTY7RYwY32O/b0koPkcpJEymvXYLJTOxLUPGfXxuoHD/JF4DtLEGOeQ+KBv X-Received: by 2002:a17:90b:3ecd:: with SMTP id rm13mr1147414pjb.189.1634152016053; Wed, 13 Oct 2021 12:06:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634152016; cv=none; d=google.com; s=arc-20160816; b=Ypz6O7bzf2h8HM7eav4kj1Igxic0kCVzenEek2pxdv/rukrB2d6XaiSv/+q6cvLXkt dZhtS7J0WD4TV52DqioFYaVb8ykZfqOAoqytZOyhefudM1bTnOdKh53l+4LHVNs8mOW6 w2yDbNGfP99scMiIUYMZntOBrpiqcR677SpBU//R3hekx+qjwR5oN1oOZ4BOETTcCPtt I8HRveFmO/dKCYBasMDzuFg1E6ervO6NYbnYSZTu8jM3Yc1IWu2vLz5d7+WCluv0lbx1 gTq7TEa/9i32AyFF5lKlKB1AuJOmpU4KNfWQ/TyYxUbslbW9x8Y3MfTPLxANQS26MxPI w/4w== 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=iv6F8EdUVptzUcmUANbF0d3VY4H4nepm9NcMDwb+Q2M=; b=COe2IEF+2bP886LV6H4lRjxJLnc8ymyOulqFgiGhaSlf2N3rGJDJA/99bygsK7T1e4 zHYxcV70mJrET7dnSlxjiXy6cB6umFTYhHCiODOp9pvhZzPerbuP40VIEnyK6UmiKP1s EL839byd8EYp0FJUusehEE3hrcxeiogKlkITzT2xLg8sxVPZt6NgBZkK8U+WiSssSmtc fxkqvmUsTX+T+43izAuqvspFMFeoUCBm0SkfFKATmxTiQfoQsTD4BFIr7JZ6Im8o+ENj lVFiW0hZ45rLNflAegIf+pULB/jQWWGYN36GV+nraNLMhtP56wHFJiw5CPVzR3e27KEV bNCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=QCqvZgQS; 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 w185si504954pfb.365.2021.10.13.12.06.42; Wed, 13 Oct 2021 12:06: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=QCqvZgQS; 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 S233182AbhJMTF3 (ORCPT + 99 others); Wed, 13 Oct 2021 15:05:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231563AbhJMTF2 (ORCPT ); Wed, 13 Oct 2021 15:05:28 -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 11E30C061746 for ; Wed, 13 Oct 2021 12:03:25 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id 21so2453099plo.13 for ; Wed, 13 Oct 2021 12:03:25 -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=iv6F8EdUVptzUcmUANbF0d3VY4H4nepm9NcMDwb+Q2M=; b=QCqvZgQSjJeThpfGG6mDINdKSxpEJde0lHGEs529BoaLFmGKSSa9/BwOze1gFeBrkc lLVjTB5wROe00bVWuz94F+yf4Q8zhyBUKuijtUfRhp8lL91hUJWMFemYgH97mMeJfU8D HnOrgKGJr4OybKcAM1oP7lCM7jrqjiU6yWgkI= 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=iv6F8EdUVptzUcmUANbF0d3VY4H4nepm9NcMDwb+Q2M=; b=MekejZUWqVhQDPvpGZzUIyh1E//HXcXLNh8Baabizub7ipaMXndQTfK83Sc5hgJXDg tuz0t2SVuWoYTdRjd9Hfhw7KCTt0/ncrFAWIN8VXq1SGIjffljC4jFsBNw+HgPrGRQNw p0a+6ieU7sEi2IiNRbBS4ipQVxhp/NmzR0RwpqHIv2vANPWXP9XTSqtllFT0JHf2KzsY hy5kMLqdPYOp3+/vdHlQv/XfbplcoHrO1rm0hmlIZHX3/XXn3HksZyQjvHjS5lhHFOn3 Iw4LQFM4RyblmUhs2xorLz9p79ITsVTXTsCte/zPeTNkYi8YfwJL7OMzvl/90H5ioKOp cgCg== X-Gm-Message-State: AOAM532rHnSvwnMDO96Ux5jdC7QXID1qsuKDu4coCUkH9bI3PsdQZ0R3 KKEqBnpdjLQ3jenzpKkpjEDkcoIepT4= X-Received: by 2002:a17:902:c409:b0:13f:1a43:c5c with SMTP id k9-20020a170902c40900b0013f1a430c5cmr931113plk.40.1634151804483; Wed, 13 Oct 2021 12:03:24 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id i13sm7143151pjh.0.2021.10.13.12.03.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Oct 2021 12:03:24 -0700 (PDT) Date: Wed, 13 Oct 2021 12:03:23 -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 05/15] tracepoint: Exclude tp_stub_func from CFI checking Message-ID: <202110131203.78C3851CA9@keescook> References: <20211013181658.1020262-1-samitolvanen@google.com> <20211013181658.1020262-6-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211013181658.1020262-6-samitolvanen@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 13, 2021 at 11:16:48AM -0700, Sami Tolvanen wrote: > If allocate_probes fails, func_remove replaces the old function > with a pointer to tp_stub_func, which is called using a mismatching > function pointer that will always trip indirect call checks with > CONFIG_CFI_CLANG. Use DEFINE_CFI_IMMEDATE_RETURN_STUB to define > tp_stub_func to allow it to pass CFI checking. > > Signed-off-by: Sami Tolvanen Reviewed-by: Kees Cook -- Kees Cook