From nobody Fri May 17 09:38:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1707301927; cv=none; d=zohomail.com; s=zohoarc; b=ElD0BWPXPXWTDzXyeTKc8F2nQw1wQ8/wtnIvGXF+gQ2YK2+BLZxinC1zvKxxe0Dkv1oecKCNAkBRgcDE/3v7xxrb9q14YJQ+n+QgwnIfYYRjfSzhrAhIgri6J6BBjpPJR0F7utL9Iu5+uGKqvBQIJUG8pjCcE2Zj0RfEefzpGuY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707301927; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZgvFN9fVJULnhlM4tZSu8boApfM5Dt//TBSdSqybRdM=; b=az4EHQfKERF80pEsOLWaTSbMYYWREIN/7i8duJh3yTYUpycFm9mmU1JyuZinyjYi79m3SQun/VJmNaiKoUudze1mqK5C1CyAq8WctpKVCP9JfuywyB+Byg1nYIOF+6TxNB+8fK0D1+kbtHY4pz6F5B+ddzP0rkQEwtMJ4+nJarE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1707301927253260.97596509871596; Wed, 7 Feb 2024 02:32:07 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.677334.1053872 (Exim 4.92) (envelope-from ) id 1rXfDV-00080r-00; Wed, 07 Feb 2024 10:31:45 +0000 Received: by outflank-mailman (output) from mailman id 677334.1053872; Wed, 07 Feb 2024 10:31:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rXfDU-00080j-Rz; Wed, 07 Feb 2024 10:31:44 +0000 Received: by outflank-mailman (input) for mailman id 677334; Wed, 07 Feb 2024 10:31:43 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rXfDT-00080F-LQ for xen-devel@lists.xenproject.org; Wed, 07 Feb 2024 10:31:43 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 153b89b5-c5a4-11ee-8a49-1f161083a0e0; Wed, 07 Feb 2024 11:31:42 +0100 (CET) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 46571221B0; Wed, 7 Feb 2024 10:31:41 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 14E2713931; Wed, 7 Feb 2024 10:31:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id L2aXAw1cw2UvYgAAD6G6ig (envelope-from ); Wed, 07 Feb 2024 10:31:41 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: 153b89b5-c5a4-11ee-8a49-1f161083a0e0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1707301901; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ZgvFN9fVJULnhlM4tZSu8boApfM5Dt//TBSdSqybRdM=; b=CxfSExGkqXhwo/r8W57pEtsbznbIa/qSIvY81eSuXUNEMn1ZU3uc5RqII/HX8ifUJ0yB4D yF+bdRxpbRYgTlge0v44vIpf2xgyjb4yV57RYN2z5fa6MCDnsqerL3LVJgo/NNSr+etNY6 U6MQsUeWDUNnuY2jsVFmxhhFy/Xfu/4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1707301901; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ZgvFN9fVJULnhlM4tZSu8boApfM5Dt//TBSdSqybRdM=; b=CxfSExGkqXhwo/r8W57pEtsbznbIa/qSIvY81eSuXUNEMn1ZU3uc5RqII/HX8ifUJ0yB4D yF+bdRxpbRYgTlge0v44vIpf2xgyjb4yV57RYN2z5fa6MCDnsqerL3LVJgo/NNSr+etNY6 U6MQsUeWDUNnuY2jsVFmxhhFy/Xfu/4= From: Juergen Gross To: minios-devel@lists.xenproject.org, xen-devel@lists.xenproject.org Cc: samuel.thibault@ens-lyon.org, wl@xen.org, Juergen Gross Subject: [PATCH] Mini-OS: x86: zero out .bss segment at boot Date: Wed, 7 Feb 2024 11:31:38 +0100 Message-Id: <20240207103138.26901-1-jgross@suse.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.com header.s=susede1 header.b=CxfSExGk X-Spamd-Result: default: False [2.69 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[suse.com:s=susede1]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; DWL_DNSWL_MED(-2.00)[suse.com:dkim]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; DKIM_TRACE(0.00)[suse.com:+]; MX_GOOD(-0.01)[]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:dkim,suse.com:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[] X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Score: 2.69 X-Rspamd-Queue-Id: 46571221B0 X-Spam-Level: ** X-Spam-Flag: NO X-Spamd-Bar: ++ X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1707301928528100001 Content-Type: text/plain; charset="utf-8" The .bss segment should be zeroed at very early boot. While adding the extern declaration of __bss_start for x86, make it together with the other linker table defined section boundaries common for all architectures. Signed-off-by: Juergen Gross --- arch/x86/setup.c | 2 ++ include/arm/arch_mm.h | 1 - include/mm.h | 2 ++ include/x86/arch_mm.h | 1 - 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/setup.c b/arch/x86/setup.c index b27bbed7..3dddf4ad 100644 --- a/arch/x86/setup.c +++ b/arch/x86/setup.c @@ -184,6 +184,8 @@ arch_init(void *par) { static char hello[] =3D "Bootstrapping...\n"; =20 + memset(&__bss_start, 0, &_end - &__bss_start); + hpc_init(); (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(hello), hello); =20 diff --git a/include/arm/arch_mm.h b/include/arm/arch_mm.h index 79d9e05b..335eb4ff 100644 --- a/include/arm/arch_mm.h +++ b/include/arm/arch_mm.h @@ -3,7 +3,6 @@ =20 typedef uint64_t paddr_t; =20 -extern char _text, _etext, _erodata, _edata, _end, __bss_start; extern int _boot_stack[]; extern int _boot_stack_end[]; extern uint32_t physical_address_offset; /* Add this to a virtual address = to get the physical address (wraps at 4GB) */ diff --git a/include/mm.h b/include/mm.h index 4fc364ff..e02e080b 100644 --- a/include/mm.h +++ b/include/mm.h @@ -46,6 +46,8 @@ #define round_pgdown(_p) ((_p) & PAGE_MASK) #define round_pgup(_p) (((_p) + (PAGE_SIZE - 1)) & PAGE_MASK) =20 +extern char _text, _etext, _erodata, _edata, _end, __bss_start; + extern unsigned long nr_free_pages; =20 extern unsigned long *mm_alloc_bitmap; diff --git a/include/x86/arch_mm.h b/include/x86/arch_mm.h index a1b975dc..6b398cef 100644 --- a/include/x86/arch_mm.h +++ b/include/x86/arch_mm.h @@ -225,7 +225,6 @@ extern unsigned long *phys_to_machine_mapping; #else extern pgentry_t page_table_base[]; #endif -extern char _text, _etext, _erodata, _edata, _end; extern unsigned long mfn_zero; static __inline__ maddr_t phys_to_machine(paddr_t phys) { --=20 2.35.3