[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] arm/xen: zero init memory region before returning to the heap


  • To: Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Wed, 12 Nov 2025 08:30:37 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 4.158.2.129) smtp.rcpttodomain=epam.com smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=A/rSRZyPrz26OL8ssugMf6l3FFTzeAKS/w/k9327CUA=; b=t1utpVmT3lKTT/Vpn1s6R/EXV1fJEWbcyI8wdQ280448TT7qM9I5ept/a0LZ95Qm9Kog+i39UJxPy6PmpLvEy4OQMdveZsboLJD89YZD/O9LUpIPRioLp86a+OcwbmrskIJiy+wNCJOIc2x1cYJt5TAo4BQwsaEXNt+nvyXq62n/uYQncqeBlgE5GkPl72IvdpH6W/JN6rBf/Ezt4mla+4bbgNGZb3Tlb9PP6Zqu8Ouvom+YBKtvgT9kaRfuNgZFOyEKCjTdDGf7wsohC6Rl83+RYEtFK61WgqUPyuz6XiUngtNnI9QimiLCyK+XkVowBQXvTnuKUzuMSa7NKwykyw==
  • 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=A/rSRZyPrz26OL8ssugMf6l3FFTzeAKS/w/k9327CUA=; b=nan2fL3EQZeuzGiGWBgmE6CsWl0hJbg2Db0+YDdVI52ZKScqWzBxsU0B2cRYwlif8+iOy3/VIxd/BKTawf51jYo+UyFT9l3YiDzHU34FUuJA+9OH2FCKiVaw9f4wh6qa2wun0iVJtSZzVax0Ix2s1cmZ83ITeaFCVjq4h6mFQxkPO6J6W4STbH1z4sTIHsyrdbiUJUV1smHr8Fh/M/Bv42mw+4ULkvjiB+snH2sSeikDg2G2ODW8SK0oerYINebmIbP7qoQpnmXRNMlI7bqfzVW2BGqbCXtJcRS1AgphU97/Nr/FpGQI7EVyzWaDMomlB/7PWZmPip+Wan1L1P4RMg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=bpF+eKUeqjT9AHeADAo7m674hwZdv9/3BOEjX/K0DpoJsZuUv+QzI8M4/bzfg4/uj9Qq1zabEgmcZwljWwlmJR21+lOGA69zj836IGcfwdi6k9KPWnwATCjWQTaKqdf3t41sMJQM2ELycBxLjHL4INwVawfbyjG3p+OoVlzQcKc0LSZoDuxl2BZCQrK9BzBqVAp95ryxzJkStTkjsHQGQxOK/8in/7328vaKGe+3XOP6F0bz+U85i1M7LU/NgEMqnWTYYfB0RCpseBuxfU1M4G09XtgB24CTD8qqUMG46phs4efmotDp/Wx2+IeZ7Fj5UrMbFnQ2kVJPsEkTC9Hx4A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=NNlckOIblKdaV+qJpn1BG6kKP9up/8IywTRtw5YC6wb4N8CwaMK/K/s6+pGc6uGcj0biFy121whVXH5LjwJUKPs8II+pD2qgWbtdT3rNnS/3CIo6arF9QzRdtE+icFZFLj2RNfDzyhwaKgf+jxVHTBUZSLR4drNSIf2P1FJwsn0JOmeUgJAJ9iitemyepTkMpuUoYysQsFJsoXYtnYhm57vCso1Th6BpBAPEMTe42hQWSmcLr4EgsefuFxp4FwxOSuRcJIIb7V9NO7Tm2CS1ihGsRx/PxYhmi9yrI1MEk0NBZZYOtSIhFuML25tDDCaRmiTAzA/FUD2dm3qilw6cPA==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 12 Nov 2025 08:31:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Thread-index: AQHcSn+3Bvk2A/mifU6ZI0j7ZDmNtLTuyBqA
  • Thread-topic: [PATCH v2] arm/xen: zero init memory region before returning to the heap

Hi Dmytro,

> On 31 Oct 2025, at 16:02, Dmytro Prokopchuk1 <dmytro_prokopchuk1@xxxxxxxx> 
> wrote:
> 
> The current implementation of 'free_init_memory()' fills the freed '__init'
> and '__initdata' memory regions with a faulting instruction before unmapping
> and returning them to the heap. However, after unmapping, any access to this
> region will result in a page fault, making the instruction fill redundant.
> 
> Replace the instruction fill with a call to 'memset()', zeroing the entire
> region before it is unmapped and returned to the allocator.
> 
> Additionally, this change resolves a violation of MISRA C:2012 Rule 11.3
> (cast between pointer to object type and pointer to a different object type),
> caused by performing a cast from a 'char *' to a 'uint32_t *' pointer to
> write instructions directly into memory, which is not compliant with MISRA
> guidelines.
> 
> No functional changes.
> 
> Signed-off-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
> Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
> ---

Looks good to me, I’ve also tested on Arm64 and Arm32 qemu.

Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx>
Tested-by: Luca Fancellu <luca.fancellu@xxxxxxx>

Cheers,
Luca


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.