From patchwork Fri Aug 18 19:49:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110444 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1346187qge; Fri, 18 Aug 2017 12:53:03 -0700 (PDT) X-Received: by 10.101.70.15 with SMTP id v15mr9534975pgq.229.1503085983167; Fri, 18 Aug 2017 12:53:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085983; cv=none; d=google.com; s=arc-20160816; b=uWK7gsnGnCssCVoIE8WQv+Z8PmLB6s+3xtVMGkYwEkHW40Cb3MgLjbI1g0F4BKwLcS Z+0y2Mi4mF0ONJAdEyhPbo8F2wW2+MB60FqrbxcIIjbf+EcQrXvpn7xfyLCuUxVdYoRj Lr0NE1JkmuTlQ2k2+y3+2NuRxYP/cWq1fF6OltNwtLGo2EH7RwIZPyIv0wuzNhSDxE8C jC8fiwqXmRkJ96vX4Y9B9vYzsePrm7IsKJjokWj6ehhPuklBKkoD0MND/DZuArckQzu4 6JBzrnWFR4WFw/FRgU82OQyDk3pZoTdRjj+vZBeNvBDk6Hu5A3sU38Vy1OKlTw4ePkZ0 2d/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Wn7b0rzMKbWkPJGUyzgJPJGUmRXsrd9MvBsPLZoWUj8=; b=VemNex0zTEcA0QIcmaGhBSxqMwcEIHRUyBUrx0xE0P+VRablyCdJ7++BcCGZwRsDaU YuN0ym/e8Akkx3h8yofMMnkUU+HUPttqy66OqgWUxCBxt3QjCGwiztlnxzTlVzaeI9Gn Cvk/42BxNmLNZKlTiACuxhRrfA9i0vQLiOT1LdO0KfghqR98Ao0evJXFcmHrQoe0Vzy+ 2DIG37AiFb0HaSLBzS5OhSGeczZxivcYE4GX09iCYcla7+6r1aeTRvTPgOwawiUQxFrD CqhWQU7vcRm+MkBexKOGP41Y5eWrYxRsemkV6dxj1G1c5DWRMiebUnZgGEZvTqOvHQ/5 60dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=D26hfyJS; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b96si2328444pli.366.2017.08.18.12.53.03; Fri, 18 Aug 2017 12:53:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=D26hfyJS; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751558AbdHRTxC (ORCPT + 2 others); Fri, 18 Aug 2017 15:53:02 -0400 Received: from mail-wr0-f181.google.com ([209.85.128.181]:33617 "EHLO mail-wr0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751851AbdHRTuI (ORCPT ); Fri, 18 Aug 2017 15:50:08 -0400 Received: by mail-wr0-f181.google.com with SMTP id b65so73373352wrd.0 for ; Fri, 18 Aug 2017 12:50:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9qVSBGWIYNd1Oj6VFtIfmTY5g+5Brm/5uvl0RmMdgK8=; b=D26hfyJSOIIkHcUHAGhxvBIfJCG8avMG1uI5WmJF+Iz7LilNIyo4PvnnzvkReafLvB 1Bd4XubJPRqdX8Tavq7S3u0YlQPXYFfS1vtH5hl34nvkYRcQl5wi2D//z+r6V7YSLzMX 6W1oHqxzOr6F7L7Dh2rRQbfvNUa/icgUNu2QU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9qVSBGWIYNd1Oj6VFtIfmTY5g+5Brm/5uvl0RmMdgK8=; b=j1qcL+pRi3xZNJmHKTxRHLMZj3mn0gPLoyc9/+Tsw/vBkTHC6ek7C3MeWaJKOYBNkn 3LgcJ+7HRCyJoRRWZKZCz4ASEOEW9ddjIGyQXjNq3lkb/RXbVm9WSNsij+fgFyH96wld C5uLmE0DqTj+WD1X8fOXwy1x/fyIMtuDQaqlQWxqtF5PlBSHl3M5vzNjzo2V3zehmjQv MtYpfFBDHK6FmcxM6vaLJDa4i+jN68rzcQxxO19g824wireJvMKQlWhBlBOWw9Qi8fP5 SXGn2cDrjIqmzxYYcONdNd950Fzr7BqJOrUNgtmOt8Vj4EOXAMhyY5pTGzvvIVxIAjwH ZFhA== X-Gm-Message-State: AHYfb5hGYm+XhVcx2W+lyUKWO7Z9zSaqW1py9ljXmvf/UQAEH/uH8tfW eKwpLXaV9lxyHSJhkPuTZQ== X-Received: by 10.223.197.140 with SMTP id m12mr6704401wrg.252.1503085806456; Fri, 18 Aug 2017 12:50:06 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.50.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:05 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Matt Fleming Subject: [PATCH 03/14] efi/libstub: arm64: force 'hidden' visibility for section markers Date: Fri, 18 Aug 2017 20:49:36 +0100 Message-Id: <20170818194947.19347-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org To prevent the compiler from emitting absolute references to the section markers when running in PIC mode, override the visibility to 'hidden' for all contents of asm/sections.h Cc: Matt Fleming Tested-by: Matthias Kaehlcke Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/arm64-stub.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/firmware/efi/libstub/arm64-stub.c b/drivers/firmware/efi/libstub/arm64-stub.c index b4c2589d7c91..f7a6970e9abc 100644 --- a/drivers/firmware/efi/libstub/arm64-stub.c +++ b/drivers/firmware/efi/libstub/arm64-stub.c @@ -9,9 +9,17 @@ * published by the Free Software Foundation. * */ + +/* + * To prevent the compiler from emitting GOT-indirected (and thus absolute) + * references to the section markers, override their visibility as 'hidden' + */ +#pragma GCC visibility push(hidden) +#include +#pragma GCC visibility pop + #include #include -#include #include #include "efistub.h" From patchwork Fri Aug 18 19:49:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110433 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1343667qge; Fri, 18 Aug 2017 12:50:17 -0700 (PDT) X-Received: by 10.98.9.90 with SMTP id e87mr2681988pfd.138.1503085817021; Fri, 18 Aug 2017 12:50:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085817; cv=none; d=google.com; s=arc-20160816; b=sY/cQ/rFT7gJWYZLR+nvITYfCO6lz8AdudFfuO+1mqAet/FHiifW47rJZrAtiwA3Ia GuMcDWnnioEuAhYIWxZcw8oOlhyfk9D0ybJx+bnDywPnZg1QwMBb3UziUu0k9fvhEq6y WZ00+HRRxbaVyuTn2kN/obbbavTT1qNrVdZrkfTyoYLFJsMkE/PZV/KUZzJdKsuuH1qL wS8Ti+6tjBOuISWNt7iyNRZ3ktwOiLa0c5EPdPJ9A0xtg6087VvwPI804DR14HIcCY4s jOm4nBdVuCqgdp9OZWRVkosVvUTYJ4K1OcOWbpUcyLHo2VA00Ww8W6UMzDM9l++Hw9Hb Dp0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=ZyojkDGMz02bC8VQ7FJyIznradwGR+lqn0g7/b/GgKM=; b=D4CHXJjVouAhhRRDAbAbP7MNG1ffFc1/sfeRoKxYSkere8A15kvWXRAAwtZbLC4q29 jn28T7gNmKrVH8TNxYx/T26armc3Lzsn18AaXh0YoXWuA5H0Hw1/buhIHor9c5XWxoz5 SV4j+YXp9sSZY1GSiBbUQGoqNYhl16Y0hDV2NqAXz/f5CjLq17Sh3Z9A1pCYXcHW6DI0 ZXZ++l3tmmfHdQ/o/VnvLKaOG4bYDdf11jgRAMeoTYG8I0QTm09LG5LANxB++E1pDNTD 1q9BD3pyin4p6zYpJCj0CHdWbKNkT9EbC/7/UJd0W3z4n5bjRXcF5L21jZXkQTaX2T3C Ckwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GBCdAd1W; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y42si3194122plh.167.2017.08.18.12.50.16; Fri, 18 Aug 2017 12:50:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GBCdAd1W; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752250AbdHRTuP (ORCPT + 2 others); Fri, 18 Aug 2017 15:50:15 -0400 Received: from mail-wr0-f172.google.com ([209.85.128.172]:33989 "EHLO mail-wr0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752322AbdHRTuN (ORCPT ); Fri, 18 Aug 2017 15:50:13 -0400 Received: by mail-wr0-f172.google.com with SMTP id y96so70961706wrc.1 for ; Fri, 18 Aug 2017 12:50:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8U7GZ5wuSwpXnJUqUv+ilpkVQflbNiuZaWgFCf6bPfg=; b=GBCdAd1W7MJYUYnjjuLB1ywsnwDCXniqx2gZvhFM/EXRSTQNY+lvgwR4/H1T3q3HWd m2xQJGOrdSLqAYVMogtzcN7EuBSAjVKlAfGxdHzN+nLQDHbZtnH1D8t0BLysXhYvRxFH JComkMoiphDJaluzQ75IwBu6Ykj2+kvuxTH6g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8U7GZ5wuSwpXnJUqUv+ilpkVQflbNiuZaWgFCf6bPfg=; b=j/FfArJMj/BBm1v4ZnysUS0d4qqlIenNgGMkPS/EAO7baKVMmbNqNJQF8wIeOYVxok HSqMe2KHxmELcb7k8utoT4J7b+b+oKukKk+pX4X4HtpNYfn/8ufpPSb6vqhYEqaDwWLm JspDxpphenDr64JAY6YZq0EwWQmp5cMIk9xhW6FhQNziwnNifaA4/DPNbtsNnJyBXdnO eL5lOYb97cF1FWOMwonAKPTcQecBWLCo+XGreB3zrxq7t/ZX5gyPmBRpdSQyOc3D+ueI Nxe5JQJaMShhIslzXIfLl6ACV+WU6MF0k/nn/SiRLRyH1sWwErJRcbnu5fXbwy/e/YS1 izEQ== X-Gm-Message-State: AHYfb5gFUVmuz9wo7jUVh8eUUE3KmwXSpqpZJTzPZMWDpDolB2+rZ+sk Mb45/zvXsDuKXw8QpCvV0Q== X-Received: by 10.223.166.41 with SMTP id k38mr6923177wrc.284.1503085811890; Fri, 18 Aug 2017 12:50:11 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.50.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:11 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Matt Fleming Subject: [PATCH 05/14] efi: arm/arm64: Add missing assignment of efi.config_table Date: Fri, 18 Aug 2017 20:49:38 +0100 Message-Id: <20170818194947.19347-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org The ARM EFI init code never assigns the config_table member of the efi struct, which means the sysfs device node is missing, and other in-kernel users will not work correctly. So add the missing assignment. Note that, for now, the runtime and fw_vendor members are still omitted. This is deliberate: exposing physical addresses via sysfs nodes encourages behavior that we would like to avoid on ARM (given how it is more finicky about using correct memory attributes when mapping memory in userland that may be mapped by the kernel already as well) Cc: Matt Fleming Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/arm-init.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/firmware/efi/arm-init.c b/drivers/firmware/efi/arm-init.c index 0aa4ce7b4fbb..80d1a885def5 100644 --- a/drivers/firmware/efi/arm-init.c +++ b/drivers/firmware/efi/arm-init.c @@ -145,6 +145,9 @@ static int __init uefi_init(void) sizeof(efi_config_table_t), arch_tables); + if (!retval) + efi.config_table = (unsigned long)efi.systab->tables; + early_memunmap(config_tables, table_size); out: early_memunmap(efi.systab, sizeof(efi_system_table_t)); From patchwork Fri Aug 18 19:49:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110441 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1345292qge; Fri, 18 Aug 2017 12:52:03 -0700 (PDT) X-Received: by 10.99.2.68 with SMTP id 65mr9200064pgc.97.1503085923057; Fri, 18 Aug 2017 12:52:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085923; cv=none; d=google.com; s=arc-20160816; b=DddXEweDoxYZzXU8igOeXpHyJlBAtDRNiwlkg4mhHqX1m0i/134jdZB/YcQ3e8HPmz vz8fYlQA5xx8Q/tJD7LCFStmBbHgSClATkgcrIN0W1whgjsg0PrKBf0FJVaWUexAcmOi PN1KQDraLsSzlP8d72kp35UhD51bOqPkr1sQW3pVGd6+QY0Diyvrxul/WwPo/iWiCBxQ J8tGKlINIh296geYWbbZc9rZe+LxZC+ALeRT+0c3S5uXlNvDMlPYKKCv4D4RISSvVrz6 T2b6aSXtD36H4chSxSHUs5mIDgBhYoMiAfOnfnRPbXGvkjn8vH89Bx76QEqmQx47HCW8 S/Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=DOci+TmtmRv4ua/yTEseqTYIFGVW//ZUhUVjWRattIs=; b=PgqjHvJImg934japDG2nYeriX8nZ9TJPaLh9OsIw987MvGm0MKUsAoHIBhSxGmWVlq D3G29shaSarJ8G94YHf20xLDHSGA0oT1ClTiD42Dech3tQjwg/NuZx0s725MIEYkbXYp OKYMLYciUy5xOX0+jJPMr0dKiQGGgbOCQCKDpWBengO8JNo9FFTdf5VS0xFWW56r+DmU rUlFBh1YVe3Cj5Si1yRvLNsidClskamntIWMlNF+6H+jzxjx1IJYSnCVT8MOLuvtzvKd xvW2gK88vnP5cWbThuIaKf+duW/0XmK3w2Jq+Qg5Bp5A1nYrUHLIkoq+rbeMfrHYjwyQ gGEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gHOZP+NV; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x32si4261670pld.52.2017.08.18.12.52.02; Fri, 18 Aug 2017 12:52:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gHOZP+NV; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752483AbdHRTuV (ORCPT + 2 others); Fri, 18 Aug 2017 15:50:21 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:33993 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752394AbdHRTuQ (ORCPT ); Fri, 18 Aug 2017 15:50:16 -0400 Received: by mail-wm0-f48.google.com with SMTP id c14so2103788wmh.1 for ; Fri, 18 Aug 2017 12:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bQ7Vb3VVp0p7ammYV1+sRKKpl+n3KWGGXTsTTshJOFw=; b=gHOZP+NVrJPdgyxQKH0pFKEnfze1BwrQ5qEKcoW/5xF3YAjHoWMd9ofVsl6XU6ymtD kwiKGhvUMSxd6cJAi/hak4ZArY7FErJaFVahgEXTJRzAlB9n/r8XfJRWEVd+3YXfCj+p Lzi6QhGrdJf6FegdDawkGddIwAdtqiSkDN828= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bQ7Vb3VVp0p7ammYV1+sRKKpl+n3KWGGXTsTTshJOFw=; b=PNMPKEjSID/fnSuVG25LcNdLJa+fa7o7md/RRB02u2thtWbs0Z6KE9RUKBburZqvZb WAojNXi6m3+7rY85dkHCU1PCgLFNUCzXbPl6VMy13u5bBaOEhfVxKAcp4k+oT2XBQvee byvzVriG4cTzcC7ubSVM9T84mku7hYzvMHwUgKY2o04CB9X7vBDeBI320AlJJJUQPFKP TcCm7o8FWrNwleRmJUber6F4Iyd9pRBUOoUiadZw6dHfa7KslK512/xVN5izB2Y9b0F8 TE+PrCP05ra6fPNG38UUNxOL8jg/OJ/Z3nWeqykKQ210MvHZG/Vh/pI4hXUs4t1TIxRi IA6A== X-Gm-Message-State: AHYfb5gtCfbpk/+F66Awu4qO2BbiHfrT7RuHq44BDry1sHfRYUtBZU4L 1dHU68aN4l1uCpPcOsjbbg== X-Received: by 10.28.62.149 with SMTP id l143mr2251126wma.126.1503085815058; Fri, 18 Aug 2017 12:50:15 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.50.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:14 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Hans de Goede , Ard Biesheuvel , linux-kernel@vger.kernel.org, Mark Salter , Len Brown , "Rafael J. Wysocki" , Andy Shevchenko , Peter Jones , Matt Fleming Subject: [PATCH 06/14] efi/reboot: Fall back to original power-off method if EFI_RESET_SHUTDOWN returns Date: Fri, 18 Aug 2017 20:49:39 +0100 Message-Id: <20170818194947.19347-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org From: Hans de Goede Commit 44be28e9dd98 ("x86/reboot: Add EFI reboot quirk for ACPI Hardware Reduced flag") sets pm_power_off to efi_power_off() when the acpi_gbl_reduced_hardware flag is set. According to its commit message this is necessary because: "BayTrail-T class of hardware requires EFI in order to powerdown and reboot and no other reliable method exists" But I have a Bay Trail CR tablet where the EFI_RESET_SHUTDOWN call does not work, it simply returns without doing anything (AFAICT). So it seems that some Bay Trail devices must use EFI for power-off, while for others only ACPI works. Note that efi_power_off() only gets used if the platform code defines efi_poweroff_required() and that returns true, this currently only ever happens on x86. Since on the devices which need ACPI for power-off the EFI_RESET_SHUTDOWN call simply returns, this patch makes the efi-reboot code remember the old pm_power_off handler and if EFI_RESET_SHUTDOWN returns it falls back to calling that. This seems preferable to dmi-quirking our way out of this, since there are likely quite a few devices suffering from this. Signed-off-by: Hans de Goede Cc: Mark Salter Cc: Ard Biesheuvel Cc: Len Brown Cc: "Rafael J. Wysocki" Cc: Andy Shevchenko Cc: Peter Jones Signed-off-by: Matt Fleming Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/reboot.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/firmware/efi/reboot.c b/drivers/firmware/efi/reboot.c index 62ead9b9d871..7117e2d0c7f9 100644 --- a/drivers/firmware/efi/reboot.c +++ b/drivers/firmware/efi/reboot.c @@ -5,6 +5,8 @@ #include #include +void (*orig_pm_power_off)(void); + int efi_reboot_quirk_mode = -1; void efi_reboot(enum reboot_mode reboot_mode, const char *__unused) @@ -51,6 +53,12 @@ bool __weak efi_poweroff_required(void) static void efi_power_off(void) { efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL); + /* + * The above call should not return, if it does fall back to + * the original power off method (typically ACPI poweroff). + */ + if (orig_pm_power_off) + orig_pm_power_off(); } static int __init efi_shutdown_init(void) @@ -58,8 +66,10 @@ static int __init efi_shutdown_init(void) if (!efi_enabled(EFI_RUNTIME_SERVICES)) return -ENODEV; - if (efi_poweroff_required()) + if (efi_poweroff_required()) { + orig_pm_power_off = pm_power_off; pm_power_off = efi_power_off; + } return 0; } From patchwork Fri Aug 18 19:49:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110442 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1345317qge; Fri, 18 Aug 2017 12:52:05 -0700 (PDT) X-Received: by 10.98.144.135 with SMTP id q7mr9859317pfk.229.1503085925056; Fri, 18 Aug 2017 12:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085925; cv=none; d=google.com; s=arc-20160816; b=Mq5cu9RR8jGwj9WBBA1ipRCpv31LILw14hAabovIBOCFBE8vw5lCtZx2WTBP4azSfO n7jbUQtT6/Qw0+TKxmFu5aD5APOng8jdFvmoSSeF1ZZkb4SpXsaZ7avY+q90A+TH1fYb cO3wyp5SI7earm9hab1QLvvSzAZkGrwuKRiqyBL39cbqnmxy5LTPTcqvP9gFfe/nlFVU 3jQBBs6FGLd8dw1m8rIcVnXD41f9NLBLnV52UWZviPSC6+cyyYZZ/10lt3oG7AcVQA1S GUZW2UjT62Ygdk+Y7jWYoWg6NzvVcoE0Y7sOkZAB4JqIpecfSiLq/EleLx/uiDEizPaA B5pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=9+K0aar7tvcs+W97Sya6dLEDJZWP9TBVR/E9yTkSoos=; b=nul0NGl5a+5bRhZC13/elD0eLmgw9XXr7BEglCS+Da0cIcjTTi+kHnUPhSOOH7qLYX j+W3d7YRJNqaLwCZQo78NGGu1c/pH/P+Gp7b7J4nlXgUa6BsPD7bb9r7xR6ctqiJG/sP TYQQzmpJ5upcgaKN3RIuKlcbQG/nbeyyJ6aK2WvR6FdgVnvCBUXRjl5ndKH3YfdllZD/ 7mcgfkg1ZZqH10sYy5V1cnzEf99ag1id3MlVsNUXBOMadlPgAUwvNfhR8rZ4f3PUVAT6 XCZJCFHR6mffK1t37/nvT9uu1EvPXo9tF/U1qQzEB+/cuRd5Cv/U5yAc3XMovReaE1LN HXdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DJvmWZOk; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x32si4261670pld.52.2017.08.18.12.52.04; Fri, 18 Aug 2017 12:52:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DJvmWZOk; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751843AbdHRTwE (ORCPT + 2 others); Fri, 18 Aug 2017 15:52:04 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:37278 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752477AbdHRTuV (ORCPT ); Fri, 18 Aug 2017 15:50:21 -0400 Received: by mail-wm0-f45.google.com with SMTP id i66so7294980wmg.0 for ; Fri, 18 Aug 2017 12:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pWN2jaOBtg76WmAL3uEQttXaWdwPmXHJOh+qAT+xW2s=; b=DJvmWZOkh6nvpQK8JcmEq2xpmalu6DN7C6TBjDBpuNRyT+AYrne7xH8BIk5WspOkLj O5aq8xfYBS52jSZp798ozpZDL4Ht8G0LVGC+b/DZzqgh3R/1V0hT/qBX5LbfHnjTHyLt +s7S6FrIbyWE7BPLUkWnGKIiqTpZM0k+Hs5M4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pWN2jaOBtg76WmAL3uEQttXaWdwPmXHJOh+qAT+xW2s=; b=D49tjMa2Mv8aJ8TQF7NE178TFASI5H0q3HeC9Exp9v9qVaGKnkLVCHZeCCSLo/n2Cw O0kXS3Qb4x3/fy/QZMB7uuoc/Ygqo8tO/0UBy+cOjwVuTM4BQOAPOswejb/tivBl0BWL zmESaF2KqYY6yKgZDjH9HWo8mrVCJq6otCAzHlPPfqOqFUqqdrzTL9UJkW8u+oOqR7gn +fmd8slWi//vpTyPUcwUZsRJX09+ABpNxQj8BuAOGG/QhzXXwalKkkgg+90qKs3aQ0KR jbxzwW2W/4vbVjc2QS+4L9/bG9CtD3FwTvSPGibUBbP82xzyEgT/If2Wka3dZ1Kc4Ytg hYEw== X-Gm-Message-State: AHYfb5gz/SSZTaPs4cNlLxuTszMGGnx0EwYtLLrSTb4cXfiXk1SWaoU1 1dhkpVcT9jdrCDOZ8pdu7A== X-Received: by 10.28.225.139 with SMTP id y133mr1958805wmg.41.1503085819863; Fri, 18 Aug 2017 12:50:19 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.50.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:19 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Matt Fleming Subject: [PATCH 08/14] arm: efi: remove forbidden values from the PE/COFF header Date: Fri, 18 Aug 2017 20:49:41 +0100 Message-Id: <20170818194947.19347-9-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Bring the PE/COFF header in line with the PE/COFF spec, by setting NumberOfSymbols to 0, and removing the section alignment flags. Cc: Matt Fleming Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/efi-header.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/boot/compressed/efi-header.S b/arch/arm/boot/compressed/efi-header.S index a17ca8d78656..4169b900d9d4 100644 --- a/arch/arm/boot/compressed/efi-header.S +++ b/arch/arm/boot/compressed/efi-header.S @@ -44,7 +44,7 @@ coff_header: .short 2 @ nr_sections .long 0 @ TimeDateStamp .long 0 @ PointerToSymbolTable - .long 1 @ NumberOfSymbols + .long 0 @ NumberOfSymbols .short section_table - optional_header @ SizeOfOptionalHeader .short 0x306 @ Characteristics. @@ -110,7 +110,7 @@ section_table: .long 0 @ PointerToLineNumbers .short 0 @ NumberOfRelocations .short 0 @ NumberOfLineNumbers - .long 0x42100040 @ Characteristics + .long 0x42000040 @ Characteristics .ascii ".text\0\0\0" .long _end - __efi_start @ VirtualSize @@ -121,7 +121,7 @@ section_table: .long 0 @ PointerToLineNumbers .short 0 @ NumberOfRelocations .short 0 @ NumberOfLineNumbers - .long 0xe0500020 @ Characteristics + .long 0xe0000020 @ Characteristics .align 9 __efi_start: From patchwork Fri Aug 18 19:49:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110440 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1344811qge; Fri, 18 Aug 2017 12:51:27 -0700 (PDT) X-Received: by 10.84.218.4 with SMTP id q4mr10705581pli.202.1503085887705; Fri, 18 Aug 2017 12:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085887; cv=none; d=google.com; s=arc-20160816; b=EyRnxxKacy6BNgHt7KFENf7555G3yQmklyfRTFA3mz0ULhhH7yo6Uqi4zk5g6TptMS R/96oy7evmdz+cbwlq6j0IYrIbbk2P463DT1rGTgJ9XxICewItQpdzh9n8qKQtW7QDvM l49ubimfmLW+G7aAXBK2QuqY6L/XEj4HCEEgGt/oyM/Hsp/TQaH7lWSrF0htvpSN1s4b zvA7FBQEZk8nNDsAGpUrGc2aSSverCWpI3JCY4fKlkoeuEPLBAE1DxYpBFM1pyAFlGRP 2E7EQGRezI42IuQjRl0t39NR/joTvihD66ftb2pt89F1UcGLMlYIk+DaZf9X6qxlEh+e KYSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Rwo9TEYAsA4KxC3bCYqWzn9OnCn2P3VPU5r9FjRhiEA=; b=seLNA1x7Kg2ZLvm3+aJAWaOzMssSmreNwLh/5VkaWtecEhHs91xYVyJ3mG+mjbsaXW 6eqoGBoP44UUzofLNG/FeeCFt/zEGVNn+dfqRppmwN5XcQu6KJnhi2/Tu+mx8j/oFGZr jMZ9yyF6hYsjCiyBXIu+QDdi0xVY0uZqS8kY/NEJEHfdTGF4LRrQEJalxdnJ/zMuVtxu yZ6KZFl8EBCPAKMyLvDy34ZwiUfJ3jMwyxWlwBSo5A8McUXzh3B0FdhsRkzz+RPBlOiw lQz8W5YOSJFGLWqJi4/geenxtkdiEaBkrkj72e64AgpSnMNBRNdyYkfdzSxnonPNXYBe 0AfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NnBGZvgk; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b75si138759pfc.166.2017.08.18.12.51.27; Fri, 18 Aug 2017 12:51:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NnBGZvgk; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752583AbdHRTud (ORCPT + 2 others); Fri, 18 Aug 2017 15:50:33 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:35465 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752517AbdHRTub (ORCPT ); Fri, 18 Aug 2017 15:50:31 -0400 Received: by mail-wm0-f41.google.com with SMTP id m85so7252876wma.0 for ; Fri, 18 Aug 2017 12:50:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7vGcgqXCsgtxMz0rRVsD3pMyLvs1NmPg1vYVgGUO2Zo=; b=NnBGZvgk35Nk2BfUIzazsC2jso+Me4nxe3QpxgaCyQnIU3BRoUGw6h/q7psz7ps6yQ zy01siXJf1nFoaldHZLErtopgMX7NCjkOj0r2lxdldopHV5TogwQKVxoSAMGQjpTfS5P phxR4buX4EwudE5jsG9Lynz8JvTF6Yf6eb5GM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7vGcgqXCsgtxMz0rRVsD3pMyLvs1NmPg1vYVgGUO2Zo=; b=UZ+z8bqw/VRkWfZksu0luWFVvFE5TwcHOVykE9mm/DwYml3C+FBx3dwuhvz4UmXZQd ZoKIfrJwAzuXFBxBYxYGXHWzPFrBT2FTE/3YtcByhjp02E+hPU4q9SwMTwKX3jCA7r9u Zbh/hopILBLszd+1YXxK3irfrK6Ohv20ad0VX4JWdCqDgedBsFQheTvHw7J6GeYJw5ZB S93i9Ed4nE4UnSXoi2SPRR1hxx3cLqrzr9/c4v0Q5pFjoDQZV9hRF+EpBEDyLv8P+mV4 /vcpqTqvKl7uA/ePrHkA4n7cXplYRjGPLbaTuEP69VImJrmYEtROgrQ0uNTwEkjKM0vl caNQ== X-Gm-Message-State: AHYfb5gCwWwc/53ITWC9BSrSI/OTlTEaHNh5frKRo/wbfIf6F56qPwaZ uLWCRRlYK3F90kwTNIsaog== X-Received: by 10.28.150.87 with SMTP id y84mr1972047wmd.67.1503085828357; Fri, 18 Aug 2017 12:50:28 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.50.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:27 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Russell King , Matt Fleming Subject: [PATCH 11/14] arm: efi: split zImage code and data into separate PE/COFF sections Date: Fri, 18 Aug 2017 20:49:44 +0100 Message-Id: <20170818194947.19347-12-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org To prevent unintended modifications to the kernel text (malicious or otherwise) while running the EFI stub, describe the kernel image as two separate sections: a .text section with read-execute permissions, covering .text, .rodata, .piggytext and the GOT sections (which the stub does not care about anyway), and a .data section with read-write permissions, covering .data and .bss. This relies on the firmware to actually take the section permission flags into account, but this is something that is currently being implemented in EDK2, which means we will likely start seeing it in the wild between one and two years from now. Cc: Russell King Cc: Matt Fleming Signed-off-by: Ard Biesheuvel --- arch/arm/boot/compressed/efi-header.S | 32 +++++++++++++++++++++++--------- arch/arm/boot/compressed/vmlinux.lds.S | 30 +++++++++++++++++++++++------- 2 files changed, 46 insertions(+), 16 deletions(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/boot/compressed/efi-header.S b/arch/arm/boot/compressed/efi-header.S index 542e1ad432ae..c94a88ae834d 100644 --- a/arch/arm/boot/compressed/efi-header.S +++ b/arch/arm/boot/compressed/efi-header.S @@ -54,20 +54,22 @@ coff_header: IMAGE_FILE_EXECUTABLE_IMAGE | \ IMAGE_FILE_LINE_NUMS_STRIPPED @ Characteristics +#define __pecoff_code_size (__pecoff_data_start - __efi_start) + optional_header: .short PE_OPT_MAGIC_PE32 @ PE32 format .byte 0x02 @ MajorLinkerVersion .byte 0x14 @ MinorLinkerVersion - .long _end - __efi_start @ SizeOfCode - .long 0 @ SizeOfInitializedData + .long __pecoff_code_size @ SizeOfCode + .long __pecoff_data_size @ SizeOfInitializedData .long 0 @ SizeOfUninitializedData .long efi_stub_entry - start @ AddressOfEntryPoint .long start_offset @ BaseOfCode - .long 0 @ BaseOfData + .long __pecoff_data_start - start @ BaseOfData extra_header_fields: .long 0 @ ImageBase - .long SZ_512 @ SectionAlignment + .long SZ_4K @ SectionAlignment .long SZ_512 @ FileAlignment .short 0 @ MajorOsVersion .short 0 @ MinorOsVersion @@ -77,7 +79,7 @@ extra_header_fields: .short 0 @ MinorSubsystemVersion .long 0 @ Win32VersionValue - .long _end - start @ SizeOfImage + .long __pecoff_end - start @ SizeOfImage .long start_offset @ SizeOfHeaders .long 0 @ CheckSum .short IMAGE_SUBSYSTEM_EFI_APPLICATION @ Subsystem @@ -98,9 +100,9 @@ extra_header_fields: section_table: .ascii ".text\0\0\0" - .long _end - __efi_start @ VirtualSize + .long __pecoff_code_size @ VirtualSize .long __efi_start @ VirtualAddress - .long _edata - __efi_start @ SizeOfRawData + .long __pecoff_code_size @ SizeOfRawData .long __efi_start @ PointerToRawData .long 0 @ PointerToRelocations .long 0 @ PointerToLineNumbers @@ -108,12 +110,24 @@ section_table: .short 0 @ NumberOfLineNumbers .long IMAGE_SCN_CNT_CODE | \ IMAGE_SCN_MEM_READ | \ - IMAGE_SCN_MEM_WRITE | \ IMAGE_SCN_MEM_EXECUTE @ Characteristics + .ascii ".data\0\0\0" + .long __pecoff_data_size @ VirtualSize + .long __pecoff_data_start - start @ VirtualAddress + .long __pecoff_data_rawsize @ SizeOfRawData + .long __pecoff_data_start - start @ PointerToRawData + .long 0 @ PointerToRelocations + .long 0 @ PointerToLineNumbers + .short 0 @ NumberOfRelocations + .short 0 @ NumberOfLineNumbers + .long IMAGE_SCN_CNT_INITIALIZED_DATA | \ + IMAGE_SCN_MEM_READ | \ + IMAGE_SCN_MEM_WRITE @ Characteristics + .set section_count, (. - section_table) / 40 - .align 9 + .align 12 __efi_start: #endif .endm diff --git a/arch/arm/boot/compressed/vmlinux.lds.S b/arch/arm/boot/compressed/vmlinux.lds.S index 81c493156ce8..7a4c59154361 100644 --- a/arch/arm/boot/compressed/vmlinux.lds.S +++ b/arch/arm/boot/compressed/vmlinux.lds.S @@ -48,13 +48,6 @@ SECTIONS *(.rodata) *(.rodata.*) } - .data : { - /* - * The EFI stub always executes from RAM, and runs strictly before the - * decompressor, so we can make an exception for its r/w data, and keep it - */ - *(.data.efistub) - } .piggydata : { *(.piggydata) } @@ -70,6 +63,26 @@ SECTIONS /* ensure the zImage file size is always a multiple of 64 bits */ /* (without a dummy byte, ld just ignores the empty section) */ .pad : { BYTE(0); . = ALIGN(8); } + +#ifdef CONFIG_EFI_STUB + .data : ALIGN(4096) { + __pecoff_data_start = .; + /* + * The EFI stub always executes from RAM, and runs strictly before the + * decompressor, so we can make an exception for its r/w data, and keep it + */ + *(.data.efistub) + __pecoff_data_end = .; + + /* + * PE/COFF mandates a file size which is a multiple of 512 bytes if the + * section size equals or exceeds 4 KB + */ + . = ALIGN(512); + } + __pecoff_data_rawsize = . - ADDR(.data); +#endif + _edata = .; _magic_sig = ZIMAGE_MAGIC(0x016f2818); @@ -84,6 +97,9 @@ SECTIONS . = ALIGN(8); /* the stack must be 64-bit aligned */ .stack : { *(.stack) } + PROVIDE(__pecoff_data_size = ALIGN(512) - ADDR(.data)); + PROVIDE(__pecoff_end = ALIGN(512)); + .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } .stab.excl 0 : { *(.stab.excl) } From patchwork Fri Aug 18 19:49:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 110438 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1344424qge; Fri, 18 Aug 2017 12:51:03 -0700 (PDT) X-Received: by 10.98.80.131 with SMTP id g3mr10100165pfj.156.1503085863295; Fri, 18 Aug 2017 12:51:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503085863; cv=none; d=google.com; s=arc-20160816; b=Gp+tXtC+gdQJuBjTXeTHi6+6oFlum657o72M34CGJYduhotjtU3dVts6b6dR1EeeRN v7iWRWypGXmaNRwjHl6/w8HqbWpYfpHHx1WaQR11iuC7Y/q7lFeDTflkoH+x6ucnUu8J v/JzF27R5ue2ISQ+jn5I7OCddxpOvX4FPFuK8r8iOJiCCaa5+EsNFoIAzO7gmEdT+SPt JJpF1BkvQrZk3iiRG4qUX827RL/Y/EyCZdqUYl61Qn0NBPis/pyHMN/MlV2ChLyIgfZ+ b2+jcMSIbXKCMpsu5600qBPbgBYwiyDObBuOgedVKn44pEhasj4vhWokqKjh6QuskuMU gIwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=vlrnyPvPxWI4+kVBid+z0TgzUAOKUfr/qV4PigDa7aA=; b=dikQqYLuNaDPcKbirM1OtXo1mi9OHv5qhgNjZmiSGy8TH3EyWp188UMPGYoJSMWC61 2ekE9IQA/2GEb7yRploP44032/JcUTw7sXInrhzsVtFJJMQ7xP0LqdWzudXNcVxJLGQB 7FgrrdCUZmgvWb9BDkBYlo8/12ztrX2PJKknFcHlFcXnTKjjsBnDfXCIKPB7krNpSP83 tLyxM/vE2ji3HRypxmzT1Dwm4loShy5UrVuqEeNkNI88cxYx8wlxIx++iObAFuzEo6gr aFtvkuKgYuo4jrSVsN7PNx7jU94Ej4RxuNTEmc/ef46+XzQgZL20a5KBll9Wd+Yd5Zdy B6KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RoO+Tamd; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q8si3899020pgc.114.2017.08.18.12.51.03; Fri, 18 Aug 2017 12:51:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RoO+Tamd; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752670AbdHRTvB (ORCPT + 2 others); Fri, 18 Aug 2017 15:51:01 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:36853 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752597AbdHRTuf (ORCPT ); Fri, 18 Aug 2017 15:50:35 -0400 Received: by mail-wm0-f44.google.com with SMTP id t201so7255934wmt.1 for ; Fri, 18 Aug 2017 12:50:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mV31Jz1Tj5z5UiuLEOx8fI5GQ+0kCau1NbNKAbw8d/s=; b=RoO+TamdQdT2SS0WfxnWEsV0Fm2u34MXk0u4UVjcPpEE/20ifkqDkrvCMVz8TWA4V0 EUA72SdPBfhrsdSlc3QUpgmi3jXyvo9hUFILfXrtq7wEI/jegRSwKYkdJTq2UBifJ1WK L6MTJEM4fxpCTcYoNfpMhs0wpQ96LwbTSFwmE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mV31Jz1Tj5z5UiuLEOx8fI5GQ+0kCau1NbNKAbw8d/s=; b=CMGw8HN+6QDDIqGcdvZUCHX2al/hp0MxLA2UlD3aQNkI8BVP7T8F2kldBRyrKJMcZ+ kUPo/d1TltoNm1N170BMOEb4QPNyBmWkwifW4K1l0TXscKglmgau9sdO0txgrIgld673 qbMAiTj7YFTi9U/fTYTzFXSJxFgnEE7i1l2CltgyuTQOD66fjlVPT7JSZsvokAjkHnzM kTS9cIGA2M5WMImxB3B6gh1H7XjIHFWhSwq5lPGH0hMbufvnq+0GI9ZL53mssvsf1quG uUV4aAOqjJiwQAxYWa/gJ7ka5yPnI0rEoXYjTT4BnImVhJSl6NxePLQAVr2skgZ/yqde izZQ== X-Gm-Message-State: AHYfb5gJJf2KVB/tVlUga7yr98wgyXtPIs0xUQXHxbnvkiJEHF/B0WWM 3lA8zq8bMhf8vGZQS5vUPg== X-Received: by 10.28.229.149 with SMTP id c143mr1961458wmh.76.1503085833823; Fri, 18 Aug 2017 12:50:33 -0700 (PDT) Received: from localhost.localdomain ([154.146.161.128]) by smtp.gmail.com with ESMTPSA id k29sm5571168wrk.56.2017.08.18.12.50.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 12:50:33 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: Arvind Yadav , Ard Biesheuvel , linux-kernel@vger.kernel.org, Matt Fleming Subject: [PATCH 13/14] firmware: efi: constify attribute_group structures. Date: Fri, 18 Aug 2017 20:49:46 +0100 Message-Id: <20170818194947.19347-14-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170818194947.19347-1-ard.biesheuvel@linaro.org> References: <20170818194947.19347-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org From: Arvind Yadav attribute_group are not supposed to change at runtime. All functions working with attribute_group provided by work with const attribute_group. So mark the non-const structs as const. Signed-off-by: Arvind Yadav Cc: Matt Fleming Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 045d6d311bde..6519be44387c 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -179,7 +179,7 @@ static umode_t efi_attr_is_visible(struct kobject *kobj, return attr->mode; } -static struct attribute_group efi_subsys_attr_group = { +static const struct attribute_group efi_subsys_attr_group = { .attrs = efi_subsys_attrs, .is_visible = efi_attr_is_visible, };