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 2DD3A38836A for ; Tue, 21 Apr 2026 10:25:56 +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=1776767157; cv=none; b=CbadtrP7cdvKkLDOmgznSKQGP2NtXRhPwXaGSk/9KMt+/40L0zv/o6rIG2SrPK444z50yZ7Gfhn2rhrcZSmK9YmR+zqyVJLDkKXU5NsUdngxBbBWXDaJEdGI4Eiuk+OP13FLuoAF281TJ7llHua3gZQSxxPtKlWB1yB340atm4w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776767157; c=relaxed/simple; bh=4loqqwmVByZydFOLKx4Df/CNcWTPfKogyfRe2H/uC1g=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Y0n/3ZBclolanNAdhr7eyl0lNNn/V2H5VsEvc4aOSd2lGefInn09BMsdRcn4W2ZeRdR2sxojL6SHkW3yo+XExYDqrT38QZJklwnjrLk71g8jmPKKBQPlp3iZcA+8IW3KYrlSQYVHxjBbVjAGXHmvvKhabSRmkzpPxn3AE6EtNwE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=d3h4oYPq; 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="d3h4oYPq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D91BC2BCB0; Tue, 21 Apr 2026 10:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776767156; bh=4loqqwmVByZydFOLKx4Df/CNcWTPfKogyfRe2H/uC1g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=d3h4oYPqihpDwu5jSY38mVpZvUnUftD4h+6bma3bEJMXePM1uyAyqvqpKcJrwoX44 KFvKUNwjb6SdyFGKEnZVVEQeGNKrAicp+kuBGrEk50YddCWx0cx1Ikf0+EldqBmVq2 y4DfQf3+KDm0FgFPMk9pXTsiublJYe4zkXGKBuybI9Z1zprMIyWL2DRXsSJXjztf65 +JJTUzxIrKJ9ZtkqOkBAP8rQEU5aNZijRMUEg4CkYuyDYdXTXnNySYoOTjPIiFnxAq hmLPaS3U/0RNf+6kxU+Dr1CBJi2hjiHDfRjEKSFa03BAxuMGnWNGMxbq1UlamIGsgc 36Wgw6s5N+4tw== Date: Tue, 21 Apr 2026 13:25:50 +0300 From: Mike Rapoport To: luca.boccassi@gmail.com Cc: kexec@lists.infradead.org, linux-mm@kvack.org, graf@amazon.com, pasha.tatashin@soleen.com, pratyush@kernel.org, brauner@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v9 2/6] selftests/liveupdate: add test cases for LIVEUPDATE_IOCTL_CREATE_SESSION calls with invalid length Message-ID: References: <20260420141741.2688371-1-luca.boccassi@gmail.com> <20260420141741.2688371-3-luca.boccassi@gmail.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: <20260420141741.2688371-3-luca.boccassi@gmail.com> On Mon, Apr 20, 2026 at 03:15:10PM +0100, luca.boccassi@gmail.com wrote: > From: Luca Boccassi > > Verify that LIVEUPDATE_IOCTL_CREATE_SESSION ioctl which provide a name > that is an empty string or too long are not allowed. > > Signed-off-by: Luca Boccassi > Reviewed-by: Pasha Tatashin Acked-by: Mike Rapoport (Microsoft) > --- > .../testing/selftests/liveupdate/liveupdate.c | 42 +++++++++++++++++++ > 1 file changed, 42 insertions(+) > > diff --git a/tools/testing/selftests/liveupdate/liveupdate.c b/tools/testing/selftests/liveupdate/liveupdate.c > index c2878e3d5ef9..f0a8e600c154 100644 > --- a/tools/testing/selftests/liveupdate/liveupdate.c > +++ b/tools/testing/selftests/liveupdate/liveupdate.c > @@ -345,4 +345,46 @@ TEST_F(liveupdate_device, preserve_unsupported_fd) > ASSERT_EQ(close(session_fd), 0); > } > > +/* > + * Test Case: Create Session with No Null Termination > + * > + * Verifies that filling the entire 64-byte name field with non-null characters > + * (no '\0' terminator) is rejected by the kernel with EINVAL. > + */ > +TEST_F(liveupdate_device, create_session_no_null_termination) > +{ > + struct liveupdate_ioctl_create_session args = {}; > + > + self->fd1 = open(LIVEUPDATE_DEV, O_RDWR); > + if (self->fd1 < 0 && errno == ENOENT) > + SKIP(return, "%s does not exist", LIVEUPDATE_DEV); > + ASSERT_GE(self->fd1, 0); > + > + /* Fill entire name field with 'X', no null terminator */ > + args.size = sizeof(args); > + memset(args.name, 'X', sizeof(args.name)); > + > + EXPECT_LT(ioctl(self->fd1, LIVEUPDATE_IOCTL_CREATE_SESSION, &args), 0); > + EXPECT_EQ(errno, EINVAL); > +} > + > +/* > + * Test Case: Create Session with Empty Name > + * > + * Verifies that creating a session with an empty string name fails > + * with EINVAL. > + */ > +TEST_F(liveupdate_device, create_session_empty_name) > +{ > + int session_fd; > + > + self->fd1 = open(LIVEUPDATE_DEV, O_RDWR); > + if (self->fd1 < 0 && errno == ENOENT) > + SKIP(return, "%s does not exist", LIVEUPDATE_DEV); > + ASSERT_GE(self->fd1, 0); > + > + session_fd = create_session(self->fd1, ""); > + EXPECT_EQ(session_fd, -EINVAL); > +} > + > TEST_HARNESS_MAIN > -- > 2.47.3 > -- Sincerely yours, Mike.