Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1975634rwe; Fri, 2 Sep 2022 06:52:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR43sBuubxE39DRr9TaaXV/ej0e5SWJfqNataFbJ0BUUXq0xmDb301RglCKiUR+dk9PUWzH3 X-Received: by 2002:a17:902:76c5:b0:174:e586:f6e2 with SMTP id j5-20020a17090276c500b00174e586f6e2mr21289405plt.37.1662126741476; Fri, 02 Sep 2022 06:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662126741; cv=none; d=google.com; s=arc-20160816; b=J+GvQDgkALEu12bQdGLyYsitvn5eu+aypIKzBNXsef+ZXUZ04fNGlwn3vmxEbjZxkf nkW96Y/GO99IgVazSre2bdo8CJEkiMDcQIM1VlhhgOdk22G3pKpwy+7kILV6y4pISco5 RUyeiBqp1a42uqyzK0be6dXvFyMqam5qWdIqQF9AYdRjP/kZrCfJvB+l1Rf4ttxaNMgQ i8lmiUZQ2QVX4nS8VH24a+jY+Fzpgc4+a6qZXKQsHB15AxwAWq65vFblSEp7+Jjzk9DH nivcj3+kGnAhNMWsLTl67P9Un8Uvb9sBBPLFRNxb1bHx2b8e1njhodfSs7vTuMKbs2rs O6Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nK93VzCFMrH51XnHMQOdU0v9gh1axUFh0qNfBrJQMho=; b=z3Fv0kt6rnwpBYynFX1dzkYsLhVKBzPUWQAIqDkiL9gKMRobobpf+OvDbnn+YYhnuz /OBI/9RRAmMyXXTmQz6O0CKRlRj3SNG6kYLgfwNGwjBinZ2ZO+vDWMQle4dpd3x0Sp5C 8lxqd5+/4HrPthE/mbhkMOf11NuqPPW5QeKhr+O/YjizX4zxETz1MnvwkbriFJdS0Y3l +7YLS0aBxgtu0z49s6/0ajF3+PXk3JEKQdgPRUTj4EzFjsGHdNGO+wiIhrw+skBBlAAa niI9ked/e/7ABMMdOt7jxkIrNoHPhBlvMp+ZmDjL6ts2qQhIyFrrOMq0cBuZ7vjfy7Wo GDvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=KemuukuZ; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j17-20020a633c11000000b004068c3147fbsi1995309pga.543.2022.09.02.06.52.04; Fri, 02 Sep 2022 06:52:21 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=KemuukuZ; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237310AbiIBMl2 (ORCPT + 99 others); Fri, 2 Sep 2022 08:41:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237283AbiIBMi6 (ORCPT ); Fri, 2 Sep 2022 08:38:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADDFBAE85C; Fri, 2 Sep 2022 05:30:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E51C0B82A97; Fri, 2 Sep 2022 12:28:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B1C0C433D6; Fri, 2 Sep 2022 12:28:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662121715; bh=Yu+f+2LN0ZRMKFZsIVKOyv2KT+zvpzeRGg5lZYJ5WEU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KemuukuZDHgNt9irlYTJ4T3sQClvzWxrNfGRASQFYHQCIiaRhCOws3hQdK2NUbau5 E5bVI0bHRNe1Vz5h6S0Paqqsh7D1VoAzhlOPI+xk0QXCT4+AW43wsP6C5abUb6cZIQ rAso8jaLHFU7SwJA+N8i1lCBPRVHLrlzQ2p6F+SOIH4swWCWQKZZOiOkZVXTqGbMDu Xnrdn0rjFAkzQD/sv8B9BiYgZFOEdUeXX8C9DqJQmcCGuOwnLEzoUsLpSiFOUEgd0h upWvrlI4e5bXtPfUqX/3ZLXH5TuRt3hiRaD5CZbuWFz2RY7aElhwXQzLxhoS6YTSFS z8fpbLNx9Xp2g== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1oU5mo-0005CJ-QZ; Fri, 02 Sep 2022 14:28:39 +0200 Date: Fri, 2 Sep 2022 14:28:38 +0200 From: Johan Hovold To: Srinivas Kandagatla Cc: Johan Hovold , Amol Maheshwari , Greg Kroah-Hartman , Arnd Bergmann , Bjorn Andersson , Manivannan Sadhasivam , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/3] misc: fastrpc: fix memory corruption Message-ID: References: <20220829080531.29681-1-johan+linaro@kernel.org> <01bdf6e2-f72a-e114-f3d2-deccf55403b1@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01bdf6e2-f72a-e114-f3d2-deccf55403b1@linaro.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Fri, Sep 02, 2022 at 11:02:35AM +0100, Srinivas Kandagatla wrote: > Hi Johan, > > On 29/08/2022 09:05, Johan Hovold wrote: > > The fastrpc driver uses a fixed-sized array to store its sessions but > > missing and broken sanity checks could lead to memory beyond the array > > being corrupted. > > > > This specifically happens on SC8280XP platforms that use 14 sessions for > > the compute DSP. > > > Thanks for doing this. > > I see that we hit this issue once again, and the way we are fixing it is > not really scalable. We should really get rid of FASTRPC_MAX_SESSIONS. Yeah, I was a bit surprised to find that the underlying bugs (i.e. the incomplete sanity checks) weren't fixed the last time this memory corruption was reported: https://lore.kernel.org/all/1632123274-32054-1-git-send-email-jeyr@codeaurora.org/ > We should allocate the sessions dynamically based in the child node > count and qcom,nsessions. That sounds like it would be an improvement. But at least now you'll get an error message during probe rather than silent memory corruption when bringing up a new SoC that needs more than the current maximum number of sessions. Johan