Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3352933rwb; Fri, 9 Dec 2022 13:20:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Kr9liZtswKEjxaZc7aX0/Xhj6xD7KNGaf/ITRrkFQURLwCVcHkO4CO9O2r6TgipcKKplW X-Received: by 2002:a05:6a20:d696:b0:9d:efbe:2052 with SMTP id it22-20020a056a20d69600b0009defbe2052mr12048838pzb.8.1670620846373; Fri, 09 Dec 2022 13:20:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670620846; cv=none; d=google.com; s=arc-20160816; b=SahOk59U0PVrqFIV07+MbkJ/+udlnlyKK94r+nEuphGJiO2xVdOn5sntIypzEogcSH bph1L1wSdVBDxn0E2aG85sTkqRvmaGbVEGIUH7aw7nKH1+7nmFJtAS5fobM0S/ENTwV+ qoeMYLo3vZKLa7Msq5l7eHbbjhLRkVoF40Elz1oSl78eCgLTcvUo/c1e9/mLkweJN5Zo rJFRKRKEaJCZZK7dR56ZUGZLxpO+IpVA3oJs38I0qaNDgZBr5ErG8pNeTyeywtRvQ5ys dVicPeTo8AkoZ/z6jpw0h5Ea8kIIJads7yZM3+/y5zWKjDFE5PjpXZWd1bvbXPkAAXfx HxhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:subject:message-id:date:user-agent:from :references:in-reply-to:mime-version:dkim-signature; bh=Jj9hWgWY6DzifYBIvFgTsPapdUtki3fp8cPuRUAv5cU=; b=crLa0ywLUlw/28L0xNY9Cl4FjJInQzn5wAvPHLt4bx/w7yxY1YQ/Ux0E9nkGTvn27f LsOpi4xvHsQQHmHk0mnt2oY8cD8gOdgnlf3xHRnT5Zm8IGEsvWVRFU3YbwZvYoAlUCVP upxAkBpkJEA3n5KgakWE19mbofxGxci2Bl5S9hWUVtQtGVGJ/9LwbMjWbC0Oylvgstzd pj1Y0nOKG3PnOmNwXbkqyolZhoa8dY/MgEflKmonIR487wmMIqZikQFp6meLNFCHBiyz vKGAeUBZrz3n2GhyI+FIaNE5rFFQ4S0eI9jfmGiUq3iI8EQ+gSD7FiNevDDdaaR9vHoi TH0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=X31Hflyu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v23-20020a63f857000000b0043caa6f1189si2480591pgj.786.2022.12.09.13.20.36; Fri, 09 Dec 2022 13:20:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=X31Hflyu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229745AbiLIUwt (ORCPT + 74 others); Fri, 9 Dec 2022 15:52:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbiLIUwp (ORCPT ); Fri, 9 Dec 2022 15:52:45 -0500 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97246BC3B for ; Fri, 9 Dec 2022 12:52:44 -0800 (PST) Received: by mail-lf1-x12d.google.com with SMTP id y25so8815931lfa.9 for ; Fri, 09 Dec 2022 12:52:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=to:subject:message-id:date:user-agent:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Jj9hWgWY6DzifYBIvFgTsPapdUtki3fp8cPuRUAv5cU=; b=X31HflyuE5ExTUYKMZ1LI6Zs0Si1rbwcCV0qulY4VPQABapKV1wmpSmX/nGbkzAnmw TjBWIsDUbIp5E5tcwg8VNeaaOXjFuSy0izUKNbCG0L7ODuVA+52P9IjqO7baKVkHEyva bLyvN2Dc5Jh+lO5z/Eib+he9nr+J4Jtu6tr8U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:user-agent:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Jj9hWgWY6DzifYBIvFgTsPapdUtki3fp8cPuRUAv5cU=; b=Xoa0RrCQFPzPST7NXDaFTMYgvO5SlloObPvvQOaIo50KolVe3Oyf4fSbEw7zyUNtu8 4C+cEDEhzdGoiYMoigc9M0P+z8rOI6tF3NwozBXXfh6xJp0Fs1aBFvk3EbrGX5+ro6YO jiCnJSPj1IfvAiHDIZf3irgWinZrRjspP0r5Le+vgLOfWS/bOfhWdczcfsu3jYLJhRmn ra8dRg03HsH5Kp4paY97RqxCwJ91EPdwt3HPA2/nri/h1j8eWG0ebkR2jqpIHiZAeJs0 Pcgr+SXd1+fYn0+iOSCFab/0ZiLkEM7uHZs1iM7M8Fms+eXpVZ3OEgbsNjbzFUE7BDYL iCRw== X-Gm-Message-State: ANoB5plpzySppwWXTRvgsekUj4SbQkRJTP+NdbKgqVqF6+ErlVFnv9Lu 49jQh6PF51gUIuSmXIa3Kfat02zK475ZeUZzKdde/w== X-Received: by 2002:ac2:5e37:0:b0:4a2:4d72:6cc2 with SMTP id o23-20020ac25e37000000b004a24d726cc2mr35867808lfg.511.1670619162961; Fri, 09 Dec 2022 12:52:42 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Fri, 9 Dec 2022 15:52:42 -0500 MIME-Version: 1.0 In-Reply-To: References: <1669897248-23052-1-git-send-email-quic_srivasam@quicinc.com> From: Stephen Boyd User-Agent: alot/0.10 Date: Fri, 9 Dec 2022 15:52:42 -0500 Message-ID: Subject: Re: [PATCH] remoteproc: elf_loader: Update resource table name check To: Srinivasa Rao Mandadapu , agross@kernel.org, andersson@kernel.org, bgoswami@quicinc.com, broonie@kernel.org, devicetree@vger.kernel.org, judyhsiao@chromium.org, krzysztof.kozlowski@linaro.org, lgirdwood@gmail.com, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, mathieu.poirier@linaro.org, perex@perex.cz, quic_plai@quicinc.com, quic_rohkumar@quicinc.com, robh+dt@kernel.org, srinivas.kandagatla@linaro.org, tiwai@suse.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Srinivasa Rao Mandadapu (2022-12-08 05:40:54) > > On 12/7/2022 7:25 AM, Stephen Boyd wrote: > Thanks for Your Time Stephen!!! > > Quoting Srinivasa Rao Mandadapu (2022-12-01 04:20:48) > >> Update resource table name check with sub string search instead of > >> complete string search. > >> In general Qualcomm binary contains, section header name > >> (e.g. .resource_table), amended with extra string to differentiate > >> with other sections. > >> So far Android adsp binaries are being authenticated using TZ, > >> hence this mismatch hasn't created any problem. > >> In recent developments, ADSP binary is being used in Chrome based > >> platforms, which doesn't have TZ path, hence resource table is > >> required for memory sandboxing. > >> > > Does this need a Fixes tag? > I don't think so. I feel It's kind of enhancement. > > > >> Signed-off-by: Srinivasa Rao Mandadapu > >> --- > >> drivers/remoteproc/remoteproc_elf_loader.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/drivers/remoteproc/remoteproc_elf_loader.c b/drivers/remoteproc/remoteproc_elf_loader.c > >> index 5a412d7..0feb120 100644 > >> --- a/drivers/remoteproc/remoteproc_elf_loader.c > >> +++ b/drivers/remoteproc/remoteproc_elf_loader.c > >> @@ -272,7 +272,7 @@ find_table(struct device *dev, const struct firmware *fw) > >> u64 offset = elf_shdr_get_sh_offset(class, shdr); > >> u32 name = elf_shdr_get_sh_name(class, shdr); > >> > >> - if (strcmp(name_table + name, ".resource_table")) > >> + if (!strstr(name_table + name, ".resource_table")) > > Was the strcmp not working before because the 'name_table' has something > > else in it? It really looks like your elf file is malformed. > > Actually, DSP binary is prepared by combining different elfs. So Section > header names are appended with > > something else to distinguish same section name of different elfs, by > using some Qualcomm specific QURT scripts. > Hence final binary contains resource_table name appended with module > specific name. > > So this patch is required to handle such modified name. > Can you clarify how the section header name looks? Probably you can objdump the section here and provide that information to help us understand. I think remoteproc_elf_loader.c assumes the ELF file is properly formed. There should be a section named '.resource_table', so the strcmp will find it by looking at the section header names.