From 6532bf02c2376dec768b6413cc21719890efd7ac Mon Sep 17 00:00:00 2001 From: Matthew Rosato Date: Tue, 11 Nov 2025 10:25:00 -0500 Subject: [PATCH] zdev: Add ap bus coldplug replay trigger for ap.rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add an additional trigger to the zdev-generated 41-ap.rules file. This trigger will check the bindings_complete_count value during coldplug replay of the ap bus, which allows the udev rule to handle the case where zcrypt has already fired the BINDINGS==complete with COMPLETECOUNT==1 before the udev rule was accessible (example: before rootfs has been mounted). Without this, it's possible for the rule to never fire despite the initial bindings having completed. While it was always possible for zcrypt to be forced onto initrd, it becomes far more likely with changes like 14c977768 ("zkey/dracut: Add a dracut config file for zkey"). Reviewed-by: Boris Fiuczynski Reviewed-by: Peter Oberparleiter Acked-by: Vineeth Vijayan Signed-off-by: Matthew Rosato Signed-off-by: Jan Höppner --- zdev/src/ap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zdev/src/ap.c b/zdev/src/ap.c index c4d66fad..e0e105b8 100644 --- a/zdev/src/ap.c +++ b/zdev/src/ap.c @@ -286,6 +286,8 @@ static exit_code_t ap_write_type_udev(char *ap, char *aq, bool autoconf) fprintf(fd, "# Generated by chzdev\n"); /* Triggers. */ + fprintf(fd, "ACTION==\"add\", DEVPATH==\"/bus/ap\", " + "ATTR{bindings_complete_count}!=\"0\", GOTO=\"cfg_ap\"\n"); fprintf(fd, "ACTION==\"change\", SUBSYSTEM==\"ap\", " "DEVPATH==\"/devices/ap\", ENV{BINDINGS}==\"complete\", " "ENV{COMPLETECOUNT}==\"1\", GOTO=\"cfg_ap\"\n");