From patchwork Tue Jan 14 04:25:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 13938394 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 800E7C02183 for ; Tue, 14 Jan 2025 04:26:27 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.870903.1281976 (Exim 4.92) (envelope-from ) id 1tXYVI-0007zw-81; Tue, 14 Jan 2025 04:26:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 870903.1281976; Tue, 14 Jan 2025 04:26:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tXYVI-0007z2-41; Tue, 14 Jan 2025 04:26:12 +0000 Received: by outflank-mailman (input) for mailman id 870903; Tue, 14 Jan 2025 04:26:11 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tXYVH-0007T1-O6 for xen-devel@lists.xenproject.org; Tue, 14 Jan 2025 04:26:11 +0000 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on20612.outbound.protection.outlook.com [2a01:111:f403:260e::612]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ae50ecf2-d22f-11ef-99a4-01e77a169b0f; Tue, 14 Jan 2025 05:26:10 +0100 (CET) Received: from GV1PR03MB10456.eurprd03.prod.outlook.com (2603:10a6:150:16a::21) by DB8PR03MB6300.eurprd03.prod.outlook.com (2603:10a6:10:13f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.12; Tue, 14 Jan 2025 04:25:58 +0000 Received: from GV1PR03MB10456.eurprd03.prod.outlook.com ([fe80::a41e:5aa8:e298:757e]) by GV1PR03MB10456.eurprd03.prod.outlook.com ([fe80::a41e:5aa8:e298:757e%3]) with mapi id 15.20.8335.015; Tue, 14 Jan 2025 04:25:58 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ae50ecf2-d22f-11ef-99a4-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CNXFYZv/i8RoY9DhK1A9DrY4pdXJC1Iapr7z3cc8RK2kZ2J3kPN50KDRnd3UW5VbxLVqDJF5DxIjxlgqrckFs61qOAbY3PFpCTIqyXZ6Jy0uy3pE7Vbs9VD3kIkjkqfgyDmNEM2AYXXalMQuuKtZaHCTSSePJhv0bSRrHFRKHCA2J3FXKZszxVrPvteXwFmi2dMT2aTESpaVENoHSGueuzM9bpobDWBy9jaegG3sMixrX+SdXq8I5r7gvVZAyFjeJWkVuZFLOA2FvIOUnFR5EQCFDACbE6nVTBKgj21mXi9xtrH9olZrkbTic9aZnVFD3YdjwWgxEDoieEY2uemWsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=F7CrkfKLq5jOHyUUc5QDVCpbIzJ4tC6vRwCVPj0QO1U=; b=LDR0TqthiVKH52S6P3gPieScKBeTAJLuS+swq+eSzT7mJeLrCkxZVK4aXmEbUl7ldnGY3zdfFo6tEZASPtL+DDq+PhDmsJuuypZH9+qBmT+NW7LaYLT6Ub5fUsV0QBaz6CEUy2eFh/QwZnUi2LcRi8UwA0KivmtipxwatO7OdZTShyVw8WKGOu2zuIrxD1eAN8X8aWvAFcov+41+n6Po9Khx0aqA/UZC9kXzAXctfPyfDIg3tKlHKtA2zAkOTUe86Ql9YS+orp+tFJNRcN3vOkDR4ZS6Y/OJ733kn3tj66b0yF8DIRFtIldBkkObqXFEgUgR6+syLrM5NdFXtYL9bA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F7CrkfKLq5jOHyUUc5QDVCpbIzJ4tC6vRwCVPj0QO1U=; b=Yn9+xYbbUUVHjoYYDr8g4znus83Mz4T5tf/U07jT5qWt4N5fk1665Ium68fQzpIoyNKvOTgxDaP28hPCcS3MDImyDlt4NvBM+ZBV7Z2Swtu8fmUlaaZA/qInRDfNVq+EyEBvc0VzudQpC+2xh7nuoniHwLzyMbxfK7c67MMooNzzqLRGiCqRy3nNOAsQkBJuQ1EZ7+xVjnkmuZ258/jmeoTf5E8zjzPCx5NJMawa1z2zC4qoGQi9tf2vdDmGElwgNyh5pQ278mjvZblMJuqoXmi/7b9/rM7kcqJSqf/NtbPnvpfqIXPrMukyctYt6RCmxZyCTpDVNdYU3IRMALb0ig== From: Volodymyr Babchuk To: "xen-devel@lists.xenproject.org" CC: Volodymyr Babchuk , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?iso-8859-1?q?Roger_Pau_Monn=E9?= , Stefano Stabellini , Samuel Thibault Subject: [PATCH v4 1/4] common: remove -fno-stack-protector from EMBEDDED_EXTRA_CFLAGS Thread-Topic: [PATCH v4 1/4] common: remove -fno-stack-protector from EMBEDDED_EXTRA_CFLAGS Thread-Index: AQHbZjxnmljcDXAlQke3Qcb/enjdIw== Date: Tue, 14 Jan 2025 04:25:56 +0000 Message-ID: <20250114042553.1624831-2-volodymyr_babchuk@epam.com> References: <20250114042553.1624831-1-volodymyr_babchuk@epam.com> In-Reply-To: <20250114042553.1624831-1-volodymyr_babchuk@epam.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.47.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: GV1PR03MB10456:EE_|DB8PR03MB6300:EE_ x-ms-office365-filtering-correlation-id: dc1d4bfe-8639-42de-07d5-08dd34538b89 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?+beGIrg/eSZhYUmXb9AHSpzeS0?= =?iso-8859-1?q?Sx9usP25oSeUHNwkRBHLBkJs9qCRscvK4+6Ba6NcKan/W4mQjc6GnS/gX17Z?= =?iso-8859-1?q?IuHx/Do6QhAB+rHyaCtUPw6nI1DLQIXuaj10RP0+LngF6IkhmoCw4Nv1f3aJ?= =?iso-8859-1?q?cpZMIpmNUxTO/AfGI70l66vc2Kou8FHgghsAqVj3gfohzR8UvmQueQbxtlaL?= =?iso-8859-1?q?0dMWiEctHCz9DqDCuRkOUd6btU50IfXICBI2lasIDtj8cbHF9G7s00WhcSjV?= =?iso-8859-1?q?sld2IL7nrtFvzULsiefnX2wUvFVZM5nQmSrXZDoFFqOWJO9wT28sBgetWRRR?= =?iso-8859-1?q?JgTO44j8rzHuj+i3iIt+cz8KjDVTCStyOqrU4qPXBTFqlHLp8TIenapkvOJx?= =?iso-8859-1?q?z6d5M9XnGx+ClY6AqmS9jtgUQz6Q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YauwalBMM?= =?iso-8859-1?q?Xyn7k5N4zagHJH506Bkd27cGEpkG3l/x7Wd/TeLPgsIcCHxYb3L+kV/VFoKU?= =?iso-8859-1?q?oS9sRMXIYjyYRLZIGHT76WbwSAuKlA33immx/GrHEAtX+8XgW9XG4afYassL?= =?iso-8859-1?q?JC6qGCisNg4zZWNnxMQ0FzVw=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR03MB10456.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?L5wvyISKyJDkP5EF9Dgmylb?= =?iso-8859-1?q?MPPeCpLh5QSGlutY8iOkAFzxpp9FWMIG/KL7p5f5egBQKlC3rWHoxaOqr4ni?= =?iso-8859-1?q?hPVv8beG+oX5fQ8bcRkAT4Ge/IJVHWWNBMwqqNN+JwFo/yqN+CVCp3hL+VsR?= =?iso-8859-1?q?5JVhZqe0DxkMfSbbXhnmDPQWN/2tiJQnYdhlknWUzQKWpQK/5m962wYBzkRn?= =?iso-8859-1?q?BXZsmhmt0/twcBlbspiI9Cs1/XZg408b/vBS3innEUKr2pyWdGg6H+uyKFst?= =?iso-8859-1?q?rBav2suUV3e+HfK2hQR1H7yuTVantBjNJl0U1WzHvI0qSl1eAr7JYPm8rD7O?= =?iso-8859-1?q?wYAsf5dvDAsMe7L8ZNYJyKTYjpvEvhP4/qItdBZlUhccxejAA2iTLvnUWVoS?= =?iso-8859-1?q?NP8wPvGj3sgsmscLbge+KvDa/b6vEb/S6yXjTHxuxdYjdbd8VvpFbMMQO/bf?= =?iso-8859-1?q?iU3KRJfnhRhlJYe1mxH2TkvMDzm9T7ys6f9bDU3b3LNl8A4v4nuDL+ie09ki?= =?iso-8859-1?q?nsmHmMkRID+yuMR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onJSfUo8+trICxl4JqL8wcTx+?= =?iso-8859-1?q?OsESg9xsnleHRT+Er/tjw3hgLtrunNdF+9nEwSfWeVaN4F5qvB8d8ILVH6st?= =?iso-8859-1?q?qYShRj+jfo+ZhB3t+pl1T+3YH93T5ufPD3nO+tYozFQE2xKW/WM2VwBrlwEn?= =?iso-8859-1?q?u9TL6LJ0jNdW73GHo+H95eJ3/napLoKbmvf3v4VWCC98zBUsL8/q+O3SKi6/?= =?iso-8859-1?q?Kdk2SeCdQtcgQk1jNclFM0Loz6BBkLVmWab25YQ=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: GV1PR03MB10456.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc1d4bfe-8639-42de-07d5-08dd34538b89 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2025 04:25:56.0171 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SGhmTuRTaWRYryxHSbYKorYCgpSz2uR2NhfXEYeZLtfCB0vw9DL5a9JxUu89Qi2/dFm0fA0nFPc85AdX2QK6rldFn5uWrcPU1CDq0ZQguec= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR03MB6300 This patch is preparation for making stack protector configurable. First step is to remove -fno-stack-protector flag from EMBEDDED_EXTRA_CFLAGS so separate components (Hypervisor in this case) can enable/disable this feature by themselves. Signed-off-by: Volodymyr Babchuk Reviewed-by: Jan Beulich --- Changes in v4: - Removed stray hunk - Added x86_32 CFLAG - Added Jan's R-b tag Changes in v3: - Reword commit message - Use CFLAGS += instead of cc-optios-add Changes in v2: - New in v2 --- Config.mk | 2 +- stubdom/Makefile | 2 ++ tools/firmware/Rules.mk | 2 ++ tools/tests/x86_emulator/testcase.mk | 2 +- xen/Makefile | 2 ++ xen/arch/x86/boot/Makefile | 1 + 6 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Config.mk b/Config.mk index 1eb6ed04fe..4dd4b50fdf 100644 --- a/Config.mk +++ b/Config.mk @@ -198,7 +198,7 @@ endif APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i)) APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i)) -EMBEDDED_EXTRA_CFLAGS := -fno-pie -fno-stack-protector +EMBEDDED_EXTRA_CFLAGS := -fno-pie EMBEDDED_EXTRA_CFLAGS += -fno-exceptions -fno-asynchronous-unwind-tables XEN_EXTFILES_URL ?= https://xenbits.xen.org/xen-extfiles diff --git a/stubdom/Makefile b/stubdom/Makefile index 2a81af28a1..9edcef6e99 100644 --- a/stubdom/Makefile +++ b/stubdom/Makefile @@ -14,6 +14,8 @@ export debug=y # Moved from config/StdGNU.mk CFLAGS += -O1 -fno-omit-frame-pointer +CFLAGS += -fno-stack-protector + ifeq (,$(findstring clean,$(MAKECMDGOALS))) ifeq ($(wildcard $(MINI_OS)/Config.mk),) $(error Please run 'make mini-os-dir' in top-level directory) diff --git a/tools/firmware/Rules.mk b/tools/firmware/Rules.mk index d3482c9ec4..be2692695d 100644 --- a/tools/firmware/Rules.mk +++ b/tools/firmware/Rules.mk @@ -11,6 +11,8 @@ ifneq ($(debug),y) CFLAGS += -DNDEBUG endif +CFLAGS += -fno-stack-protector + $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) $(call cc-option-add,CFLAGS,CC,-fcf-protection=none) diff --git a/tools/tests/x86_emulator/testcase.mk b/tools/tests/x86_emulator/testcase.mk index fc95e24589..7875b95d7c 100644 --- a/tools/tests/x86_emulator/testcase.mk +++ b/tools/tests/x86_emulator/testcase.mk @@ -4,7 +4,7 @@ include $(XEN_ROOT)/tools/Rules.mk $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) -CFLAGS += -fno-builtin -g0 $($(TESTCASE)-cflags) +CFLAGS += -fno-builtin -fno-stack-protector -g0 $($(TESTCASE)-cflags) LDFLAGS_DIRECT += $(shell { $(LD) -v --warn-rwx-segments; } >/dev/null 2>&1 && echo --no-warn-rwx-segments) diff --git a/xen/Makefile b/xen/Makefile index 65b460e2b4..a0c774ab7d 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -435,6 +435,8 @@ else CFLAGS_UBSAN := endif +CFLAGS += -fno-stack-protector + ifeq ($(CONFIG_LTO),y) CFLAGS += -flto LDFLAGS-$(CONFIG_CC_IS_CLANG) += -plugin LLVMgold.so diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile index d457876659..ff0d61d7ac 100644 --- a/xen/arch/x86/boot/Makefile +++ b/xen/arch/x86/boot/Makefile @@ -17,6 +17,7 @@ obj32 := $(addprefix $(obj)/,$(obj32)) CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS)) $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS)) CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3 +CFLAGS_x86_32 += -fno-stack-protector CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS)) CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__