From: Abel Abraham Camarillo Ojeda Subject: Re: Thinkpad t410 does not reboot properly To: Walter Alejandro Iglesias Cc: tech@openbsd.org Date: Sun, 9 Jun 2024 05:15:42 -0600 On Sun, Jun 9, 2024 at 5:03 AM Walter Alejandro Iglesias wrote: > On Sun, Jun 09, 2024 at 12:39:53PM +0200, Walter Alejandro Iglesias wrote: > > > Well, I guess it depends in the amount of changes that occurred during > that > > > day, > > > if you pinpointed a change already I guess its not needed > > > > If its about the kernel, searching in cvsweb by date the nearest > > modification I found is this: > > > > > https://cvsweb.openbsd.org/src/sys/arch/amd64/amd64/pmap.c?rev=1.168&content-type=text/x-cvsweb-markup&sortby=date > > > > Please note that I am no expert, I have no idea what the problem may be > > related to. > > > > Thank you Abel! > Hi Walter, Checking the time frame I see the following changes (mangled by gmail), I think any of these could be the responsible one. The times I have bisected I did it using a binary search algorithm: $ TZ=UTC cvs up -D '2024/05/02 00:00' -Pd then $ TZ=UTC cvs up -D '2024/05/03 00:00' -Pd then TZ=UTC cvs up -D '2024/05/02 12:00' -Pd if it works OK then: TZ=UTC cvs up -D '2024/05/02 18:00' -Pd if it fails then: TZ=UTC cvs up -D '2024/05/02 15:00' -Pd and so on... Differences that day: $ TZ=Z cvs diff -D 20240602 -D 20240603 Index: dev/acpi/acpi.c =================================================================== RCS file: /cvs/src/sys/dev/acpi/acpi.c,v diff -u -p -r1.429 -r1.430 --- dev/acpi/acpi.c 29 May 2024 12:21:33 -0000 1.429 +++ dev/acpi/acpi.c 2 Jun 2024 11:08:41 -0000 1.430 @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.429 2024/05/29 12:21:33 kettenis Exp $ */ +/* $OpenBSD: acpi.c,v 1.430 2024/06/02 11:08:41 kettenis Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert * Copyright (c) 2005 Jordan Hargrave @@ -611,6 +611,10 @@ acpi_getpci(struct aml_node *node, void aml_nodename(node)); /* Collect device power state information. */ + if (aml_evalinteger(sc, node, "_S0W", 0, NULL, &val) == 0) + pci->_s0w = val; + else + pci->_s0w = -1; if (aml_evalinteger(sc, node, "_S3D", 0, NULL, &val) == 0) pci->_s3d = val; else @@ -721,6 +725,10 @@ acpi_pci_min_powerstate(pci_chipset_tag_ TAILQ_FOREACH(pdev, &acpi_pcidevs, next) { if (pdev->bus == bus && pdev->dev == dev && pdev->fun == fun) { switch (acpi_softc->sc_state) { + case ACPI_STATE_S0: + defaultstate = PCI_PMCSR_STATE_D3; + state = pdev->_s0w; + break; case ACPI_STATE_S3: defaultstate = PCI_PMCSR_STATE_D3; state = MAX(pdev->_s3d, pdev->_s3w); Index: dev/acpi/amltypes.h =================================================================== RCS file: /cvs/src/sys/dev/acpi/amltypes.h,v diff -u -p -r1.49 -r1.50 --- dev/acpi/amltypes.h 12 Sep 2022 17:42:31 -0000 1.49 +++ dev/acpi/amltypes.h 2 Jun 2024 11:08:41 -0000 1.50 @@ -1,4 +1,4 @@ -/* $OpenBSD: amltypes.h,v 1.49 2022/09/12 17:42:31 kettenis Exp $ */ +/* $OpenBSD: amltypes.h,v 1.50 2024/06/02 11:08:41 kettenis Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave * @@ -358,6 +358,7 @@ struct acpi_pci { int dev; int fun; + int _s0w; int _s3d; int _s3w; int _s4d; Index: kern/kern_pledge.c =================================================================== RCS file: /cvs/src/sys/kern/kern_pledge.c,v diff -u -p -r1.314 -r1.315 --- kern/kern_pledge.c 18 May 2024 05:20:22 -0000 1.314 +++ kern/kern_pledge.c 2 Jun 2024 15:31:56 -0000 1.315 @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_pledge.c,v 1.314 2024/05/18 05:20:22 guenther Exp $ */ +/* $OpenBSD: kern_pledge.c,v 1.315 2024/06/02 15:31:56 deraadt Exp $ */ /* * Copyright (c) 2015 Nicholas Marriott @@ -574,7 +574,7 @@ pledge_fail(struct proc *p, int error, u return (ENOSYS); KERNEL_LOCK(); - log(LOG_ERR, "%s[%d]: pledge \"%s\", syscall %d\n", + uprintf("%s[%d]: pledge \"%s\", syscall %d\n", p->p_p->ps_comm, p->p_p->ps_pid, codes, p->p_pledge_syscall); p->p_p->ps_acflag |= APLEDGE; @@ -1005,7 +1005,7 @@ pledge_sysctl(struct proc *p, int miblen char *p = buf + strlen(buf); snprintf(p, sizeof(buf) - (p - buf), " %d", mib[i]); } - log(LOG_ERR, "%s\n", buf); + uprintf("%s\n", buf); return pledge_fail(p, EINVAL, 0); } Index: sys/syscall_mi.h =================================================================== RCS file: /cvs/src/sys/sys/syscall_mi.h,v diff -u -p -r1.33 -r1.34 --- sys/syscall_mi.h 1 Apr 2024 12:00:15 -0000 1.33 +++ sys/syscall_mi.h 2 Jun 2024 15:31:57 -0000 1.34 @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall_mi.h,v 1.33 2024/04/01 12:00:15 deraadt Exp $ */ +/* $OpenBSD: syscall_mi.h,v 1.34 2024/06/02 15:31:57 deraadt Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -105,9 +105,8 @@ die: ktrpinsyscall(p, error, code, addr); #endif KERNEL_LOCK(); - /* XXX remove or simplify this log() call after OpenBSD 7.5 release */ - log(LOG_ERR, - "%s[%d]: pinsyscalls addr %lx code %ld, pinoff 0x%x " + /* XXX remove or simplify this uprintf() call after OpenBSD 7.5 release */ + uprintf("%s[%d]: pinsyscalls addr %lx code %ld, pinoff 0x%x " "(pin%s %d %lx-%lx %lx) (libcpin%s %d %lx-%lx %lx) error %d\n", p->p_p->ps_comm, p->p_p->ps_pid, addr, code, (pin && code < pin->pn_npins) ? pin->pn_pins[code] : -1, Index: uvm/uvm_map.c =================================================================== RCS file: /cvs/src/sys/uvm/uvm_map.c,v diff -u -p -r1.328 -r1.329 --- uvm/uvm_map.c 2 Apr 2024 08:39:17 -0000 1.328 +++ uvm/uvm_map.c 2 Jun 2024 15:31:57 -0000 1.329 @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_map.c,v 1.328 2024/04/02 08:39:17 deraadt Exp $ */ +/* $OpenBSD: uvm_map.c,v 1.329 2024/06/02 15:31:57 deraadt Exp $ */ /* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */ /* @@ -1659,7 +1659,7 @@ uvm_map_inentry(struct proc *p, struct p ok = uvm_map_inentry_fix(p, ie, addr, fn, serial); if (!ok) { KERNEL_LOCK(); - printf(fmt, p->p_p->ps_comm, p->p_p->ps_pid, p->p_tid, + uprintf(fmt, p->p_p->ps_comm, p->p_p->ps_pid, p->p_tid, addr, ie->ie_start, ie->ie_end-1); p->p_p->ps_acflag |= AMAP; sv.sival_ptr = (void *)PROC_PC(p); @@ -1685,11 +1685,8 @@ uvm_map_is_stack_remappable(struct vm_ma vm_map_assert_anylock(map); - if (!uvm_map_lookup_entry(map, addr, &first)) { - printf("map stack 0x%lx-0x%lx of map %p failed: no mapping\n", - addr, end, map); + if (!uvm_map_lookup_entry(map, addr, &first)) return FALSE; - } /* * Check that the address range exists and is contiguous. @@ -1707,16 +1704,10 @@ uvm_map_is_stack_remappable(struct vm_ma } #endif - if (prev != NULL && prev->end != iter->start) { - printf("map stack 0x%lx-0x%lx of map %p failed: " - "hole in range\n", addr, end, map); + if (prev != NULL && prev->end != iter->start) return FALSE; - } - if (iter->start == iter->end || UVM_ET_ISHOLE(iter)) { - printf("map stack 0x%lx-0x%lx of map %p failed: " - "hole in range\n", addr, end, map); + if (iter->start == iter->end || UVM_ET_ISHOLE(iter)) return FALSE; - } if (sigaltstack_check) { if (iter->protection != (PROT_READ | PROT_WRITE)) return FALSE; @@ -1740,7 +1731,6 @@ uvm_map_remap_as_stack(struct proc *p, v { vm_map_t map = &p->p_vmspace->vm_map; vaddr_t start, end; - int error; int flags = UVM_MAPFLAG(PROT_READ | PROT_WRITE, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_INHERIT_COPY, MADV_NORMAL, @@ -1767,11 +1757,7 @@ uvm_map_remap_as_stack(struct proc *p, v * placed upon the region, which prevents an attacker from pivoting * into pre-placed MAP_STACK space. */ - error = uvm_mapanon(map, &start, end - start, 0, flags); - if (error != 0) - printf("map stack for pid %d failed\n", p->p_p->ps_pid); - - return error; + return uvm_mapanon(map, &start, end - start, 0, flags); } /*