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 61C461E1A17 for ; Thu, 27 Nov 2025 19:37:08 +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=1764272228; cv=none; b=ab5v3VNZfBzMjIQFT/lPY0IDuB7DzHSSNhgi94aQ5+I3sKBnjIgg3BIlucds535+wDIRHm42OEb+cAWa8r2AJeARE36MWFJAQ00kFA3d2/5zUlzvT+YgI7wuYaBJzYw16PCD/RcyzEbfnGj6fK4S5feAqY63mQWu38kGrDLQDUw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764272228; c=relaxed/simple; bh=jTQZG/LnU8/DhCvJo8hYRrS1O3MY+ahD+lg50BHNABE=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=Zqno2lWRt9UCv7HvqYRTJ8LmfxDXergdKqxRsLLQEcXp8LiOyZC28YIIWBcJ0KqvB3WrYjrztVWZ8Q3wMRficwRJHSwVxs8nWOSfyVhDq4G038l2NbiNNKidxrcq0djWkz+jzOc6LyLxDccXwzcxbXb4dwNh+qgHtkpEm0n+tHM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=VpvLKLXZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="VpvLKLXZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D9ABC4CEF8; Thu, 27 Nov 2025 19:37:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1764272227; bh=jTQZG/LnU8/DhCvJo8hYRrS1O3MY+ahD+lg50BHNABE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VpvLKLXZd0CEesapSP6Udlj0hUrCadlBugvB5kvILrll67bEFmKC0qCL1Iid0+1VI jIZhO1StMuZtB0NbiVKdkgWpF95+RoP+2rVt1nXLIq2iE9OD+mnDlRqwNIkTRUF1YI iiOctAAW/BUCY4dUm9/FModDOlKqgLQElsS/08BY= Date: Thu, 27 Nov 2025 11:37:06 -0800 From: Andrew Morton To: Yeoreum Yun Cc: catalin.marinas@arm.com, will@kernel.org, bhe@redhat.com, leitao@debian.org, coxu@redhat.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: kernel: initialize missing kexec_buf->random field Message-Id: <20251127113706.d89a84f277dab3ad273dde75@linux-foundation.org> In-Reply-To: <20251127182644.1577592-1-yeoreum.yun@arm.com> References: <20251127182644.1577592-1-yeoreum.yun@arm.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Thu, 27 Nov 2025 18:26:44 +0000 Yeoreum Yun wrote: > Commit bf454ec31add ("kexec_file: allow to place kexec_buf randomly") > introduced the kexec_buf->random field to enable random placement of > kexec_buf. > > However, this field was never properly initialized for kexec images > that do not need to be placed randomly, leading to the following UBSAN > warning: > > [ +0.364528] ------------[ cut here ]------------ > [ +0.000019] UBSAN: invalid-load in ./include/linux/kexec.h:210:12 > [ +0.000131] load of value 2 is not a valid value for type 'bool' (aka '_Bool') > [ +0.000003] CPU: 4 UID: 0 PID: 927 Comm: kexec Not tainted 6.18.0-rc7+ #3 PREEMPT(full) > [ +0.000002] Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015 > [ +0.000000] Call trace: > [ +0.000001] show_stack+0x24/0x40 (C) > [ +0.000006] __dump_stack+0x28/0x48 > [ +0.000002] dump_stack_lvl+0x7c/0xb0 > [ +0.000002] dump_stack+0x18/0x34 > [ +0.000001] ubsan_epilogue+0x10/0x50 > [ +0.000002] __ubsan_handle_load_invalid_value+0xc8/0xd0 > [ +0.000003] locate_mem_hole_callback+0x28c/0x2a0 > [ +0.000003] kexec_locate_mem_hole+0xf4/0x2f0 > [ +0.000001] kexec_add_buffer+0xa8/0x178 > [ +0.000002] image_load+0xf0/0x258 > [ +0.000001] __arm64_sys_kexec_file_load+0x510/0x718 > [ +0.000002] invoke_syscall+0x68/0xe8 > [ +0.000001] el0_svc_common+0xb0/0xf8 > [ +0.000002] do_el0_svc+0x28/0x48 > [ +0.000001] el0_svc+0x40/0xe8 > [ +0.000002] el0t_64_sync_handler+0x84/0x140 > [ +0.000002] el0t_64_sync+0x1bc/0x1c0 > > To address this, initialise kexec_buf->random field properly. > > Fixes: bf454ec31add ("kexec_file: allow to place kexec_buf randomly") Thanks, I'll add a cc:stable to this.