From patchwork Mon Dec 17 18:02:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 154031 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2755566ljp; Mon, 17 Dec 2018 10:02:26 -0800 (PST) X-Google-Smtp-Source: AFSGD/V/MHJWjloBWqZbqzpUyznVlmbwykVDTxjaSd6LV+3gIGKfVQhplXy+mkZ9lzLzjmROfedL X-Received: by 2002:a17:902:7896:: with SMTP id q22mr13679528pll.280.1545069746702; Mon, 17 Dec 2018 10:02:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545069746; cv=none; d=google.com; s=arc-20160816; b=g7lj01fhFmk/ANYu+w0Z7dMZVB050oTvqqPH7hOF5eeiqZKJABkgJJBeNNf+JFYh8B 4Z6jnrVdFD7rbxvufOzaa2B5ztlCycKP5TeqtnGwR/uAUhYNoODGXVxQUd9CYe3Dwmy+ no+Pr4RQoz5V6EwZ8xmJeITU0EXpLGQ1p5j/hZ+EzDDwW1KILzD1IFcy/qMK4wzZXqUv Ggvw3uOG1ZLNLTn6zCiP/67GqbrfOGzs7BRtMcvCh0bkfMeZ79fUEvakHq58/za7BVr6 h8fg2AVwfj2KSpkVI+LrUS8pXAXFDdjGj7QK37kiidqKe94In0rnRi1+zmlH/RzXI+IA H9dw== 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; bh=eB9+JvqWOlyqsBc3VtBL48QhOz1aowu5Yp+uTE3x7CE=; b=x5qUSMtXF/fJDqOQW4ust2yibu3CB0TZ3Lg6/KVBbJOPLyXUvn+7WBA3ts1N935Dvo zi0XxVDLWOBQaZfUuyVCzKPEjcrmf/RhlFYcZUBa8cStIzoLQNWAYCxz5r3/MEl99zVV SiporC7CzmTr8Ec09xVyfGfEwowR1NX1C9KwkryX6Vm6q4FmvgAfAtD2b8hHUzf3mkXr u5Fg13SG1g1ERZUCA9GyISVRzzdJlfwEockcUtrSmGF8wvJAaRmyR3nclSkgk80/jGKV aBbXjHsB/oxFcdfnlUl+mpjcM4mRvxRnM2IuZ9b5+TJRzp8QYaUDvNQAIHGJKM/mvcjF BsLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NG6T0E58; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (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 91si11391140ply.214.2018.12.17.10.02.25; Mon, 17 Dec 2018 10:02:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NG6T0E58; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388561AbeLQSCY (ORCPT + 31 others); Mon, 17 Dec 2018 13:02:24 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:43379 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733270AbeLQSCU (ORCPT ); Mon, 17 Dec 2018 13:02:20 -0500 Received: by mail-ed1-f67.google.com with SMTP id f9so11509420eds.10 for ; Mon, 17 Dec 2018 10:02:19 -0800 (PST) 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=eB9+JvqWOlyqsBc3VtBL48QhOz1aowu5Yp+uTE3x7CE=; b=NG6T0E58fySSChoONLP2phvoeCK0ucSvd3L9VrE1FP1P2ALQMFEL8dGypTODCswMc+ 8ERliNY52J53TZYQWtAOrJYDKozjZn5/J9bl71UwxIM2OWTFOjaCGxLo6SsJDSe7UU3N 0fucnHt9yUc0+0erox6HrMNxQcTvEnmJBMUdY= 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=eB9+JvqWOlyqsBc3VtBL48QhOz1aowu5Yp+uTE3x7CE=; b=AEgNgzS3zCMWje09etssLHqTeBTJbEnClulapC4QjWTX/y5iItrTSv8sGjHOqlYO2q wHdO6O1tZEEt2HcZwmn1nZX7B5o943eSdOpGOU4OM0fLoRtzR9KkUzn0FWA1WSBYTwJm hFXTwQ6GBQg9KCb9rQFW87D4gqPkWzPjJ7iJ5vPM4hAgR371cm2SITwMawn9KCSEYo3Z 3aP2IqbxN01yWG/zDntyizwXPe+QLbofmIyVo5iToY6el3+AUY+OCi1zszunGGevGrNy ZbCGc6AW+n4ItPhvu+2Ev/4Qgt08znqlTFHsGL9OETrsqhAxS/0Oi4To6RZg1O0/Co/a quxw== X-Gm-Message-State: AA+aEWYakRPMW3bBZQY2h+1phjht6F24Bj1lF+lYAvBvzF9Bdlhz+9IU Vt1KzIGyvmKQphhgw/j7ovGQZg== X-Received: by 2002:a17:906:33d9:: with SMTP id w25-v6mr10862460eja.190.1545069738988; Mon, 17 Dec 2018 10:02:18 -0800 (PST) Received: from mba13.arnhem.chello.nl (dhcp-077-251-017-237.chello.nl. [77.251.17.237]) by smtp.gmail.com with ESMTPSA id j8sm3947678ede.55.2018.12.17.10.02.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Dec 2018 10:02:18 -0800 (PST) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Heinrich Schuchardt , Qian Cai Subject: [PATCH 1/2] efi: let kmemleak ignore false positives Date: Mon, 17 Dec 2018 19:02:13 +0100 Message-Id: <20181217180214.9436-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181217180214.9436-1-ard.biesheuvel@linaro.org> References: <20181217180214.9436-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qian Cai unreferenced object 0xffff8096c1acf580 (size 128): comm "swapper/63", pid 0, jiffies 4294937418 (age 1201.230s) hex dump (first 32 bytes): 80 87 b5 c1 96 00 00 00 00 00 cc c2 16 00 00 00 ................ 00 00 01 00 00 00 00 00 6b 6b 6b 6b 6b 6b 6b 6b ........kkkkkkkk backtrace: [<000000001d2549ba>] kmem_cache_alloc_trace+0x430/0x500 [<0000000093a6dfab>] efi_mem_reserve_persistent+0x50/0xf8 [<000000000a730828>] its_cpu_init_lpis+0x394/0x4b8 [<00000000edf04e07>] its_cpu_init+0x104/0x150 [<000000004d0342c5>] gic_starting_cpu+0x34/0x40 [<000000005d9da772>] cpuhp_invoke_callback+0x228/0x1d68 [<0000000061eace9b>] notify_cpu_starting+0xc0/0x118 [<0000000048bc2dc5>] secondary_start_kernel+0x23c/0x3b0 [<0000000015137d6a>] 0xffffffffffffffff efi_mem_reserve_persistent+0x50/0xf8: kmalloc at include/linux/slab.h:546 (inlined by) efi_mem_reserve_persistent at drivers/firmware/efi/efi.c:979 This line, rsv = kmalloc(sizeof(*rsv), GFP_ATOMIC); Kmemleak has a known limitation that can only track pointers in the kernel virtual space. Hence, it will report false positives due to "rsv" will only reference to other physical addresses, rsv->next = efi_memreserve_root->next; efi_memreserve_root->next = __pa(rsv); Signed-off-by: Qian Cai Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/efi.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.17.1 diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 415849bab233..7fcfe8a7ae98 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -1000,6 +1001,8 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size) if (!rsv) return -ENOMEM; + kmemleak_ignore(rsv); + rsv->base = addr; rsv->size = size; From patchwork Mon Dec 17 18:02:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 154032 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2755642ljp; Mon, 17 Dec 2018 10:02:29 -0800 (PST) X-Google-Smtp-Source: AFSGD/UUSkPz3bd8Tt2egFDS4N4fdkWA8UjwfQzBmqlECuP6g55dMN0WiOIIcLz0rKwa3sozvvwd X-Received: by 2002:a62:520b:: with SMTP id g11mr13852011pfb.53.1545069749827; Mon, 17 Dec 2018 10:02:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545069749; cv=none; d=google.com; s=arc-20160816; b=jgrbCQjPr0LZkwY/KtA9xX6H+FzhWFhChoj63Hv7DJLbD0NiMOe1YEDwHuwMCRBJzg KMFXvJvMvPBWuN5t+DcqQJsP5ZPcXa+KyYKrBuY6+Goiuu4STAX0NWncK5Ri6rOr2j9s ThSLfuvuHr5U+/EaAfP4iiFGJHCD/aP1d2eb4EvV4k15jNbD/MkFTXRQomUYUWMRWB13 GsSfDjo7vU6CM0g703CAGMDA7pvx4/DO8ilzQzn9N4vXY1JydRoma+NHC0DdY0nrJk7j 2qQqUTl7+lxhFt0b87RlSSbbU4NsXvrUTAFk7yRKNNJ990pZ9AMlRQBddBWUfTam99sX A1Lw== 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; bh=3UizkdkN0o9xnFgf0i3mdX9CPUyBVCA0xiH0LvZg15o=; b=Lm3luNsW7NCbpPyv7eHWMN3G9UkwlKUBkSXmNytkvKlfjTkOI+WewzIi+fF0sfkgU1 zSAPPFUpfBnWeKvnkt0x4rtSk2/j/lCw0rEEvpdu0cmsAe5RbBLHADolqtBb2ITX4bz+ P7S8mimwVIRm3XChpYQRnq6bs9kssqc5PoF//UJSCWGjriZGTX9QOrmUVQ7MQMW3EBCU QDMJY70Ck/E40jAhJpNstSDeIQCjlfcXnvFyqkOuOxYGOFN8W8HmDoVqxccub1dwR3Gm NuKS2YtBtvlb/+v27EAY1cmxXWF4HrpiDVS4KKBeMqkLK/6OnMa80YFB8ix5a13e0Z0g gVYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jJLWYhWM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (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 91si11391140ply.214.2018.12.17.10.02.28; Mon, 17 Dec 2018 10:02:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jJLWYhWM; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388549AbeLQSCX (ORCPT + 31 others); Mon, 17 Dec 2018 13:02:23 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:40052 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732476AbeLQSCW (ORCPT ); Mon, 17 Dec 2018 13:02:22 -0500 Received: by mail-ed1-f68.google.com with SMTP id g22so5486368edr.7 for ; Mon, 17 Dec 2018 10:02:20 -0800 (PST) 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=3UizkdkN0o9xnFgf0i3mdX9CPUyBVCA0xiH0LvZg15o=; b=jJLWYhWMc8Nf6kueqq417Icl80VNSh6rawjfdMnkh5kEvTDN/No8UHMbuzV6MR2AER 9po5Bx7x2hZ566LpKbxpRNfC7HRDsqKlreCN4pAUquXFChMPRg9HQkAkkCFQLwVKiYQo OXkPQjadB42gj3DTQSHKp/UZjqss6p58/2XRA= 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=3UizkdkN0o9xnFgf0i3mdX9CPUyBVCA0xiH0LvZg15o=; b=UYHg7PeL4uYG02tKMfYXkesuVjWhIGDgMkonzfz5wRcKEfXCA3tc8SCpdn39Sp4W4P 6pwz1dYpf5Ha/I+juixPJuYVd0NsbldwMSdBMBK22gwa9b2c1IaXrvJphGfmjwXS1vNY fRTEBDABO4ZzQ+KVqJe60H4Q2BD+56mtFYy2M31Rvw9sSSIJmGF9JTr6GpToOGsoLA5N Rgq3JDAsOcc9WJXG9mcN8m6Zo26OMsgrWkzJdSerGz67HUfxWa5Xo09ggW5KPcAxdjBZ 8bhxL/1nIjsvPVxvgub9ASTqGguMWfJoGCj+2L30yNC/9J01qAbDKQJo4CSHcatG690k A0+w== X-Gm-Message-State: AA+aEWa1uMQemiduffgUOYHmXCNRcOP39q3FJyji5xqIX1YuXlwchVNg tZ+UKCVRWFDjzCryop6WpOqOBxkjWdVItxyU X-Received: by 2002:a17:906:6b99:: with SMTP id l25-v6mr10622266ejr.154.1545069740215; Mon, 17 Dec 2018 10:02:20 -0800 (PST) Received: from mba13.arnhem.chello.nl (dhcp-077-251-017-237.chello.nl. [77.251.17.237]) by smtp.gmail.com with ESMTPSA id j8sm3947678ede.55.2018.12.17.10.02.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Dec 2018 10:02:19 -0800 (PST) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org, Heinrich Schuchardt , Qian Cai Subject: [PATCH 2/2] efi: efi_guid_t must be 64-bit aligned Date: Mon, 17 Dec 2018 19:02:14 +0100 Message-Id: <20181217180214.9436-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181217180214.9436-1-ard.biesheuvel@linaro.org> References: <20181217180214.9436-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heinrich Schuchardt The UEFI Specification Version 2.7 Errata A defines: "EFI_GUID 128-bit buffer containing a unique identifier value. Unless otherwise specified, aligned on a 64-bit boundary." Before this patch efi_guid_t was 8-bit aligned. Note that this could potentially trigger alignment faults during EFI runtime services calls on 32-bit ARM, given that it does not permit load/store double or load/store multiple instructions to operate on memory addresses that are not 32-bit aligned. Cc: # v4.9+, or earlier if possible Signed-off-by: Heinrich Schuchardt Signed-off-by: Ard Biesheuvel --- include/linux/efi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/include/linux/efi.h b/include/linux/efi.h index 100ce4a4aff6..e6480c805932 100644 --- a/include/linux/efi.h +++ b/include/linux/efi.h @@ -48,7 +48,7 @@ typedef u16 efi_char16_t; /* UNICODE character */ typedef u64 efi_physical_addr_t; typedef void *efi_handle_t; -typedef guid_t efi_guid_t; +typedef guid_t efi_guid_t __aligned(8); #define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \ GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7)