From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC02F1CB321; Tue, 1 Oct 2024 18:35:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807737; cv=none; b=j3HTdf5bG3zHP1zfztV/7RYxzp11051ux9NDubLwa6OYOf6XfsSYkCFSs+0usLWZ57Zbe8vr8xlAdJzbEFj2v9snXajCdg4YeohRkR3CENrvQm/V67AtS0N3wXfL2LNK+fapfsKw3+TSGf34Q4GgJqVQayKrZ6DtVNdlGD1px2M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727807737; c=relaxed/simple; bh=2FQsdtksF1hKm/sO3z89H6wen6IaATwa1QglsLLLZdU=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=e4d53vmMqJu6kvnu2m0LTRyAye348uo7dtF2ZCGABuo7idUKGPpaNnGjXc2q7OgPFMWQJgXqlmB9ywEjn5klbF7FCxx/VtJ7B+JGKrJ3emOToCOiYIJn4bCYlZL+S3XXrBuln3vwP6nylvVNjpnfnkA+huKV8dkKK1foks/Xn5o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60E37C4CEC6; Tue, 1 Oct 2024 18:35:35 +0000 (UTC) Date: Tue, 1 Oct 2024 14:36:24 -0400 From: Steven Rostedt To: Indu Bhagat Cc: Josh Poimboeuf , x86@kernel.org, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , linux-perf-users@vger.kernel.org, Mark Brown , linux-toolchains@vger.kernel.org, Jordan Rome , Sam James Subject: Re: [PATCH v2 03/11] unwind: Introduce SFrame user space unwinding Message-ID: <20241001143624.08291d00@gandalf.local.home> In-Reply-To: References: <20240914072358.4afad691@rorschach.local.home> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-toolchains@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 1 Oct 2024 11:20:35 -0700 Indu Bhagat wrote: > > So we trust user space to have this table sorted? > > > > GNU ld will create this table sorted when linking .sframe sections and > will set SFRAME_F_FDE_SORTED in flags in the output .sframe section. In > the current patch, I see the __sframe_add_section () includes a check > for SFRAME_F_FDE_SORTED for admitting SFrame sections. > > So proceeding here with the assumption that the SFrame FDE list is > sorted should work fine. No not at all! We *cannot trust* user space. This could lead to a security hole if we assume it's sorted. The kernel must not trust anything it receives from user space. Because an attacker will be looking for ways to confuse the kernel to exploit it. When I look at code that reads user space, I do not look at it as if it were made by the compiler. I look at it as if it were made by someone that's trying to find ways to crack the system. Every read from user space *must* be validated *every* time it's read. It can not even validate it once and then think its immutable (unless the kernel actually made it immutable). -- Steve