From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-x22a.google.com (mail-it0-x22a.google.com [IPv6:2607:f8b0:4001:c0b::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E9EA182152 for ; Thu, 23 Feb 2017 14:29:00 -0800 (PST) Received: by mail-it0-x22a.google.com with SMTP id y135so2469081itc.1 for ; Thu, 23 Feb 2017 14:29:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=aud7s9vQMxLqnIIctQMRQenlzsKf1dp5CyNfPxJHono=; b=C1g4JhIeF+3olptYqp/F7mzZ40iCk/VEarg2Z0VOofiZyjkS2tBfeVv9gu6N44rixk X78HWobGgA4LuDzCOGEV7UoCsBTu0SSreCeNdILyRETA7S+hUM9q3yvkDZJSKD3AdC3t wVWW9CJSaXQnWADY3c2dlgynp2sWekEUwqnhY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=aud7s9vQMxLqnIIctQMRQenlzsKf1dp5CyNfPxJHono=; b=Ptq62ND6fPH21cVPhURfnf435mB8mK22BOWTvzMXOvtRbUZ9nieZ0ozkcGp4C5F8Km orHvLCB0WWF4gsQyvtO1Vjndxe5vobccDLLuggROyw778w8QwUgkDJvbPERH6wkPbIwQ BFl/t1P9f7o6oytPKs1KcfrvB9hrwAWW40bR1u7xYVKdBbwcAePhGUPpWp1ih0Xt85qz iEm8YB7Fq4Xe2tAvkog1Mq2QY6kyoEdwu6+icRK5nO/0GrC+KNAJLAuzcP29Dl72nYD3 t52xaWvWqzGdGXH9QGyDWlJbiX+rq6rDboAQu7NS9vdD6QL6s13WkPkL/YHk54DbPhg4 r+Gw== X-Gm-Message-State: AMke39nhXJFZRfLuSRhZ6Nt9E971xDq8k/dp4/4dQGlkUXUXzT37FyJNBmztvPmWOIYLXwwE4mpjCIJiB2PylTfY X-Received: by 10.36.74.67 with SMTP id k64mr4435888itb.37.1487888940262; Thu, 23 Feb 2017 14:29:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.198.134 with HTTP; Thu, 23 Feb 2017 14:28:59 -0800 (PST) In-Reply-To: References: <1487874651-19202-1-git-send-email-ard.biesheuvel@linaro.org> From: Ard Biesheuvel Date: Thu, 23 Feb 2017 22:28:59 +0000 Message-ID: To: Laszlo Ersek Cc: "edk2-devel@lists.01.org" , "Gao, Liming" , "Zhu, Yonghong" Subject: Re: [PATCH] BaseTools: GCC: move most AutoGen.obj contents back to .data section X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2017 22:29:01 -0000 Content-Type: text/plain; charset=UTF-8 On 23 February 2017 at 19:53, Laszlo Ersek wrote: > On 02/23/17 19:30, Ard Biesheuvel wrote: >> The generated AutoGen.c files mostly contain read-only data, but due to >> lacking annotations, all of it is emitted into the .data section by the >> compiler. >> >> Given that GUIDs are UEFI's gaffer tape, having writable GUIDs is a >> security hazard, and this was the main rationale for putting AutoGen.obj >> in the .text section. However, as it turns out, patchable PCDs are emitted >> there as well, which can legally be modified at runtime. >> >> So update the wildcard pattern to only match g...Guid sections, and move >> everything else back to .data (Note that this relies on -fdata-sections, >> without that option, everything is emitted into .data) >> >> Contributed-under: TianoCore Contribution Agreement 1.0 >> Signed-off-by: Ard Biesheuvel >> --- >> BaseTools/Scripts/GccBase.lds | 9 ++++++--- >> 1 file changed, 6 insertions(+), 3 deletions(-) >> >> diff --git a/BaseTools/Scripts/GccBase.lds b/BaseTools/Scripts/GccBase.lds >> index 900848747144..41e5c0b4a769 100644 >> --- a/BaseTools/Scripts/GccBase.lds >> +++ b/BaseTools/Scripts/GccBase.lds >> @@ -32,11 +32,14 @@ SECTIONS { >> *(.got .got.*) >> >> /* >> - * The contents of AutoGen.c files are constant from the POV of the program, >> - * but most of its contents end up in .data or .bss by default since few of >> + * The contents of AutoGen.c files are mostly constant from the POV of the >> + * program, but most of it ends up in .data or .bss by default since few of >> * the variable definitions that get emitted are declared as CONST. >> + * Unfortunately, we cannot pull it into the .text section entirely, since >> + * patchable PCDs are also emitted here, but we can at least move all of the >> + * emitted GUIDs here. >> */ >> - *:AutoGen.obj(.data .data.* .bss .bss.*) >> + *:AutoGen.obj(.data.g*Guid) >> } >> >> /* >> > > Do you agree to add: > > Fixes: 233bd25b000f92fc4bbe181fa48edcd72808de8e > > to the commit message, or to reference that commit in some other form? > Yes, that makes sense. > Either way: > > Tested-by: Laszlo Ersek > > Thank you very much for the quick fix! No problem.