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 360A03D9DA2 for ; Wed, 15 Apr 2026 15:16:42 +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=1776266203; cv=none; b=LS19fMqFlY13UZnquOOIligrHLFtZfDNDtC/k+tumfnh+i1Kd6OdeHF4bI6n3XqnTq71c4W9hRGog2o2VsbIzEnbGvKVfca40R7oILB2LsSUMPT9zSu8sL9GFGIDCQ0NtaGlU/PxUlEoeM2rj3SIZ37ohoMRua5TCE39cmHzR1k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776266203; c=relaxed/simple; bh=F4KGIvv+ekuAI3vB0oab0A2O4K7f+5iklLIkHdO7GE4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YDVPH2CI0hJ09bAdswZZpwIh4m9odr1tB9KAvhrj97+aNJceZ7aGR6n+QzRISLGibcyyqalM5bigvl7IBEnQ3DI/u0sTgFNIhpwNj4vEWwZrcpjXenLxEoHAilZSeqQ/QlA5fl9p1LyyXYc50V3vRZjBseWl5Ww83PQj8RRKMO4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PeixNtxt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PeixNtxt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA662C2BCB0; Wed, 15 Apr 2026 15:16:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776266202; bh=F4KGIvv+ekuAI3vB0oab0A2O4K7f+5iklLIkHdO7GE4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PeixNtxtIIhouZiupwJ0kiocY0agTOJ1lTQJehFJpOeWbTt4Y62gNEG451Pz5dP3N Ky1zY1/1mvTw0I4Np16cZTinUoY+/mwIjRkvcyH09ClXyVq9H52WUnUbECyKTRAJyJ cFW3CJeJK54JQAZUdzEk0QE0DGFHnFtU7w34bWqjFEOPUUe13MuzURzWVKfqVRKnxw 3cGdkxstCp180ToMwh89CrCSoL6xBGRJ3TzQ+PRC7ji8C2xudc2/MnL3aGmicQLJGo sz/4V4Zvw1i1O1on28DzgS3g4uar7rzZkQ36IhnAmCZdQbmr3rV2v93DpyUfdPixqG X0pJlD+a49eEw== Date: Wed, 15 Apr 2026 18:16:37 +0300 From: Mike Rapoport To: Pasha Tatashin Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, dmatlack@google.com, pratyush@kernel.org, skhawaja@google.com Subject: Re: [PATCH v4 01/11] liveupdate: Safely print untrusted strings Message-ID: References: <20260413185127.128180-1-pasha.tatashin@soleen.com> <20260413185127.128180-2-pasha.tatashin@soleen.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260413185127.128180-2-pasha.tatashin@soleen.com> On Mon, Apr 13, 2026 at 06:51:17PM +0000, Pasha Tatashin wrote: > Deserialized strings from KHO data (such as file handler compatible > strings and session names) are provided by the previous kernel and > might not be null-terminated if the data is corrupted. > > When printing these strings in error messages, use the %.*s format > specifier with the maximum buffer size to prevent out-of-bounds reads > into adjacent kernel memory. > > Signed-off-by: Pasha Tatashin > Reviewed-by: Pratyush Yadav (Google) Reviewed-by: Mike Rapoport (Microsoft) > --- > kernel/liveupdate/luo_file.c | 3 ++- > kernel/liveupdate/luo_session.c | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c > index 09103cf81107..8fcf302c73b6 100644 > --- a/kernel/liveupdate/luo_file.c > +++ b/kernel/liveupdate/luo_file.c > @@ -813,7 +813,8 @@ int luo_file_deserialize(struct luo_file_set *file_set, > } > > if (!handler_found) { > - pr_warn("No registered handler for compatible '%s'\n", > + pr_warn("No registered handler for compatible '%.*s'\n", > + (int)sizeof(file_ser[i].compatible), > file_ser[i].compatible); > return -ENOENT; > } > diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c > index 25ae704d7787..8c76dece679b 100644 > --- a/kernel/liveupdate/luo_session.c > +++ b/kernel/liveupdate/luo_session.c > @@ -544,7 +544,8 @@ int luo_session_deserialize(void) > > session = luo_session_alloc(sh->ser[i].name); > if (IS_ERR(session)) { > - pr_warn("Failed to allocate session [%s] during deserialization %pe\n", > + pr_warn("Failed to allocate session [%.*s] during deserialization %pe\n", > + (int)sizeof(sh->ser[i].name), > sh->ser[i].name, session); > return PTR_ERR(session); > } > -- > 2.43.0 > -- Sincerely yours, Mike.