From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754065AbcBZNv7 (ORCPT ); Fri, 26 Feb 2016 08:51:59 -0500 Received: from userp1040.oracle.com ([156.151.31.81]:27922 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752046AbcBZNv6 (ORCPT ); Fri, 26 Feb 2016 08:51:58 -0500 Subject: Re: [Xen-devel] [PATCH v3 0/2] Clear .bss for VP guests To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , konrad.wilk@oracle.com, david.vrabel@citrix.com References: <1456413395-7679-1-git-send-email-boris.ostrovsky@oracle.com> <56D02EAA.4090200@citrix.com> Cc: andrew.cooper3@citrix.com, linux-kernel@vger.kernel.org, mcgrof@kernel.org, brgerst@gmail.com, xen-devel@lists.xenproject.org From: Boris Ostrovsky Message-ID: <56D0587C.7080607@oracle.com> Date: Fri, 26 Feb 2016 08:51:56 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <56D02EAA.4090200@citrix.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/26/2016 05:53 AM, Roger Pau Monné wrote: > El 25/2/16 a les 16:16, Boris Ostrovsky ha escrit: >> PV guests need to have their .bss zeroed out since it is not guaranteed >> to be cleared by Xen's domain builder > I guess I'm missing something, but elf_load_image (in libelf-loader.c) > seems to be able to clear segments (it will zero the memory between > p_paddr + p_filesz and p_paddr + p_memsz) while loading the ELF into > memory, so if the program headers are correctly setup the .bss should be > zeroed out AFAICT. Right, but I don't think this is guaranteed. It's uninitialized data so in principle it can be anything. The ELF spec says "the system initializes the data with zero when the program begins to run" which I read as it's up to runtime and not the loader to do so. And since kernel does it explicitly on baremetal path I think it's a good idea for PV to do the same. -boris