From nobody Mon Feb 9 13:57:50 2026 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 DC39B27586C for ; Mon, 19 Jan 2026 03:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768793207; cv=none; b=JeR51tVEFcSi5KBjEd0gFVvSvSfPKUZeuJvnL0FGJYAosYXsHAahoATLcvpYtS0SuVO+Ey16OtIcmnVVz3jxi+kEIhyRsQMxDNT7PPzIbxg6Vs0/hkv/vEzk5ZrBGXaPni2SPyM2yGjLeKmaGu4q5F9cE41B6aO0xyFr5vJ1GWQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768793207; c=relaxed/simple; bh=aEw1imkLf5wrWkotMxEW4yfr8s+cq8tJZ3ShfO4l2Ts=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q/5KTIm7Mv6+31l6YlxfTNsw3jLoXNJjeXnkf1LRIUZk9eu07J5LC7T4GGx3S8CBVfvLPZ9Ur6rYlOi1K3FqQTA98bTrJcoYfCzWxltalw/GdcAuH2ug/9pK48KZMrhOb+JiYeaMpA3xh6fRuZv+xOzvMCCJ6IVm3k3ov8MIRLU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=esOhLfAw; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="esOhLfAw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768793203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yw3aB1Il7lON1+TKtraAyWydt+eFZrLxkMUyC2AOIMc=; b=esOhLfAwfj6xKGipkVoorIMkn1Za+Yo48DAN/tuU62/appbPKhoeaXgn39WLSFz/LWoILu o34K1Is9WuNYOgRABo7LhNnsVd690s3/d5hIIeZwxGYRV/7nDB8N9erz+BqYMBZzCAsSEU XrDxqIQTLP4G2rBBayDMTFscCGM0QIA= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-256-oldMCqooNXCBv0xnVXj0ww-1; Sun, 18 Jan 2026 22:26:40 -0500 X-MC-Unique: oldMCqooNXCBv0xnVXj0ww-1 X-Mimecast-MFC-AGG-ID: oldMCqooNXCBv0xnVXj0ww_1768793198 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E08771956046; Mon, 19 Jan 2026 03:26:37 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.72.112.74]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5642F1955F22; Mon, 19 Jan 2026 03:26:26 +0000 (UTC) From: Pingfan Liu To: kexec@lists.infradead.org Cc: Pingfan Liu , "David S. Miller" , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , Jeremy Linton , Catalin Marinas , Will Deacon , Ard Biesheuvel , Simon Horman , Gerd Hoffmann , Vitaly Kuznetsov , Philipp Rudo , Viktor Malik , Jan Hendrik Farr , Baoquan He , Dave Young , Andrew Morton , bpf@vger.kernel.org, systemd-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCHv6 07/13] kexec_file: Implement copy method for parser Date: Mon, 19 Jan 2026 11:24:18 +0800 Message-ID: <20260119032424.10781-8-piliu@redhat.com> In-Reply-To: <20260119032424.10781-1-piliu@redhat.com> References: <20260119032424.10781-1-piliu@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" Copying the bpf code parsing result to the proper place: image->kernel_buf, initrd_buf, cmdline_buf. Signed-off-by: Pingfan Liu Cc: Baoquan He Cc: Dave Young Cc: Andrew Morton Cc: Philipp Rudo To: kexec@lists.infradead.org --- kernel/kexec_bpf_loader.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/kernel/kexec_bpf_loader.c b/kernel/kexec_bpf_loader.c index bd6a47fc53ed3..5ad67672dead1 100644 --- a/kernel/kexec_bpf_loader.c +++ b/kernel/kexec_bpf_loader.c @@ -82,6 +82,7 @@ static int __init kexec_bpf_prog_run_init(void) late_initcall(kexec_bpf_prog_run_init); =20 #define KEXEC_BPF_CMD_DECOMPRESS 0x1 +#define KEXEC_BPF_CMD_COPY 0x2 =20 #define KEXEC_BPF_SUBCMD_KERNEL 0x1 #define KEXEC_BPF_SUBCMD_INITRD 0x2 @@ -281,6 +282,32 @@ static int kexec_buff_parser(struct bpf_parser_context= *parser) } } break; + case KEXEC_BPF_CMD_COPY: + p =3D __vmalloc(cmd->payload_len, GFP_KERNEL | __GFP_ACCOUNT); + if (!p) + return -ENOMEM; + memcpy(p, buf, cmd->payload_len); + switch (cmd->subcmd) { + case KEXEC_BPF_SUBCMD_KERNEL: + vfree(ctx->kernel); + ctx->kernel =3D p; + ctx->kernel_sz =3D cmd->payload_len; + break; + case KEXEC_BPF_SUBCMD_INITRD: + vfree(ctx->initrd); + ctx->initrd =3D p; + ctx->initrd_sz =3D cmd->payload_len; + break; + case KEXEC_BPF_SUBCMD_CMDLINE: + vfree(ctx->cmdline); + ctx->cmdline =3D p; + ctx->cmdline_sz =3D cmd->payload_len; + break; + default: + vfree(p); + break; + } + break; default: break; } --=20 2.49.0