Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp139448pxy; Tue, 20 Apr 2021 14:51:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9Z8yu7kr6bKh4whmSwQMoDCijs+pA2qy9Ar/bfFgvfyxaCDheFaBnRvPv09xE3aQhR+wv X-Received: by 2002:aa7:d9d9:: with SMTP id v25mr21736793eds.83.1618955482143; Tue, 20 Apr 2021 14:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618955482; cv=none; d=google.com; s=arc-20160816; b=sJzaQgnkcs75lXrYNbFcGPwxi1wUkAumzk/S+63z+mX3zVp32YB+tTpB5kqz3MnygT 7qU0u5oN7ozgIvM9gtyO9O+KKTB4I0vreGNGHurhW9MZhgA3nHX90HW4vPNWwQjIW6/t QQsnGfMBcrIVS3i/6C2lmIHUaND+5FzjiNbPqR++PBLRb9/NkaQKDocyV3fAn2Via1Qt E2Gdg8yVsNmRcHSOenam2qOZ906mIhLijGnRTyiczyEGypyfyB7pLORhIajdYBYilOqw NwZjUlPYtdAq9JfPg3QJHu0ezp6u3WX4wj8FxVwc0bDwwh++t8Hu3x9n5AZLiR35bsLT Sgfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4xzqViBvQw9ylVcyAX3gKc2oNS/2BjHDe1lWbNHThZg=; b=Y7XbG1jj0hmzbXArEyMGxYyfF8SGU7oWoCPmqs0XXVpzBuEeJo3b2GQKiPuY4239f4 +1vYqk6HBh+FygUfKzQXZM+mmdEc+O4NiDOmT2hWG6WUgb2Esy1BKMR8vcA+fhF1J1VM c5RJ+n61LEDYN6gHG+irBY82/hAgMXN93TAkJp6FL3xoZ61MvYfR7trOE6tuGw+Xq+nF lZySlqquEVa0R/PF8FPcxbJuzSc4qSX8Wtcob9NTAbQ9PL44PuliMMfT9KhkpOm7BpqK D+5gCR+Km1IHBVwsqMD6jmgdaOrQIgBYk/5sMgcJwp7TvdHcjiKE6zt5q9K7R/Qv23bo wfrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OtyAl1AG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b1si53662ejh.35.2021.04.20.14.50.59; Tue, 20 Apr 2021 14:51:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OtyAl1AG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234189AbhDTVuj (ORCPT + 99 others); Tue, 20 Apr 2021 17:50:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233961AbhDTVuh (ORCPT ); Tue, 20 Apr 2021 17:50:37 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E93AEC06138B for ; Tue, 20 Apr 2021 14:50:05 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id n10so9286700plc.0 for ; Tue, 20 Apr 2021 14:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4xzqViBvQw9ylVcyAX3gKc2oNS/2BjHDe1lWbNHThZg=; b=OtyAl1AGgZByCAiagwNn/q6lTf+8JsoiPSKsNtED09CG4XtELE14tVG/ArnCByypSS Og3aVZZppUKBRwVM/AlfoYmV+Q11snaYuFCFA27yiTP64LcQH6l8uFUaDfw0K+vJqHN9 9q50IdbfPMs6LkCUxdFpdx68nR3vSaQOZvbxQ= 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:mime-version:content-transfer-encoding; bh=4xzqViBvQw9ylVcyAX3gKc2oNS/2BjHDe1lWbNHThZg=; b=peuDa6ehYPryaHre8bzRlBTkyYhMFovVvqVGw+NvQmb+by9m8i74S7TkL+T8RKQefn 7kyH4zpzDEEdctn0gqiSdfBNr/m+j04sKAMJajyGfpi8OSoL8xc3FPkNOP2zVNZ304tu s4azLP0c1ks6XGdhFxFTNLuHKvvTHJdq0jhaSEisFthtqAZZje38jrZwDoMbYPB9ToKm dSfmEqTeBKuPQgD3Ot/EAJOiQxLESukcJVQzootoDVMLoLnUVBnl7Xo/HE3uk6cZJEZa Vnv+GgheiwsZ6j0zyccqHTKkXIh+VJdKvQROK4j9pi2N0uLF6/SjL7uxSejULU5bsTjO kkmw== X-Gm-Message-State: AOAM532jTRI3kJ0xeuoy7RnBp0U4rH1c7I3N6xcU7ugK5FCyb/3JHV09 /YxwmIsnyIPDHa4LNLrqdORT2A== X-Received: by 2002:a17:902:ac89:b029:e6:d199:29ac with SMTP id h9-20020a170902ac89b02900e6d19929acmr30821425plr.46.1618955405560; Tue, 20 Apr 2021 14:50:05 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:bf8b:4b8b:2315:3719]) by smtp.gmail.com with ESMTPSA id c21sm31481pfo.91.2021.04.20.14.50.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Apr 2021 14:50:05 -0700 (PDT) From: Stephen Boyd To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Petr Mladek , Jiri Olsa , Alexei Starovoitov , Jessica Yu , Evan Green , Hsin-Yi Wang Subject: [PATCH v5 01/13] buildid: Only consider GNU notes for build ID parsing Date: Tue, 20 Apr 2021 14:49:51 -0700 Message-Id: <20210420215003.3510247-2-swboyd@chromium.org> X-Mailer: git-send-email 2.31.1.368.gbe11c130af-goog In-Reply-To: <20210420215003.3510247-1-swboyd@chromium.org> References: <20210420215003.3510247-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some kernel elf files have various notes that also happen to have an elf note type of '3', which matches NT_GNU_BUILD_ID but the note name isn't "GNU". For example, this note trips up the existing logic: Owner Data size Description Xen 0x00000008 Unknown note type: (0x00000003) description data: 00 00 00 ffffff80 ffffffff ffffffff ffffffff ffffffff Let's make sure that it is a GNU note when parsing the build ID so that we can use this function to parse a vmlinux's build ID too. Reported-by: Petr Mladek Cc: Jiri Olsa Cc: Alexei Starovoitov Cc: Jessica Yu Cc: Evan Green Cc: Hsin-Yi Wang Fixes: bd7525dacd7e ("bpf: Move stack_map_get_build_id into lib") Tested-by: Petr Mladek Signed-off-by: Stephen Boyd --- lib/buildid.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/buildid.c b/lib/buildid.c index 6156997c3895..e014636ec3eb 100644 --- a/lib/buildid.c +++ b/lib/buildid.c @@ -31,6 +31,7 @@ static inline int parse_build_id(void *page_addr, if (nhdr->n_type == BUILD_ID && nhdr->n_namesz == sizeof("GNU") && + !strcmp((char *)(nhdr + 1), "GNU") && nhdr->n_descsz > 0 && nhdr->n_descsz <= BUILD_ID_SIZE_MAX) { memcpy(build_id, -- https://chromeos.dev