From nobody Sun Dec 6 20:46:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1796241695; cv=none; d=zohomail.com; s=zohoarc; b=M5lnwPkCQRA7Bc/UleMgJl79cxZ6PZMBCkzzCFx+lP0RZruUwBjp0P7/IL9YmbYEVGpUmYe+aBjVlt3iElaF+mc/Z6hLWIWjfVFK/EerNHHa4rO697V72nlNJdE8TXp8MO7CpE5phdbEaWyuBxsVss/gAi4QMRRe+5D8fjV85BE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1796241695; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4ubRrLnfk9YacMe7fqV+oF9z1tbaJef2u3VdMCjooQ0=; b=b4zhzg2Xf86OBeYHGaQCtLDsy6hS7sRvRslNuZ3Q2djnOqR/pue6XE72IBAMNhpMqC21z78OvvP6Gy9+hbcmJqKzO7fdKqHgqH4U8eCIEgZBMqPKwPlBMQ6fZt/ZbVssYnRcy6J9XqQSL8Ttw41QOCqvaJhxgd3aQe4tBwBzpj4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1796241695780902.6094378748226; Wed, 2 Dec 2026 12:01:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xYqVf-0005N3-SF; Wed, 02 Dec 2026 15:00:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYqVS-0005Jt-J7; Wed, 02 Dec 2026 15:00:47 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYqVQ-0000Tu-Io; Wed, 02 Dec 2026 15:00:46 -0500 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2J57i83878975; Wed, 2 Dec 2026 20:00:39 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j7pmtbph8-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 02 Dec 2026 20:00:38 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2J4I4d2859128; Wed, 2 Dec 2026 20:00:38 GMT Received: from smtprelay06.wdc07v.mail.ibm.com ([172.16.1.73]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4jaajsb8uq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Dec 2026 20:00:38 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay06.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B2K0avw18219584 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Dec 2026 20:00:36 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8E8BD58043; Wed, 2 Dec 2026 20:00:36 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D8DA58055; Wed, 2 Dec 2026 20:00:34 +0000 (GMT) Received: from fedora-workstation.ibmuc.com (unknown [9.61.19.152]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 2 Dec 2026 20:00:34 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=4ubRrLnfk9YacMe7f qV+oF9z1tbaJef2u3VdMCjooQ0=; b=TeHdSLx3gazro2Qf6q5jgY3ls897bhHkS 1oajA7vsQ5KoIuItkIepFiCraltGP8NfQtKSLKAqm0JohQ+Ord2d48BQZlZ0fEpb /8Q86zcK/bcknpkV2uJZXTJt827z5kQekCEui7YqL/cjGQsu8OuvCa5k8+SNMfpL pc3ShN+4/qCYo24dH0Xpv/kZRVtKYO6ZQQLRC30o/5RLyLtQEdccC2bhgcYCipkr uKFQdYKZ+JgvIE2J7vx+GBudwRxMSDFPHKORRqKQss0jotl3mNSB/VL20yX6V+az ePinkWCXowwUBQJGUNF931wBPnL+yZjbnp/k3SxYNFDCVXONVpm6Q== From: Zhuoying Cai To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Cc: jrossi@linux.ibm.com, zycai@linux.ibm.com, borntraeger@linux.ibm.com, jdaley@linux.ibm.com, pasic@linux.ibm.com, farman@linux.ibm.com, mjrosato@linux.ibm.com, richard.henderson@linaro.org, iii@linux.ibm.com, david@kernel.org, cohuck@redhat.com, walling@linux.ibm.com, jjherne@linux.ibm.com Subject: [PATCH v1 1/4] s390/ipl: Compute and store SHA256 fingerprint per boot certificate Date: Wed, 2 Dec 2026 15:00:25 -0500 Message-ID: <20261202200028.81527-2-zycai@linux.ibm.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202200028.81527-1-zycai@linux.ibm.com> References: <20261202200028.81527-1-zycai@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 9TbhcUToD3pgyJG_5NhI0Z8DFMzXhd9r X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDA3OCBTYWx0ZWRfX7qnQSjFcyyDU QFhO1qxfulovF5ITvH/sy5LOS5nUfYRIHs4zX0UgODrcBLfK+Wb3empzbMueWMeVSs/kUW6SeQr 5MsE2UB2lq+DSWk+hwJZSH6pi5k5igxrNDoxbCGBk4G3ODjtzVFaHo+zpU3NET00+1IOHz2Trhi iNTDTGQR6lZYied39StYatiNokpCp8SwT2bAW9jVxywAKEL/AHzIhIsJjHA/Q5lzY8PDH9Ak5b1 uz3+6ycxAmtOYaRElkiKO6o8Q//hbWpmaImIuxuSkDbtmB1CWlzjjzgUndg5bkKNSrOwW6S8coG hHH0S2egaogJTVJ8PRomzybcD+ibK1cBKYAxoDEkpuljZMphHa2VO91WGKzIFu0imtVHhZpoSx/ ASD88BDM0gpYvU3iETsZehnqVxNVT2BkabJbvOI8Eqm+4bFsouG8GY6oKy/VqMcYNAenVXl2OBv GQAXDa7fa9doGf4MDVQ== X-Proofpoint-GUID: 9TbhcUToD3pgyJG_5NhI0Z8DFMzXhd9r X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDA3OCBTYWx0ZWRfX0phc6pCJ3fTn sBzBGVXDgAlSpUYiusOsOUXu48DUgfCfATiKQXwLX5VXsGNm1bIv60whwwRLA0aZLXaaFPOOxJ1 mkcfDRtRXwSzuhecgxkIpQxMib3m8k8= X-Authority-Analysis: v=2.4 cv=U9cHnuru c=1 sm=1 tr=0 ts=6b1078e7 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=Lvsl7FoPjaHyT11ZHDQA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-02_05,2026-12-02_07,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 phishscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 clxscore=1011 spamscore=0 priorityscore=1501 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020078 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=zycai@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1796241697484158500 Content-Type: text/plain; charset="utf-8" Add a fingerprint[] field to S390IPLCertificate and populate it during certificate store initialization. This provides a stable certificate identifier for upcoming migration validation. Signed-off-by: Zhuoying Cai --- hw/s390x/cert-store.c | 14 ++++++++++++++ hw/s390x/cert-store.h | 1 + 2 files changed, 15 insertions(+) diff --git a/hw/s390x/cert-store.c b/hw/s390x/cert-store.c index c086e75f75..1e4a4c8820 100644 --- a/hw/s390x/cert-store.c +++ b/hw/s390x/cert-store.c @@ -28,6 +28,7 @@ static S390IPLCertificate *init_cert(char *path, Error **= errp) { int rc; size_t size; + size_t fp_len; size_t der_len; char name[CERT_NAME_MAX_LEN]; g_autofree char *buf =3D NULL; @@ -52,6 +53,19 @@ static S390IPLCertificate *init_cert(char *path, Error *= *errp) } =20 cert =3D g_new0(S390IPLCertificate, 1); + + fp_len =3D QCRYPTO_HASH_DIGEST_LEN_SHA256; + rc =3D qcrypto_get_x509_cert_fingerprint((uint8_t *)buf, size, + QCRYPTO_HASH_ALGO_SHA256, + cert->fingerprint, &fp_len, + &local_err); + if (rc !=3D 0) { + error_propagate_prepend(errp, local_err, + "Failed to get fingerprint for %s: ", path= ); + g_free(cert); + return NULL; + } + cert->size =3D size; /* * Store DER length only - reused for size calculation. diff --git a/hw/s390x/cert-store.h b/hw/s390x/cert-store.h index 6f5ee63177..bcd522555b 100644 --- a/hw/s390x/cert-store.h +++ b/hw/s390x/cert-store.h @@ -19,6 +19,7 @@ =20 struct S390IPLCertificate { uint8_t name[CERT_NAME_MAX_LEN]; + uint8_t fingerprint[QCRYPTO_HASH_DIGEST_LEN_SHA256]; size_t size; size_t der_size; uint8_t *raw; --=20 2.56.1 From nobody Sun Dec 6 20:46:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1796241736; cv=none; d=zohomail.com; s=zohoarc; b=dbCNfQqiyufiBLFzY3a1VcB3WFHtLOJaYk7D/MAjnsze5XarOneconfVU2u6JebUOiWqNWKs7rho1xW7mMpgUaNwX1MfSnQZOcOxMgaYOrdtWiH3xHKx4cf41mGoXfZepoBDvWISdM2bL9pBQUCN5c6iemMhTdWs5DVKGWCshZQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1796241736; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3jHejet4NVkMWXgONI9CJfCUyGi52MRdQUvtdcqKuXU=; b=Hn1V04ZjFTq8u6ZAe1h6OvdT+Hq2Uv1KtSeHsc9V2mZVNvHMKTtys/bmKYxe+aq/TIzjbaMSKUngjM0fjKu4iHItUJj9JTjTjiqwZW7q+LOy5A66n6FQ1bwSjB1LXlwmWnaTdkp9Wf8SyrDimZvnkR3OY04ZKhHuFRfm9bxCYRs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1796241736650296.0646397378682; Wed, 2 Dec 2026 12:02:16 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xYqVe-0005MB-SM; Wed, 02 Dec 2026 15:00:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYqVS-0005Ju-JE; Wed, 02 Dec 2026 15:00:47 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYqVP-0000Ty-S2; Wed, 02 Dec 2026 15:00:46 -0500 Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2J4hB41314029; Wed, 2 Dec 2026 20:00:40 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j7pkube23-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 02 Dec 2026 20:00:40 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2J4ISN2446565; Wed, 2 Dec 2026 20:00:39 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4ja0pq5gfa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Dec 2026 20:00:39 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B2K0bIV60817918 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Dec 2026 20:00:38 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A61F858043; Wed, 2 Dec 2026 20:00:37 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A810158059; Wed, 2 Dec 2026 20:00:36 +0000 (GMT) Received: from fedora-workstation.ibmuc.com (unknown [9.61.19.152]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 2 Dec 2026 20:00:36 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=3jHejet4NVkMWXgON I9CJfCUyGi52MRdQUvtdcqKuXU=; b=SDrhy+vfxTqlx6b3rxha376o/xsyj8RMc tXZPhOjKZZAMA+9a0+ipaUcP+TDkZDib4fhprz55WVtI+FsD8lQInF/6cpqNHFwK xGnBmso+73xLuJF+30QHiMmrxFXnKBb5vpJnnUgmfGN0GAG2aLZ42rYpK//9E4Qh AeZKgXm/FEXVASMHeKVdg6a8RfAMDKLPmieM/DcaRhC2HMdzuuSRVpU/80Q5K6sU 9xUyCZZVIbk4tl1mIQ8YmPV9DazFP5M46H0fpVwaPWYprWLXoR/mrd8zSgImVfSe 38HAqKC9MXJnqnKhEaycVYtoamQBxxvhoOhHIqnSl6VI99vr/1E5A== From: Zhuoying Cai To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Cc: jrossi@linux.ibm.com, zycai@linux.ibm.com, borntraeger@linux.ibm.com, jdaley@linux.ibm.com, pasic@linux.ibm.com, farman@linux.ibm.com, mjrosato@linux.ibm.com, richard.henderson@linaro.org, iii@linux.ibm.com, david@kernel.org, cohuck@redhat.com, walling@linux.ibm.com, jjherne@linux.ibm.com Subject: [PATCH v1 2/4] s390/ipl: Track boot certificates used during signature verification Date: Wed, 2 Dec 2026 15:00:26 -0500 Message-ID: <20261202200028.81527-3-zycai@linux.ibm.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202200028.81527-1-zycai@linux.ibm.com> References: <20261202200028.81527-1-zycai@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=KZZHIgYD c=1 sm=1 tr=0 ts=6b1078e8 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VnNF1IyMAAAA:8 a=3LCEEFip5ntj6TRCZlkA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDA3OCBTYWx0ZWRfX/LhJ95oxRhvj 1lqq/AW5UL8MeGt2l01dxoXoiGHvDXqKV58rKgNyZiKOa4UAP/Pc49V4dQmsvePtB+qhMgeqw6T ktNIMK1SOhgXD3hHmn6p5eSCAOh02ZaiUONRQYMWlJOU//6wnajH/oluEn9/mBcwnarWYLIqGhj gGSSJztiokV28WQUukpFyN4i6AKpnKEeBUdSrDDVRfGQgWWh0lRDmG3GVuULpmwqmWwlbrpYqpn e8k249riaQP2cbwCqF4LoMadI4czksQmYqlx2FycU32ZEvhkINYxcuOkIuzw4IIZ0ui9Ds0iNgG Y2VP/LSFbHcb3gMDg7i3b79J1mTpZQJX2tYIMYqh6rns19O3N3rx3Zmn4abzT9JTYgB+BSzu/Ed qwna3aNDtYNfCNfNczhJxCqYBu60WjiRypb996RT3veo0GeDQWkhpC7HCLn0Mwm6ZWo5hHGyDrs dMTzWCIr7BPTidaPkTQ== X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDA3OCBTYWx0ZWRfX+ygY6nU8FP4h SvlJF2KS8C4cwWOxYtxac0k+3nHhW2t2Sa8HzrjoQKDWZY5SvW8BK3t2OiVyCFtFQ1laf1VRBdF 7Poyv/9VY6cGhKiswz83tCGc0RPd/uY= X-Proofpoint-ORIG-GUID: P4EZKrXHkrlLrpueaEe9M3V2yH9g2Tuo X-Proofpoint-GUID: P4EZKrXHkrlLrpueaEe9M3V2yH9g2Tuo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-02_05,2026-12-02_07,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 malwarescore=0 adultscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 clxscore=1011 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020078 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=148.163.158.5; envelope-from=zycai@linux.ibm.com; helo=mx0b-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1796241738184158500 Content-Type: text/plain; charset="utf-8" Add a 'used' field to S390IPLCertificate, set it when DIAG 508 verifies a component, and clear it on reset. This allows migration to send only the certificates actually needed for verification. Signed-off-by: Zhuoying Cai --- hw/s390x/cert-store.c | 11 +++++++++++ hw/s390x/cert-store.h | 2 ++ hw/s390x/ipl.c | 3 +++ target/s390x/diag.c | 3 +++ 4 files changed, 19 insertions(+) diff --git a/hw/s390x/cert-store.c b/hw/s390x/cert-store.c index 1e4a4c8820..d07405b1dd 100644 --- a/hw/s390x/cert-store.c +++ b/hw/s390x/cert-store.c @@ -256,3 +256,14 @@ void s390_ipl_create_cert_store(S390IPLCertificateStor= e *cert_store) =20 g_ptr_array_free(cert_path_builder, TRUE); } + +void s390_ipl_cert_store_reset(S390IPLCertificateStore *cert_store) +{ + if (!cert_store) { + return; + } + + for (int i =3D 0; i < cert_store->count; i++) { + cert_store->certs[i].used =3D false; + } +} diff --git a/hw/s390x/cert-store.h b/hw/s390x/cert-store.h index bcd522555b..658bae8a5f 100644 --- a/hw/s390x/cert-store.h +++ b/hw/s390x/cert-store.h @@ -23,6 +23,7 @@ struct S390IPLCertificate { size_t size; size_t der_size; uint8_t *raw; + bool used; }; typedef struct S390IPLCertificate S390IPLCertificate; =20 @@ -35,5 +36,6 @@ struct S390IPLCertificateStore { typedef struct S390IPLCertificateStore S390IPLCertificateStore; =20 void s390_ipl_create_cert_store(S390IPLCertificateStore *cert_store); +void s390_ipl_cert_store_reset(S390IPLCertificateStore *cert_store); =20 #endif diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index fe107af84d..5dce0f1270 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -946,6 +946,9 @@ static void s390_ipl_reset(DeviceState *dev) ipl->iplb_valid =3D false; memset(&ipl->iplb, 0, sizeof(IplParameterBlock)); } + + /* Reset the cert used flag so the next boot cycle can re-evaluate the= used set. */ + s390_ipl_cert_store_reset(&ipl->cert_store); } =20 static void s390_ipl_class_init(ObjectClass *klass, const void *data) diff --git a/target/s390x/diag.c b/target/s390x/diag.c index f465a2eed2..7e841a45d6 100644 --- a/target/s390x/diag.c +++ b/target/s390x/diag.c @@ -713,6 +713,9 @@ static int handle_diag508_sig_verif(CPUS390XState *env,= uint64_t addr) svb->cert_store_index =3D i; svb->cert_len =3D cpu_to_be64(cs->certs[i].der_size); s390_ipl_write(env, addr, svb, svb_size); + + /* Track that this cert used to verify a component */ + cs->certs[i].used =3D true; return DIAG_508_RC_OK; } } --=20 2.56.1 From nobody Sun Dec 6 20:46:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1796241696; cv=none; d=zohomail.com; s=zohoarc; b=hYlv9CvPLhykCyntE+CKXBUNM5xwmavbEBXY8CNDJzGqrGuqS0xgRQ73zz5RTCeEcK90kaCQxpZV3lJpikySkWBB++Rrjdc0YpU/NkEfrdDvlT8+UVKcjXjVqWrQ8BxiCnexpgT9qG08BBqbNDz5yu66aIW1CNZwDGSi39U6VyA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1796241696; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Dssx7Atcuevvfp+i8V2M6Ek8P5g1VR8OkPXmRYuj6iw=; b=UaRul3grWzqzFgZFj8WRhFJxLjpLP4sXaerJIkp2YbwxVgnucpXZfYNhMgqlWq/VxSDruVeqLkmNlTOMWfcTSrTY425pqBuMGUlsPb6GDxjAOcwsbQRXKeQgI9z8vJ5A23ieue+mvXm6s3cNXDP+R1/WWIGW6+x7QHBrCC4M+us= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17962416967441021.314656043334; Wed, 2 Dec 2026 12:01:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xYqVe-0005M7-Bf; Wed, 02 Dec 2026 15:00:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYqVS-0005Jx-Ul; Wed, 02 Dec 2026 15:00:47 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYqVQ-0000U8-T4; Wed, 02 Dec 2026 15:00:46 -0500 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2J4fbm3878559; Wed, 2 Dec 2026 20:00:41 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j7pmtbphe-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 02 Dec 2026 20:00:40 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2J4Kwh799530; Wed, 2 Dec 2026 20:00:40 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4j9u5fxqdp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Dec 2026 20:00:40 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B2K0cmY26280624 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Dec 2026 20:00:39 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C73675805E; Wed, 2 Dec 2026 20:00:38 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C1E4B5805D; Wed, 2 Dec 2026 20:00:37 +0000 (GMT) Received: from fedora-workstation.ibmuc.com (unknown [9.61.19.152]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 2 Dec 2026 20:00:37 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=Dssx7Atcuevvfp+i8 V2M6Ek8P5g1VR8OkPXmRYuj6iw=; b=n3OwrQwCcPc3JKK/gcEiFvXciB1BTa8Pz xgiMYTU8JqdEbNgfXWpyTs0cHxnWdapmpQjGn2Ono85FIPol1KVc9T6/zYgsZA2G RdyvXbj28Wijsv2wbEMHa6rxv6Kr6etilqO/qnNPNP0FaCCNiY6/VNiZQC67PuTZ U/EI60d7sEB1D4Pjv6306n3ULWnAJWCwmF0nDsggQpmCmLrQweR/OP8+yW5o0FtU 4Ijto6GIws4an0mu/09oiSKT1FStMW6jBfrQCm6Qn82JeTEKIn02JoIo94tsoZB7 AY4+t1TEpMqImTvuuA9GXUUcLAcvEtv6d4dG4HXJkqYYhWp1SzPlA== From: Zhuoying Cai To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Cc: jrossi@linux.ibm.com, zycai@linux.ibm.com, borntraeger@linux.ibm.com, jdaley@linux.ibm.com, pasic@linux.ibm.com, farman@linux.ibm.com, mjrosato@linux.ibm.com, richard.henderson@linaro.org, iii@linux.ibm.com, david@kernel.org, cohuck@redhat.com, walling@linux.ibm.com, jjherne@linux.ibm.com Subject: [PATCH v1 3/4] s390/ipl: Validate boot certificates during migration Date: Wed, 2 Dec 2026 15:00:27 -0500 Message-ID: <20261202200028.81527-4-zycai@linux.ibm.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202200028.81527-1-zycai@linux.ibm.com> References: <20261202200028.81527-1-zycai@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: eCCwvWFuFvSATEGR6dYab3kXQgTPC19a X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDA3OCBTYWx0ZWRfX4GtAY72AI9ih XwWWpWUam/ZVsUgzuX53DDXUdQ7dBgHbBXo9IdZynOCS1bXzyH87Gmhrj/3tAmk+S5hAB2aLruO alksoQN3IcOiGGlqamQ8xYjYwaRT77VlWJt/4DnXAbkT6yLRlRSuqsjPWu2TxHHfObTwBPKCI1v mjdgcIfmmjNJnHTq15w8slbazTHyk+akLOO6Vc2VMXdtSHtISvPkaEgcouSmY1yMFmdogIqM4PA 4FwYzG7FDxJQFpwLsQ+39R1nXyfzGOm1GXRRCvv9nzzSmCxRKLuEc1sRH9Ay2WV09fkkh4Z04gy 7/PGgsiLheL+4hsqrjwo+q7WJ8zasgJzwPGhOyBX8IU88Af9G9SDl7Vz1bqpKwqrR0qS7AZzv/o Ba1OEoD0B0DcpbcZxz2AEMc5YM7JpwQSWplqZQdM3FZj47Eh4zfqOKnLqmpedCEOwX9I7Jlg0je WSvwaTgNdpx0/+5PdfA== X-Proofpoint-GUID: eCCwvWFuFvSATEGR6dYab3kXQgTPC19a X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDA3OCBTYWx0ZWRfX3aaFYkUGJYNU WZaxpUymXsMZvyy+NNpT4Au4VuEfQZRpC+i9/1nKJJwIaEXVkVOgzqz1dIZDCKD7b7bTWKwkC8J MZN89YIZq3XFzatbQTJpHTdcHpc/l+o= X-Authority-Analysis: v=2.4 cv=U9cHnuru c=1 sm=1 tr=0 ts=6b1078e8 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=hYu8A0rAnfSi-SuPrBkA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-02_05,2026-12-02_07,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 phishscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 clxscore=1011 spamscore=0 priorityscore=1501 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020078 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=zycai@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1796241697547158500 Content-Type: text/plain; charset="utf-8" Add a VMState subsection that serializes the name and SHA-256 fingerprint of each certificate used during verification on source. The destination validates them against its local certificate store. In secure boot mode migration is aborted if any certificate is missing; in audit mode a warning is issued and migration continues. Move certificate store initialization to s390_ipl_realize() so it is available before migration state is loaded. Signed-off-by: Zhuoying Cai --- hw/s390x/cert-store.c | 34 ++++++++++++++ hw/s390x/cert-store.h | 3 ++ hw/s390x/ipl.c | 107 ++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 141 insertions(+), 3 deletions(-) diff --git a/hw/s390x/cert-store.c b/hw/s390x/cert-store.c index d07405b1dd..9b3cd29bd8 100644 --- a/hw/s390x/cert-store.c +++ b/hw/s390x/cert-store.c @@ -267,3 +267,37 @@ void s390_ipl_cert_store_reset(S390IPLCertificateStore= *cert_store) cert_store->certs[i].used =3D false; } } + +uint16_t s390_ipl_cert_store_used_count(const S390IPLCertificateStore *cer= t_store) +{ + uint16_t count =3D 0; + + if (!cert_store) { + return 0; + } + + for (int i =3D 0; i < cert_store->count; i++) { + if (cert_store->certs[i].used) { + count++; + } + } + + return count; +} + +int s390_ipl_cert_store_find_fingerprint(const S390IPLCertificateStore *ce= rt_store, + const uint8_t *fingerprint) +{ + if (!cert_store) { + return -1; + } + + for (int i =3D 0; i < cert_store->count; i++) { + if (memcmp(cert_store->certs[i].fingerprint, fingerprint, + QCRYPTO_HASH_DIGEST_LEN_SHA256) =3D=3D 0) { + return i; + } + } + + return -1; +} diff --git a/hw/s390x/cert-store.h b/hw/s390x/cert-store.h index 658bae8a5f..17b637b47e 100644 --- a/hw/s390x/cert-store.h +++ b/hw/s390x/cert-store.h @@ -37,5 +37,8 @@ typedef struct S390IPLCertificateStore S390IPLCertificate= Store; =20 void s390_ipl_create_cert_store(S390IPLCertificateStore *cert_store); void s390_ipl_cert_store_reset(S390IPLCertificateStore *cert_store); +uint16_t s390_ipl_cert_store_used_count(const S390IPLCertificateStore *cer= t_store); +int s390_ipl_cert_store_find_fingerprint(const S390IPLCertificateStore *ce= rt_store, + const uint8_t *fingerprint); =20 #endif diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index 5dce0f1270..a6c272755d 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -39,6 +39,8 @@ #include "qemu/ctype.h" #include "standard-headers/linux/virtio_ids.h" #include "cert-store.h" +#include "migration/qemu-file-types.h" +#include "migration/vmstate.h" =20 #define KERN_IMAGE_START 0x010000UL #define LINUX_MAGIC_ADDR 0x010008UL @@ -85,6 +87,101 @@ static const VMStateDescription vmstate_iplb =3D { } }; =20 +static bool s390_secure_boot_enabled(void); + +static bool load_ipl_cert_store(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, Error **errp) +{ + S390IPLState *ipl =3D pv; + uint16_t count; + uint8_t ebcdic_name[CERT_NAME_MAX_LEN]; + uint8_t fp[QCRYPTO_HASH_DIGEST_LEN_SHA256]; + char ascii_name[CERT_NAME_MAX_LEN + 1]; + int idx; + + count =3D qemu_get_be16(f); + + for (uint16_t i =3D 0; i < count; i++) { + qemu_get_buffer(f, ebcdic_name, CERT_NAME_MAX_LEN); + qemu_get_buffer(f, fp, QCRYPTO_HASH_DIGEST_LEN_SHA256); + + idx =3D s390_ipl_cert_store_find_fingerprint(&ipl->cert_store, fp); + if (idx >=3D 0) { + ipl->cert_store.certs[idx].used =3D true; + continue; + } + + /* convert EBCDIC name back to ASCII and null-terminate */ + ascii_put((uint8_t *)ascii_name, (char *)ebcdic_name, CERT_NAME_MA= X_LEN); + ascii_name[CERT_NAME_MAX_LEN] =3D '\0'; + + /* strip right-padded spaces */ + g_strstrip(ascii_name); + + if (s390_secure_boot_enabled()) { + error_setg(errp, + "Secure IPL migration blocked: destination host lac= ks an " + "identical boot certificate for '%s'", ascii_name); + return false; + } + + warn_report("Secure IPL migration: destination host lacks boot " + "certificate for '%s' in Audit Mode", ascii_name); + } + + return true; +} + +static bool save_ipl_cert_store(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, JSONWriter *vmd= esc, + Error **errp) +{ + S390IPLState *ipl =3D pv; + uint16_t used_count; + + used_count =3D s390_ipl_cert_store_used_count(&ipl->cert_store); + + qemu_put_be16(f, used_count); + for (int i =3D 0; i < ipl->cert_store.count; i++) { + if (ipl->cert_store.certs[i].used) { + /* write the certificate name and SHA256 fingerprint */ + qemu_put_buffer(f, ipl->cert_store.certs[i].name, CERT_NAME_MA= X_LEN); + qemu_put_buffer(f, ipl->cert_store.certs[i].fingerprint, + QCRYPTO_HASH_DIGEST_LEN_SHA256); + } + } + + return true; +} + +static const VMStateInfo vmstate_info_ipl_cert_store =3D { + .name =3D "ipl_cert_store", + .load =3D load_ipl_cert_store, + .save =3D save_ipl_cert_store, +}; + +static bool ipl_cert_store_needed(void *opaque) +{ + S390IPLState *ipl =3D opaque; + + return s390_ipl_cert_store_used_count(&ipl->cert_store) > 0; +} + +static const VMStateDescription vmstate_ipl_cert_store =3D { + .name =3D "ipl/cert_store", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D ipl_cert_store_needed, + .fields =3D (const VMStateField[]) { + { + .name =3D "cert_fingerprints", + .info =3D &vmstate_info_ipl_cert_store, + .flags =3D VMS_SINGLE | VMS_NO_STATE, + }, + VMSTATE_END_OF_LIST() + } +}; + static const VMStateDescription vmstate_ipl =3D { .name =3D "ipl", .version_id =3D 0, @@ -98,7 +195,11 @@ static const VMStateDescription vmstate_ipl =3D { VMSTATE_UINT8(ssid, S390IPLState), VMSTATE_UINT16(devno, S390IPLState), VMSTATE_END_OF_LIST() - } + }, + .subsections =3D (const VMStateDescription * const []) { + &vmstate_ipl_cert_store, + NULL + } }; =20 static S390IPLState *get_ipl_device(void) @@ -286,6 +387,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **= errp) * TODO: there should be a better way to do this. */ qemu_register_reset(resettable_cold_reset_fn, dev); + + s390_ipl_create_cert_store(&ipl->cert_store); } =20 static const Property s390_ipl_properties[] =3D { @@ -914,8 +1017,6 @@ void s390_ipl_prepare_cpu(S390CPU *cpu) cpu->env.psw.addr =3D ipl->start_addr; cpu->env.psw.mask =3D IPL_PSW_MASK; =20 - s390_ipl_create_cert_store(&ipl->cert_store); - if (!ipl->kernel || ipl->iplb_valid) { cpu->env.psw.addr =3D ipl->bios_start_addr; if (!ipl->iplb_valid) { --=20 2.56.1 From nobody Sun Dec 6 20:46:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1796241757; cv=none; d=zohomail.com; s=zohoarc; b=HagGV45/7b9Uu8owuPTZOwFemj2wcPI31J2Vdzsoxw5jvBnaEFdvt8Y+5xNEQnDOkBQaKX2x1wEwV8wlbLEjY/BffuMYbNPKsWs/uRm/+CKuTPf6gGdeSw2hvMSeitIcK3gsXzNAGjeTQ0bTkC7gQ3AxCS+VrMzNriLwAMOZT9c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1796241757; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SqqqfAvL0Q06BtaUPLdIJ7ZpAo2ms9Mbg1lJuyMwmq0=; b=cs8drG3S2IEIlLFTwgMJ/gFDdy3rbePl6Xl23juzJhHEie3zlfmOE6u+FsUmP3dRk/ThxOoNaceDlM95X8xpu39hupN/RVfQnaex325Rn1qU78AEsTnAfu0wscsiVUqjXA4p47Cxv5o3YyzkdIbw5qQ92htf0ZW/YD05aepHbRU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1796241757648474.8661253417325; Wed, 2 Dec 2026 12:02:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists1p.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1xYqVg-0005N5-90; Wed, 02 Dec 2026 15:01:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYqVU-0005KM-G3; Wed, 02 Dec 2026 15:00:56 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1xYqVS-0000UT-RB; Wed, 02 Dec 2026 15:00:48 -0500 Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2J5bZx3879615; Wed, 2 Dec 2026 20:00:42 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4j7pmtbphj-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 02 Dec 2026 20:00:42 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.11/8.18.1.11) with ESMTP id 6B2J4Kwi799530; Wed, 2 Dec 2026 20:00:41 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([172.16.1.6]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4j9u5fxqdx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Dec 2026 20:00:41 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (smtpav06.dal12v.mail.ibm.com [10.241.53.105]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 6B2K0eqG13632156 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 2 Dec 2026 20:00:40 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E933A58043; Wed, 2 Dec 2026 20:00:39 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E9D3658059; Wed, 2 Dec 2026 20:00:38 +0000 (GMT) Received: from fedora-workstation.ibmuc.com (unknown [9.61.19.152]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 2 Dec 2026 20:00:38 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=SqqqfAvL0Q06BtaUP LdIJ7ZpAo2ms9Mbg1lJuyMwmq0=; b=CXDVOpMqckfoZsIiVUTEP3fxI8sSWrqP6 1k20romBHI6uzJXznveoHldHFJ18MbHdxm1BoA1ubCs7jyikPB+12Dk9zi2UepzL vQ10JrpUttspD+8qlaR8hQBIynQpodlePxLrW4oOJB8UOxeO3Ue3uT99Iflgu7Hl 5UGxeBRk7uAXdJLbJGeVzmBs0MnCMuxsbMpZ9kZGikjKo12fpMfbYrKx/wcGxaXt 22jQKNgIDSua0RypwMg4sj7hFih9UOBHK8TINRUguipK3l6Qw6Y+7U2sM1tvzGdY jpHZfqhapgyiZor1lpk6zOLcXuyYAtCjzU+EuZwx4teBZJo4c46fA== From: Zhuoying Cai To: qemu-s390x@nongnu.org, qemu-devel@nongnu.org Cc: jrossi@linux.ibm.com, zycai@linux.ibm.com, borntraeger@linux.ibm.com, jdaley@linux.ibm.com, pasic@linux.ibm.com, farman@linux.ibm.com, mjrosato@linux.ibm.com, richard.henderson@linaro.org, iii@linux.ibm.com, david@kernel.org, cohuck@redhat.com, walling@linux.ibm.com, jjherne@linux.ibm.com Subject: [PATCH v1 4/4] s390/ipl: Validate boot mode consistency across migration Date: Wed, 2 Dec 2026 15:00:28 -0500 Message-ID: <20261202200028.81527-5-zycai@linux.ibm.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202200028.81527-1-zycai@linux.ibm.com> References: <20261202200028.81527-1-zycai@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: eIGCwrxyCOLmxMXeYc3I7xH15iype_e8 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAyMDA3OCBTYWx0ZWRfX6U3Zmu+0Nwr0 Zj6n6zhEbvH+A43r6ZzUdB5ZNkR3bqR5c+pXlaXzs+UnzMUbVmncOIVsz9IXmKcIVstdfs5jmiV WQNgCF2aKzuvLuikT/o9i9TyJdBmrr9DHlAMPc+x5yO8wIw79cN/vZvQrGXNenNnUmky4wbZhDk zNTWsyhS0Dbvd7k98xobqVQ7Lt25ZmvnN5oWsZKZcISOIcu8SbOEABYLV1ilDssLJ8qMvE7o0Dv 1YTZMWBRz4LVM5tJIXI8o+llSKBWQIC0+I2xA+VSbj/UiNW0cfLNw6Bg+AW+81GAyW57D2E1t88 u/RIsm/DTzpKd7Vndj/KBydS0kgIzo2+MxG1iqe9NTnyXGPaogELzAK1GXUZJaRG+vnznr53Khn mhFdKsymR55027qSUZz4wlLcUSLNIgimI4SSBFrqHzR+aXGXl0k85+YLbei+U1VZtoAFoHw5Rth HOIAGlgG6xiOT2eTP0w== X-Proofpoint-GUID: eIGCwrxyCOLmxMXeYc3I7xH15iype_e8 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAyMDA3OCBTYWx0ZWRfX123DfRIcVIOK +3Cn7cRHJ+aP+AYKh8/tEnreLp7JIMnwwETOgOaJolT2BQ1q15hPfFu4L/En2LaoDu1WSPLdEmR BerQjPeHPUzHrDIsUAp6UMkczJ0tp/I= X-Authority-Analysis: v=2.4 cv=U9cHnuru c=1 sm=1 tr=0 ts=6b1078ea cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=pUM-KoujPXoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=UgSk5ib6hxHPELc6edYA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-02_05,2026-12-02_07,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 phishscore=0 malwarescore=0 impostorscore=0 lowpriorityscore=0 clxscore=1015 spamscore=0 priorityscore=1501 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612020078 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists1p.gnu.org; Received-SPF: pass client-ip=148.163.156.1; envelope-from=zycai@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ibm.com) X-ZM-MESSAGEID: 1796241758272158500 Content-Type: text/plain; charset="utf-8" Enforce matching boot modes between source and destination during migration. Check the mode before validating certificates and in a new post_load hook to catch mismatches even when no certificates are sent. Signed-off-by: Zhuoying Cai --- hw/s390x/ipl.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c index a6c272755d..0274ae4cc1 100644 --- a/hw/s390x/ipl.c +++ b/hw/s390x/ipl.c @@ -89,6 +89,23 @@ static const VMStateDescription vmstate_iplb =3D { =20 static bool s390_secure_boot_enabled(void); =20 +static bool s390_validate_boot_mode(const S390IPLState *ipl, Error **errp) +{ + bool src =3D ipl->iplb_valid && + (ipl->iplb.hdr_flags & DIAG308_IPIB_FLAGS_SIPL) !=3D 0; + bool dst =3D s390_secure_boot_enabled(); + + if (src !=3D dst) { + error_setg(errp, + "Secure IPL migration blocked: boot mode mismatch " + "(source=3D%s, destination=3D%s)", + src ? "on" : "off", dst ? "on" : "off"); + return false; + } + + return true; +} + static bool load_ipl_cert_store(QEMUFile *f, void *pv, size_t size, const VMStateField *field, Error **errp) { @@ -99,6 +116,10 @@ static bool load_ipl_cert_store(QEMUFile *f, void *pv, = size_t size, char ascii_name[CERT_NAME_MAX_LEN + 1]; int idx; =20 + if (!s390_validate_boot_mode(ipl, errp)) { + return false; + } + count =3D qemu_get_be16(f); =20 for (uint16_t i =3D 0; i < count; i++) { @@ -182,10 +203,25 @@ static const VMStateDescription vmstate_ipl_cert_stor= e =3D { } }; =20 +static int ipl_post_load(void *opaque, int version_id) +{ + S390IPLState *ipl =3D opaque; + Error *err =3D NULL; + + /* Runs on all migrations, including when no certs were used */ + if (!s390_validate_boot_mode(ipl, &err)) { + error_report_err(err); + return -EINVAL; + } + + return 0; +} + static const VMStateDescription vmstate_ipl =3D { .name =3D "ipl", .version_id =3D 0, .minimum_version_id =3D 0, + .post_load =3D ipl_post_load, .fields =3D (const VMStateField[]) { VMSTATE_UINT64(compat_start_addr, S390IPLState), VMSTATE_UINT64(compat_bios_start_addr, S390IPLState), --=20 2.56.1