From patchwork Wed Apr 17 23:53:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuxuan Luo X-Patchwork-Id: 1924768 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VKd6l6Tzqz1ymh for ; Thu, 18 Apr 2024 09:54:23 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rxF6V-0005hy-Rf; Wed, 17 Apr 2024 23:54:15 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rxF6Q-0005gF-Em for kernel-team@lists.ubuntu.com; Wed, 17 Apr 2024 23:54:10 +0000 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 96E5D3F36F for ; Wed, 17 Apr 2024 23:54:09 +0000 (UTC) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-78eeb60e1fbso45907785a.1 for ; Wed, 17 Apr 2024 16:54:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713398047; x=1714002847; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KY2t8LZLdbeY78hKtny4R/SGHOVUhMzN1WkBksHmCOU=; b=TxafIsEoTs1mOKiQ4Yo+td0bMc+lOmeD6gqdoS+5XbWXX7hZJ1GANltTDZXfhyTyBt 51WgUlbuwdQXRb0wXIGOtLuPUFWTSSB/5y0IZsE5MvpG5ZqK1dEsmEACgKSi1UXHr3fw 1S16KDwR4gslBpEACu8kPDq8/lKgcngIvU8TM5AVPDGnA3NjmVgoo6Ez6oiojRzjMHex wr2RodiHt/HGpwMaS9YWv61kS9QepvZhHNxrVplop4SfSrp9Nh5SVkpJQzM+8gXzQMXW rYs4qJqrHlN5jTSdjUH9mxzmLc1JNVBR7akPZZmwTtweVs8kWSQkttiAJjVITc3sqbHS +QRA== X-Gm-Message-State: AOJu0YzgPwxBxDyS/edHaBLle4O15jO34lxtlCjtXGE7XzNv3rnuhYCg vSE3n8un6GgwH1lCxlsIfa6N+nVYMVGQmTH5BOpToa4uwU7A15hhctuFTXpLPdrAWoAwY1gFsDC B7L2nCz/P1PijzR8wA6imJU4X3seQx5BOVpw98L8VAa+qs0cuN3bM+3xSISRxknGi+XK2I+M2rX +N8BX3fbxgaaLF X-Received: by 2002:ae9:e64a:0:b0:78e:f0d0:c974 with SMTP id x10-20020ae9e64a000000b0078ef0d0c974mr1040107qkl.32.1713398047687; Wed, 17 Apr 2024 16:54:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGEeP1huXCXU3Rof8u6hO04cOBSGCUoSEXQzcv2iKFRuGnqNe3qpeFhmAunad8klinaxCljtg== X-Received: by 2002:ae9:e64a:0:b0:78e:f0d0:c974 with SMTP id x10-20020ae9e64a000000b0078ef0d0c974mr1040094qkl.32.1713398047394; Wed, 17 Apr 2024 16:54:07 -0700 (PDT) Received: from cache-ubuntu.hsd1.nj.comcast.net ([2001:67c:1562:8007::aac:4795]) by smtp.gmail.com with ESMTPSA id x27-20020a05620a099b00b0078d6a0d5728sm129208qkx.29.2024.04.17.16.54.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 16:54:07 -0700 (PDT) From: Yuxuan Luo To: kernel-team@lists.ubuntu.com Subject: [PATCH 02/11] objtool: Only include valid definitions depending on source file type Date: Wed, 17 Apr 2024 19:53:52 -0400 Message-Id: <20240417235401.243631-3-yuxuan.luo@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240417235401.243631-1-yuxuan.luo@canonical.com> References: <20240417235401.243631-1-yuxuan.luo@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Julien Thierry Header include/linux/objtool.h contains both C and assembly definition that are visible regardless of the file including them. Place definition under conditional __ASSEMBLY__. Reviewed-by: Miroslav Benes Signed-off-by: Julien Thierry Signed-off-by: Josh Poimboeuf (cherry picked from commit 5567c6c39f3404e4492c18c0c1abff5556684f6e) CVE-2024-2201 Signed-off-by: Yuxuan Luo --- include/linux/frame.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/frame.h b/include/linux/frame.h index 303cda600e56a..d946adb5de178 100644 --- a/include/linux/frame.h +++ b/include/linux/frame.h @@ -3,6 +3,8 @@ #define _LINUX_FRAME_H #ifdef CONFIG_STACK_VALIDATION + +#ifndef __ASSEMBLY__ /* * This macro marks the given function's stack frame as "non-standard", which * tells objtool to ignore the function when doing stack metadata validation. @@ -15,6 +17,8 @@ static void __used __section(.discard.func_stack_frame_non_standard) \ *__func_stack_frame_non_standard_##func = func +#else /* __ASSEMBLY__ */ + /* * This macro indicates that the following intra-function call is valid. * Any non-annotated intra-function call will cause objtool to issue a warning. @@ -25,6 +29,8 @@ .long 999b; \ .popsection; +#endif /* __ASSEMBLY__ */ + #else /* !CONFIG_STACK_VALIDATION */ #define STACK_FRAME_NON_STANDARD(func)