From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E28DFC38145 for ; Fri, 2 Sep 2022 12:41:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237164AbiIBMla (ORCPT ); Fri, 2 Sep 2022 08:41:30 -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> 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