git: 453db42291a3 - main - gpioevents: add support for pull-down and floating input pins.
The branch main has been updated by rene (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=453db42291a3179a51b9bf41ca7dbc0a5298bffa commit 453db42291a3179a51b9bf41ca7dbc0a5298bffa Author: Rene Ladan AuthorDate: 2022-12-21 21:24:11 + Commit: Rene Ladan CommitDate: 2022-12-22 09:13:59 + gpioevents: add support for pull-down and floating input pins. The pin-mode (ft, pd, pu for floating, pull-down, pull-up) is specified after the intr-config (no, eb, ef, er) for each pin. Tested on my Raspberry Pi 1B. PR: 268504 Approved by:manu MFC after: 1 week --- tools/test/gpioevents/gpioevents.c | 47 +- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/tools/test/gpioevents/gpioevents.c b/tools/test/gpioevents/gpioevents.c index 20d18257f4a8..00aff726388a 100644 --- a/tools/test/gpioevents/gpioevents.c +++ b/tools/test/gpioevents/gpioevents.c @@ -66,7 +66,7 @@ static void usage() { fprintf(stderr, "usage: %s [-f ctldev] [-m method] [-s] [-n] [-S] [-u]" - "[-t timeout] [-d delay-usec] pin intr-config [pin intr-config ...]\n\n", + "[-t timeout] [-d delay-usec] pin intr-config pin-mode [pin intr-config pin-mode ...]\n\n", getprogname()); fprintf(stderr, " -d delay before each call to read/poll/select/etc\n"); fprintf(stderr, " -n Non-blocking IO\n"); @@ -85,7 +85,11 @@ usage() fprintf(stderr, " no\t no interrupt\n"); fprintf(stderr, " er\t edge rising\n"); fprintf(stderr, " ef\t edge falling\n"); - fprintf(stderr, " eb\t edge both\n"); + fprintf(stderr, " eb\t edge both\n\n"); +fprintf(stderr, "Possible options for pin-mode:\n\n"); +fprintf(stderr, " ft\t floating\n"); +fprintf(stderr, " pd\t pull-down\n"); +fprintf(stderr, " pu\t pull-up\n"); } static void @@ -539,8 +543,15 @@ main(int argc, char *argv[]) return EXIT_FAILURE; } - if (argc % 2 == 1) { - fprintf(stderr, "%s: Invalid number of pin intr-conf pairs.\n", + if (argc == 1) { + fprintf(stderr, "%s: No trigger type specified.\n", + getprogname()); + usage(); + return EXIT_FAILURE; + } + + if (argc % 3 != 0) { + fprintf(stderr, "%s: Invalid number of (pin intr-conf mode) triplets.\n", getprogname()); usage(); return EXIT_FAILURE; @@ -567,7 +578,7 @@ main(int argc, char *argv[]) err(EXIT_FAILURE, "cannot set O_NONBLOCK on %s", file); } - for (int i = 0; i <= argc - 2; i += 2) { + for (int i = 0; i <= argc - 3; i += 3) { errno = 0; pin_config.g_pin = strtol(argv[i], NULL, 10); @@ -604,7 +615,31 @@ main(int argc, char *argv[]) return EXIT_FAILURE; } - pin_config.g_flags |= GPIO_PIN_INPUT | GPIO_PIN_PULLUP; + if (strnlen(argv[i + 2], 2) < 2) { + fprintf(stderr, "%s: Invalid pin mode (argument " + "too short).\n", getprogname()); + usage(); + return EXIT_FAILURE; + } + + switch((argv[i + 2][0] << 8) + argv[i + 2][1]) { + case ('f' << 8) + 't': + /* no changes to pin_config */ + break; + case ('p' << 8) + 'd': + pin_config.g_flags |= GPIO_PIN_PULLDOWN; + break; + case ('p' << 8) + 'u': + pin_config.g_flags |= GPIO_PIN_PULLUP; + break; + default: + fprintf(stderr, "%s: Invalid pin mode.\n", + getprogname()); + usage(); + return EXIT_FAILURE; + } + + pin_config.g_flags |= GPIO_PIN_INPUT; res = gpio_pin_set_flags(handle, &pin_config); if (res < 0)
git: 0eebb2d30a34 - stable/13 - vmm: Fix AP startup with old userspace binaries.
The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=0eebb2d30a34ac48254fc54f38cbfe13441782c7 commit 0eebb2d30a34ac48254fc54f38cbfe13441782c7 Author: John Baldwin AuthorDate: 2022-10-26 21:22:56 + Commit: Corvin Köhne CommitDate: 2022-12-22 09:12:22 + vmm: Fix AP startup with old userspace binaries. Older binaries that do not request IPI exits to userspace do not start user threads for other vCPUs until a STARTUP IPI triggers a VM_EXITCODE_SPINUP_AP exit to userland. This means that those vcpus are not yet active (in terms of vm_active_cpus) when the INIT and STARTUP IPIs are delivered to the vCPUs. The changes in commit 0bda8d3e9f7a changed the INIT and STARTUP IPIs to reuse the existing vlapic_calcdest() function. This function silently ignores IPIs sent to inactive vCPUs. As a result, when using an old bhyve binary, the INIT and STARTUP IPIs sent to wakeup APs were ignored. To fix, restructure the compat code for the INIT and STARTUP IPIs to ignore the results of vlapic_calcdest() and manually parse the APIC ID and resulting vcpuid. As part of this, make the compat code always conditonal on the ipi_exit capability being disabled. Reviewed by:c.koehne_beckhoff.com, markj Differential Revision: https://reviews.freebsd.org/D37093 (cherry picked from commit 769b884e2e2eb84d25eca2a5462ae0a6c4dcd2a7) --- sys/amd64/vmm/io/vlapic.c | 63 +-- 1 file changed, 45 insertions(+), 18 deletions(-) diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index e1a57c4abcfc..5deca142c5d1 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -1119,20 +1119,61 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu) break; case APIC_DELMODE_INIT: - CPU_FOREACH_ISSET(i, &dmask) { + if (!vlapic->ipi_exit) { + if (!phys) + break; + + i = vm_apicid2vcpuid(vlapic->vm, dest); + if (i >= vm_get_maxcpus(vlapic->vm) || + i == vlapic->vcpuid) + break; + /* -* Userland which doesn't support the IPI exit requires -* that the boot state is set to SIPI here. +* Userland which doesn't support the IPI exit +* requires that the boot state is set to SIPI +* here. */ vlapic2 = vm_lapic(vlapic->vm, i); vlapic2->boot_state = BS_SIPI; - CPU_SET(i, &ipimask); + break; } + CPU_COPY(&dmask, &ipimask); break; case APIC_DELMODE_STARTUP: + if (!vlapic->ipi_exit) { + if (!phys) + break; + + /* +* Old bhyve versions don't support the IPI +* exit. Translate it into the old style. +*/ + i = vm_apicid2vcpuid(vlapic->vm, dest); + if (i >= vm_get_maxcpus(vlapic->vm) || + i == vlapic->vcpuid) + break; + + /* +* Ignore SIPIs in any state other than wait-for-SIPI +*/ + vlapic2 = vm_lapic(vlapic->vm, i); + if (vlapic2->boot_state != BS_SIPI) + break; + vlapic2->boot_state = BS_RUNNING; + + vmexit = vm_exitinfo(vlapic->vm, vlapic->vcpuid); + vmexit->exitcode = VM_EXITCODE_SPINUP_AP; + vmexit->u.spinup_ap.vcpu = i; + vmexit->u.spinup_ap.rip = vec << PAGE_SHIFT; + + *retu = true; + break; + } + CPU_FOREACH_ISSET(i, &dmask) { vlapic2 = vm_lapic(vlapic->vm, i); + /* * Ignore SIPIs in any state other than wait-for-SIPI */ @@ -1155,20 +1196,6 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu) vmexit->u.ipi.dmask = dmask; *retu = true; - - /* -* Old bhyve versions don't support the IPI exit. Translate it -* into the old style. -*/ - if (!vlapic->ipi_exit) { - if (mode == APIC_DELMODE_STARTUP) { - vmexit->exitcode = VM_EXITCODE_SPINUP_AP; -
git: 168726513cdf - stable/13 - vmm: validate icr value
The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=168726513cdf93a18d2dae3862dcffbd8d7a6ccc commit 168726513cdf93a18d2dae3862dcffbd8d7a6ccc Author: Corvin Köhne AuthorDate: 2022-10-12 09:19:32 + Commit: Corvin Köhne CommitDate: 2022-12-22 09:12:22 + vmm: validate icr value Not all combinations of icr values are allowed. Neither Intel nor AMD document what happens when an invalid value is written to the icr. Ignore the IPI. So, the guest will note that the IPI wasn't delivered. Reviewed by:jhb Differential Revision: https://reviews.freebsd.org/D36946 Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit 2a2a64c4b93f1a135f62f54db54f4ec2f89f9127) --- sys/amd64/vmm/io/vlapic.c | 91 +-- 1 file changed, 88 insertions(+), 3 deletions(-) diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index d660b0a3f195..e1a57c4abcfc 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -953,6 +953,86 @@ vlapic_get_cr8(struct vlapic *vlapic) return (tpr >> 4); } +static bool +vlapic_is_icr_valid(uint64_t icrval) +{ + uint32_t mode = icrval & APIC_DELMODE_MASK; + uint32_t level = icrval & APIC_LEVEL_MASK; + uint32_t trigger = icrval & APIC_TRIGMOD_MASK; + uint32_t shorthand = icrval & APIC_DEST_MASK; + + switch (mode) { + case APIC_DELMODE_FIXED: + if (trigger == APIC_TRIGMOD_EDGE) + return (true); + /* +* AMD allows a level assert IPI and Intel converts a level +* assert IPI into an edge IPI. +*/ + if (trigger == APIC_TRIGMOD_LEVEL && level == APIC_LEVEL_ASSERT) + return (true); + break; + case APIC_DELMODE_LOWPRIO: + case APIC_DELMODE_SMI: + case APIC_DELMODE_NMI: + case APIC_DELMODE_INIT: + if (trigger == APIC_TRIGMOD_EDGE && + (shorthand == APIC_DEST_DESTFLD || + shorthand == APIC_DEST_ALLESELF)) + return (true); + /* +* AMD allows a level assert IPI and Intel converts a level +* assert IPI into an edge IPI. +*/ + if (trigger == APIC_TRIGMOD_LEVEL && + level == APIC_LEVEL_ASSERT && + (shorthand == APIC_DEST_DESTFLD || + shorthand == APIC_DEST_ALLESELF)) + return (true); + /* +* An level triggered deassert INIT is defined in the Intel +* Multiprocessor Specification and the Intel Software Developer +* Manual. Due to the MPS it's required to send a level assert +* INIT to a cpu and then a level deassert INIT. Some operating +* systems e.g. FreeBSD or Linux use that algorithm. According +* to the SDM a level deassert INIT is only supported by Pentium +* and P6 processors. It's always send to all cpus regardless of +* the destination or shorthand field. It resets the arbitration +* id register. This register is not software accessible and +* only required for the APIC bus arbitration. So, the level +* deassert INIT doesn't need any emulation and we should ignore +* it. The SDM also defines that newer processors don't support +* the level deassert INIT and it's not valid any more. As it's +* defined for older systems, it can't be invalid per se. +* Otherwise, backward compatibility would be broken. However, +* when returning false here, it'll be ignored which is the +* desired behaviour. +*/ + if (mode == APIC_DELMODE_INIT && + trigger == APIC_TRIGMOD_LEVEL && + level == APIC_LEVEL_DEASSERT) + return (false); + break; + case APIC_DELMODE_STARTUP: + if (shorthand == APIC_DEST_DESTFLD || + shorthand == APIC_DEST_ALLESELF) + return (true); + break; + case APIC_DELMODE_RR: + /* Only available on AMD! */ + if (trigger == APIC_TRIGMOD_EDGE && + shorthand == APIC_DEST_DESTFLD) + return (true); + break; + case APIC_DELMODE_RESV: + return (false); + default: + __assert_unreachable(); + } + + return (false); +} + int vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu) { @@ -998,6 +1078,14 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool *retu)
git: 56b2358b2f68 - stable/13 - vmm: increase vlapic version
The branch stable/13 has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=56b2358b2f68b1781b4a555b94a63d2792f27fcc commit 56b2358b2f68b1781b4a555b94a63d2792f27fcc Author: Corvin Köhne AuthorDate: 2022-10-10 12:56:00 + Commit: Corvin Köhne CommitDate: 2022-12-22 09:12:21 + vmm: increase vlapic version Mac os panics on apic versions lower than 0x14. See https://opensource.apple.com/source/xnu/xnu-7195.81.3/osfmk/i386/lapic_native.c.auto.html Additionally, an upcoming commit will validate the icr values written by the guest. Older intel processors allow some different combinations than the newer ones. AMD documents that only the newer combinations are allowed. So, bumping the version allows us to avoid a differentiation between AMD and Intel. Intel documents that newer processors than the P6 are using the new combinations. Sadly, Intel does not document which apic version belongs to those processors. Linux identifies newer apics by a version larger or equal to 0x14. Intel and AMD allow apic version between 0x10 and 0x15. So, using 0x14 seems to be fine. See https://github.com/torvalds/linux/blob/3eba620e7bd772a0c7dc91966cb107872b54a910/arch/x86/kernel/apic/apic.c#L238 Reviewed by:jhb Differential Revision: https://reviews.freebsd.org/D36945 Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit f56801d6d9777ba0a7e398d370bb755de8102697) --- sys/amd64/vmm/io/vlapic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/vmm/io/vlapic.c b/sys/amd64/vmm/io/vlapic.c index d2e60fc3baeb..d660b0a3f195 100644 --- a/sys/amd64/vmm/io/vlapic.c +++ b/sys/amd64/vmm/io/vlapic.c @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$"); #definePRIO(x) ((x) >> 4) -#define VLAPIC_VERSION (16) +#define VLAPIC_VERSION (0x14) #definex2apic(vlapic) (((vlapic)->msr_apicbase & APICBASE_X2APIC) ? 1 : 0)
git: e2f3742ab8b1 - main - gpioevents: fix some white-space errors
The branch main has been updated by rene (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=e2f3742ab8b10ba5ec4dc190c5b64e9151bb0d57 commit e2f3742ab8b10ba5ec4dc190c5b64e9151bb0d57 Author: Rene Ladan AuthorDate: 2022-12-22 10:16:32 + Commit: Rene Ladan CommitDate: 2022-12-22 10:16:32 + gpioevents: fix some white-space errors Fixes: 453db42291a3 - gpioevents: add support for pull-down and floating input pins. Approved by:manu (implicit) MFC after: 1 week --- tools/test/gpioevents/gpioevents.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/test/gpioevents/gpioevents.c b/tools/test/gpioevents/gpioevents.c index 00aff726388a..9beffa740875 100644 --- a/tools/test/gpioevents/gpioevents.c +++ b/tools/test/gpioevents/gpioevents.c @@ -86,10 +86,10 @@ usage() fprintf(stderr, " er\t edge rising\n"); fprintf(stderr, " ef\t edge falling\n"); fprintf(stderr, " eb\t edge both\n\n"); -fprintf(stderr, "Possible options for pin-mode:\n\n"); -fprintf(stderr, " ft\t floating\n"); -fprintf(stderr, " pd\t pull-down\n"); -fprintf(stderr, " pu\t pull-up\n"); + fprintf(stderr, "Possible options for pin-mode:\n\n"); + fprintf(stderr, " ft\t floating\n"); + fprintf(stderr, " pd\t pull-down\n"); + fprintf(stderr, " pu\t pull-up\n"); } static void
git: c1a2798faa3d - main - arm64: Don't include td_inhibitors when checking td_ast in do_ast
The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=c1a2798faa3d8a76a7b9023d859629b5c0532d9b commit c1a2798faa3d8a76a7b9023d859629b5c0532d9b Author: Jessica Clarke AuthorDate: 2022-12-22 10:23:10 + Commit: Jessica Clarke CommitDate: 2022-12-22 10:23:10 + arm64: Don't include td_inhibitors when checking td_ast in do_ast The td_ast member is an int so only 4 bytes, yet we were using an 8 byte load and thus also got td_inhibitors in the upper bits. The code prior to the commit that introduced td_ast did also do a bogus 8 byte load of td_flags but masked the flags so arguably was correct, if dodgy. Now that we're using the right width for the load we can also fold the immediate offset back into the load; because td_ast is at an odd multiple of 4 bytes from the start of struct thread the normal scaled load couldn't be used with such an immediate offset when doing an 8 byte load due to its limited immediate range, but we can use a scaled load once more now that the offset is a multiple of the load width. Reviewed by:andrew, kib Fixes: c6d31b8306eb ("AST: rework") Differential Revision: https://reviews.freebsd.org/D37751 --- sys/arm64/arm64/exception.S | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/arm64/arm64/exception.S b/sys/arm64/arm64/exception.S index e875b75e41c4..4a74358afeb9 100644 --- a/sys/arm64/arm64/exception.S +++ b/sys/arm64/arm64/exception.S @@ -177,11 +177,10 @@ __FBSDID("$FreeBSD$"); /* Read the current thread AST mask */ ldr x1, [x18, #PC_CURTHREAD]/* Load curthread */ - add x1, x1, #(TD_AST) - ldr x1, [x1] + ldr w1, [x1, #(TD_AST)] /* Check if we have a non-zero AST mask */ - cbz x1, 2f + cbz w1, 2f /* Restore interrupts */ msr daif, x19
git: 751d88119fdc - main - Fix loading the hwpmc module when ACPI is enabled
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=751d88119fdc1dff71d1390c7768942a9b857bc6 commit 751d88119fdc1dff71d1390c7768942a9b857bc6 Author: Andrew Turner AuthorDate: 2022-12-22 10:10:46 + Commit: Andrew Turner CommitDate: 2022-12-22 10:36:18 + Fix loading the hwpmc module when ACPI is enabled In 0a9a4d2cd6092 a check for OPT_ACPI was added to the hwpmc Makefile to fix loading the module in a kernel where ACPI has been disabled. This broke loading the module when ACPI was enabled in the build as OPT_ACPI isn't a Makefile macro so was always disabled. Move this check to the C files where the DEV_ACPI macro does exist. Reviewed by:gnn Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D37773 --- sys/arm64/arm64/cmn600.c | 7 ++- sys/dev/hwpmc/hwpmc_cmn600.c | 9 - sys/dev/hwpmc/pmu_dmc620.c | 6 ++ sys/modules/hwpmc/Makefile | 2 -- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/sys/arm64/arm64/cmn600.c b/sys/arm64/arm64/cmn600.c index a6ed7b73bafc..de673535b927 100644 --- a/sys/arm64/arm64/cmn600.c +++ b/sys/arm64/arm64/cmn600.c @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2021 ARM Ltd + * Copyright (c) 2021-2022 Arm Ltd * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -34,6 +34,10 @@ __FBSDID("$FreeBSD$"); #include "opt_acpi.h" +/* + * This depends on ACPI, but is built unconditionally in the hwpmc module. + */ +#ifdef DEV_ACPI #include #include #include @@ -831,3 +835,4 @@ static driver_t cmn600_acpi_driver = { DRIVER_MODULE(cmn600, acpi, cmn600_acpi_driver, 0, 0); MODULE_VERSION(cmn600, 1); +#endif /* DEV_ACPI */ diff --git a/sys/dev/hwpmc/hwpmc_cmn600.c b/sys/dev/hwpmc/hwpmc_cmn600.c index 5e3ecb58c77c..59b4e8252af2 100644 --- a/sys/dev/hwpmc/hwpmc_cmn600.c +++ b/sys/dev/hwpmc/hwpmc_cmn600.c @@ -3,7 +3,7 @@ * * Copyright (c) 2003-2008 Joseph Koshy * Copyright (c) 2007 The FreeBSD Foundation - * Copyright (c) 2021 ARM Ltd + * Copyright (c) 2021-2022 ARM Ltd * * Portions of this software were developed by A. Joseph Koshy under * sponsorship from the FreeBSD Foundation and Google, Inc. @@ -35,6 +35,12 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_acpi.h" + +/* + * This depends on ACPI, but is built unconditionally in the hwpmc module. + */ +#ifdef DEV_ACPI #include #include #include @@ -824,3 +830,4 @@ pmc_cmn600_finalize(struct pmc_mdep *md) } MODULE_DEPEND(pmc, cmn600, 1, 1, 1); +#endif /* DEV_ACPI */ diff --git a/sys/dev/hwpmc/pmu_dmc620.c b/sys/dev/hwpmc/pmu_dmc620.c index b2cb2404693c..464eb9004d11 100644 --- a/sys/dev/hwpmc/pmu_dmc620.c +++ b/sys/dev/hwpmc/pmu_dmc620.c @@ -2,6 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2021 Ampere Computing LLC + * Copyright (c) 2022 Arm Ltd * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,6 +34,10 @@ __FBSDID("$FreeBSD$"); #include "opt_hwpmc_hooks.h" #include "opt_acpi.h" +/* + * This depends on ACPI, but is built unconditionally in the hwpmc module. + */ +#ifdef DEV_ACPI #include #include #include @@ -275,3 +280,4 @@ DRIVER_MODULE(pmu_dmc620, acpi, pmu_dmc620_acpi_driver, 0, 0); /* Reverse dependency. hwpmc needs DMC-620 on ARM64. */ MODULE_DEPEND(pmc, pmu_dmc620, 1, 1, 1); MODULE_VERSION(pmu_dmc620, 1); +#endif /* DEV_ACPI */ diff --git a/sys/modules/hwpmc/Makefile b/sys/modules/hwpmc/Makefile index a72b3cf8d2fd..0db4c55e64f3 100644 --- a/sys/modules/hwpmc/Makefile +++ b/sys/modules/hwpmc/Makefile @@ -12,11 +12,9 @@ SRCS+= vnode_if.h .if ${MACHINE_CPUARCH} == "aarch64" SRCS+= hwpmc_arm64.c hwpmc_arm64_md.c -.if !empty(OPT_ACPI) SRCS+= cmn600.c hwpmc_cmn600.c SRCS+= hwpmc_dmc620.c pmu_dmc620.c .endif -.endif .if ${MACHINE_CPUARCH} == "amd64" SRCS+= hwpmc_amd.c hwpmc_core.c hwpmc_intel.c hwpmc_tsc.c
git: 753c7fc9e655 - main - Fix the SPDX-License-Identifier in CMN-600 files
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=753c7fc9e6558c9f3197212e661f74c7e83763b0 commit 753c7fc9e6558c9f3197212e661f74c7e83763b0 Author: Andrew Turner AuthorDate: 2022-12-22 10:10:47 + Commit: Andrew Turner CommitDate: 2022-12-22 10:36:18 + Fix the SPDX-License-Identifier in CMN-600 files The SPDX-License-Identifier was wrong in the Arm CoreLink CMN-600 driver files. It used the incorrect FreeBSD variant of the BSD-2-Clause identifier. According to [1] all files should use BSD-2-Clause. [1] https://tools.spdx.org/app/check_license/ Reported by:emaste Sponsored by: Arm Ltd --- sys/arm64/arm64/cmn600.c | 2 +- sys/arm64/include/cmn600_reg.h | 2 +- sys/dev/hwpmc/hwpmc_cmn600.c | 2 +- sys/dev/hwpmc/hwpmc_cmn600.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/arm64/arm64/cmn600.c b/sys/arm64/arm64/cmn600.c index de673535b927..c01abc444c8e 100644 --- a/sys/arm64/arm64/cmn600.c +++ b/sys/arm64/arm64/cmn600.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2021-2022 Arm Ltd * diff --git a/sys/arm64/include/cmn600_reg.h b/sys/arm64/include/cmn600_reg.h index d7fc9ecaac98..c3548b22cd96 100644 --- a/sys/arm64/include/cmn600_reg.h +++ b/sys/arm64/include/cmn600_reg.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2021 ARM Ltd * diff --git a/sys/dev/hwpmc/hwpmc_cmn600.c b/sys/dev/hwpmc/hwpmc_cmn600.c index 59b4e8252af2..700a680514a9 100644 --- a/sys/dev/hwpmc/hwpmc_cmn600.c +++ b/sys/dev/hwpmc/hwpmc_cmn600.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2003-2008 Joseph Koshy * Copyright (c) 2007 The FreeBSD Foundation diff --git a/sys/dev/hwpmc/hwpmc_cmn600.h b/sys/dev/hwpmc/hwpmc_cmn600.h index d2204c9db0af..ad0a475a28fb 100644 --- a/sys/dev/hwpmc/hwpmc_cmn600.h +++ b/sys/dev/hwpmc/hwpmc_cmn600.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2021 ARM Ltd *
git: 5ec1d020bd01 - main - Fix the SPDX-License-Identifier in DMC-620 files
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=5ec1d020bd01a4b803dffb1284595ff2177a7e56 commit 5ec1d020bd01a4b803dffb1284595ff2177a7e56 Author: Andrew Turner AuthorDate: 2022-12-22 10:10:47 + Commit: Andrew Turner CommitDate: 2022-12-22 10:36:18 + Fix the SPDX-License-Identifier in DMC-620 files The SPDX-License-Identifier was wrong in the Arm CoreLink DMC-620 driver files. It used the incorrect FreeBSD variant of the BSD-2-Clause identifier. According to [1] all files should use BSD-2-Clause. [1] https://tools.spdx.org/app/check_license/ Reported by:emaste Sponsored by: Arm Ltd --- sys/dev/hwpmc/hwpmc_dmc620.c | 2 +- sys/dev/hwpmc/hwpmc_dmc620.h | 2 +- sys/dev/hwpmc/pmu_dmc620.c | 2 +- sys/dev/hwpmc/pmu_dmc620_reg.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_dmc620.c b/sys/dev/hwpmc/hwpmc_dmc620.c index c340dbe69086..a6a1dfb44ca4 100644 --- a/sys/dev/hwpmc/hwpmc_dmc620.c +++ b/sys/dev/hwpmc/hwpmc_dmc620.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2003-2008 Joseph Koshy * Copyright (c) 2007 The FreeBSD Foundation diff --git a/sys/dev/hwpmc/hwpmc_dmc620.h b/sys/dev/hwpmc/hwpmc_dmc620.h index de8219337f2b..e1a23fe2ab82 100644 --- a/sys/dev/hwpmc/hwpmc_dmc620.h +++ b/sys/dev/hwpmc/hwpmc_dmc620.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2021 Ampere Computing LLC * diff --git a/sys/dev/hwpmc/pmu_dmc620.c b/sys/dev/hwpmc/pmu_dmc620.c index 464eb9004d11..87efcc8b2b11 100644 --- a/sys/dev/hwpmc/pmu_dmc620.c +++ b/sys/dev/hwpmc/pmu_dmc620.c @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2021 Ampere Computing LLC * Copyright (c) 2022 Arm Ltd diff --git a/sys/dev/hwpmc/pmu_dmc620_reg.h b/sys/dev/hwpmc/pmu_dmc620_reg.h index a9f92d5c8f82..bfd11d268465 100644 --- a/sys/dev/hwpmc/pmu_dmc620_reg.h +++ b/sys/dev/hwpmc/pmu_dmc620_reg.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2021 Ampere Computing LLC *
Re: git: 269c564b90d3 - main - vfs: retire NDFREE
On 19/12/22 05:14, Mateusz Guzik wrote: The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=269c564b90d3f95ac3afbd4bd1adad36681f2b93 commit 269c564b90d3f95ac3afbd4bd1adad36681f2b93 Author: Mateusz Guzik AuthorDate: 2022-11-17 16:59:20 + Commit: Mateusz Guzik CommitDate: 2022-12-19 08:07:54 + vfs: retire NDFREE There are no consumers anymore. Interested parties can NDFREE_PNBUF and vput or vrele relevant vnodes. Tested by: pho Hello Mateusz! This change broke open-vm-tools. If you have any advice about a proper fix please let me know, otherwise I'm going to take a look at it when I have some spare time. https://pkg-status.freebsd.org/beefy17/data/main-i386-default/p3a8cf525382f_s54b96380f5/logs/open-vm-tools-nox11-12.1.5,2.log -- Renato Botelho
Re: git: 269c564b90d3 - main - vfs: retire NDFREE
diff -ru open-vm-tools-stable-12.0.0/open-vm-tools/modules/freebsd/vmblock/vfsops.c open-vm-tools-stable-12.0.0.patched/open-vm-tools/modules/freebsd/vmblock/vfsops.c --- open-vm-tools-stable-12.0.0/open-vm-tools/modules/freebsd/vmblock/vfsops.c 2022-03-04 21:01:24.0 + +++ open-vm-tools-stable-12.0.0.patched/open-vm-tools/modules/freebsd/vmblock/vfsops.c 2022-12-22 12:27:51.897759000 + @@ -174,11 +174,14 @@ NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, target, compat_td); error = namei(ndp); if (error) { - NDFREE(ndp, 0); uma_zfree(VMBlockPathnameZone, pathname); return error; } +#if __FreeBSD_version < 1400075 NDFREE(ndp, NDF_ONLY_PNBUF); +#else + NDFREE_PNBUF(ndp); +#endif /* * Check multi VMBlock mount to avoid `lock against myself' panic. On 12/22/22, Renato Botelho wrote: > On 19/12/22 05:14, Mateusz Guzik wrote: >> The branch main has been updated by mjg: >> >> URL: >> https://cgit.FreeBSD.org/src/commit/?id=269c564b90d3f95ac3afbd4bd1adad36681f2b93 >> >> commit 269c564b90d3f95ac3afbd4bd1adad36681f2b93 >> Author: Mateusz Guzik >> AuthorDate: 2022-11-17 16:59:20 + >> Commit: Mateusz Guzik >> CommitDate: 2022-12-19 08:07:54 + >> >> vfs: retire NDFREE >> >> There are no consumers anymore. Interested parties can NDFREE_PNBUF >> and vput or vrele relevant vnodes. >> >> Tested by: pho > > Hello Mateusz! > > This change broke open-vm-tools. If you have any advice about a proper > fix please let me know, otherwise I'm going to take a look at it when I > have some spare time. > > https://pkg-status.freebsd.org/beefy17/data/main-i386-default/p3a8cf525382f_s54b96380f5/logs/open-vm-tools-nox11-12.1.5,2.log > > -- > Renato Botelho > > -- Mateusz Guzik
Re: git: 269c564b90d3 - main - vfs: retire NDFREE
On 22/12/22 09:29, Mateusz Guzik wrote: diff -ru open-vm-tools-stable-12.0.0/open-vm-tools/modules/freebsd/vmblock/vfsops.c open-vm-tools-stable-12.0.0.patched/open-vm-tools/modules/freebsd/vmblock/vfsops.c --- open-vm-tools-stable-12.0.0/open-vm-tools/modules/freebsd/vmblock/vfsops.c 2022-03-04 21:01:24.0 + +++ open-vm-tools-stable-12.0.0.patched/open-vm-tools/modules/freebsd/vmblock/vfsops.c 2022-12-22 12:27:51.897759000 + @@ -174,11 +174,14 @@ NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, target, compat_td); error = namei(ndp); if (error) { - NDFREE(ndp, 0); uma_zfree(VMBlockPathnameZone, pathname); return error; } +#if __FreeBSD_version < 1400075 NDFREE(ndp, NDF_ONLY_PNBUF); +#else + NDFREE_PNBUF(ndp); +#endif This patch fails on OSVERSION 1400074 with the same error that happened in the past when NDF_ONLY_PNBUF was retired --- vfsops.o --- vfsops.c:185:16: error: use of undeclared identifier 'NDF_ONLY_PNBUF' NDFREE(ndp, NDF_ONLY_PNBUF); I'll keep it checking if NDF_ONLY_PNBUF is defined to decide to call NDFREE or NDFREE_PNBUF -- Renato Botelho
Re: git: 269c564b90d3 - main - vfs: retire NDFREE
On 12/22/22, Renato Botelho wrote: > On 22/12/22 09:29, Mateusz Guzik wrote: >> diff -ru >> open-vm-tools-stable-12.0.0/open-vm-tools/modules/freebsd/vmblock/vfsops.c >> open-vm-tools-stable-12.0.0.patched/open-vm-tools/modules/freebsd/vmblock/vfsops.c >> --- >> open-vm-tools-stable-12.0.0/open-vm-tools/modules/freebsd/vmblock/vfsops.c >> 2022-03-04 21:01:24.0 + >> +++ >> open-vm-tools-stable-12.0.0.patched/open-vm-tools/modules/freebsd/vmblock/vfsops.c >> 2022-12-22 12:27:51.897759000 + >> @@ -174,11 +174,14 @@ >> NDINIT(ndp, LOOKUP, FOLLOW|LOCKLEAF, UIO_SYSSPACE, target, >> compat_td); >> error = namei(ndp); >> if (error) { >> - NDFREE(ndp, 0); >> uma_zfree(VMBlockPathnameZone, pathname); >> return error; >> } >> +#if __FreeBSD_version < 1400075 >> NDFREE(ndp, NDF_ONLY_PNBUF); >> +#else >> + NDFREE_PNBUF(ndp); >> +#endif > > This patch fails on OSVERSION 1400074 with the same error that happened > in the past when NDF_ONLY_PNBUF was retired > > --- vfsops.o --- > vfsops.c:185:16: error: use of undeclared identifier 'NDF_ONLY_PNBUF' > NDFREE(ndp, NDF_ONLY_PNBUF); > > I'll keep it checking if NDF_ONLY_PNBUF is defined to decide to call > NDFREE or NDFREE_PNBUF Well I did skimp on a version bump over there, but as this is *current*, people running the older version should just update and they will be fine. I think this will happen to work if you just check against 1400074 though, the necessary bits were already there for some time. -- Mateusz Guzik
git: f9ccec823a9f - main - Add support for the new Arm Generic UART _HID
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=f9ccec823a9f759ad6360c2a0c6336a3e2a6188a commit f9ccec823a9f759ad6360c2a0c6336a3e2a6188a Author: Andrew Turner AuthorDate: 2022-12-19 13:42:44 + Commit: Andrew Turner CommitDate: 2022-12-22 14:24:40 + Add support for the new Arm Generic UART _HID Historically the ACPI _HID for both the Arm PL011 and Generic UARTs was ARMH0011. In the Arm Base Boot Requirements 2.0 the Generic UART _HID is changed to ARMHB000. Use this new value in the PL011 driver where we support both UART types. This has been observed in some recent EDK2 builds. Sponsored by: Arm Ltd --- sys/dev/uart/uart_dev_pl011.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/uart/uart_dev_pl011.c b/sys/dev/uart/uart_dev_pl011.c index 822283369075..ae1536bc4300 100644 --- a/sys/dev/uart/uart_dev_pl011.c +++ b/sys/dev/uart/uart_dev_pl011.c @@ -341,8 +341,8 @@ UART_FDT_CLASS_AND_DEVICE(fdt_compat_data); #ifdef DEV_ACPI static struct acpi_uart_compat_data acpi_compat_data[] = { {"ARMH0011", &uart_pl011_class, ACPI_DBG2_ARM_PL011, 2, 0, 0, UART_F_IGNORE_SPCR_REGSHFT, "uart pl011"}, - {"ARMH0011", &uart_pl011_class, ACPI_DBG2_ARM_SBSA_GENERIC, 2, 0, 0, UART_F_IGNORE_SPCR_REGSHFT, "uart pl011"}, - {"ARMH0011", &uart_pl011_class, ACPI_DBG2_ARM_SBSA_32BIT, 2, 0, 0, UART_F_IGNORE_SPCR_REGSHFT, "uart pl011"}, + {"ARMHB000", &uart_pl011_class, ACPI_DBG2_ARM_SBSA_GENERIC, 2, 0, 0, UART_F_IGNORE_SPCR_REGSHFT, "uart pl011"}, + {"ARMHB000", &uart_pl011_class, ACPI_DBG2_ARM_SBSA_32BIT, 2, 0, 0, UART_F_IGNORE_SPCR_REGSHFT, "uart pl011"}, {NULL, NULL, 0, 0, 0, 0, 0, NULL}, }; UART_ACPI_CLASS_AND_DEVICE(acpi_compat_data);
git: 2eee99f79480 - main - Allow CPUs to be missing in the Arm PMU driver
The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=2eee99f794800124a7cc288763fcd8f8ae35935b commit 2eee99f794800124a7cc288763fcd8f8ae35935b Author: Andrew Turner AuthorDate: 2022-12-19 13:51:48 + Commit: Andrew Turner CommitDate: 2022-12-22 14:24:40 + Allow CPUs to be missing in the Arm PMU driver To support running on some emulators we allow CPU start to fail if the CPU we are starting is not present. The PMU driver will then check if the CPU is present and fail to attach if any are missing. To allow the PMU to be used in such an environment don't fail to attach when a CPU is missing. Sponsored by: Arm Ltd --- sys/arm/arm/pmu_acpi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/arm/arm/pmu_acpi.c b/sys/arm/arm/pmu_acpi.c index 8812ac7b3af4..f11eacb5059d 100644 --- a/sys/arm/arm/pmu_acpi.c +++ b/sys/arm/arm/pmu_acpi.c @@ -82,7 +82,6 @@ madt_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) /* pcpu not found. */ device_printf(sc->dev, "MADT: could not find pcpu, " "ArmMpidr %lx\n", intr->ArmMpidr); - ctx->error = ENODEV; return; }
git: b8131156826d - stable/13 - Add deprecation notices to ce,cp sync serial drivers
The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b8131156826d79205f37ac9e5c05826f9af6f28f commit b8131156826d79205f37ac9e5c05826f9af6f28f Author: Ed Maste AuthorDate: 2020-03-02 17:31:52 + Commit: Ed Maste CommitDate: 2022-12-22 15:47:14 + Add deprecation notices to ce,cp sync serial drivers And the related sconfig utility. Sync serial (e.g. E1/T1) interfaces are obsolete, and nobody responded to several inquires on the mailing lists about use of these drivers. Relnotes: Yes MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23928 (cherry picked from commit 20dfe27b2d031c4000f5be94fd1db8872167a537) --- sbin/sconfig/sconfig.8| 8 +++- share/man/man4/man4.i386/ce.4 | 8 +++- share/man/man4/man4.i386/cp.4 | 8 +++- sys/dev/ce/if_ce.c| 1 + sys/dev/cp/if_cp.c| 1 + 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/sbin/sconfig/sconfig.8 b/sbin/sconfig/sconfig.8 index 713f76d88c9d..6514c48ed09a 100644 --- a/sbin/sconfig/sconfig.8 +++ b/sbin/sconfig/sconfig.8 @@ -11,7 +11,7 @@ .\" works or modified versions. .\" .\" $FreeBSD$ -.Dd October 3, 2016 +.Dd December 13, 2022 .Dt SCONFIG 8 i386 .Os .Sh NAME @@ -24,6 +24,12 @@ .Op Ar data_rate_options .Op Ar protocol_options ... .Op Ar interface_options ... +.Sh DEPRECATION NOTICE +The +.Nm +utility is not present in +.Fx 14.0 +and later. .Sh DESCRIPTION The .Nm diff --git a/share/man/man4/man4.i386/ce.4 b/share/man/man4/man4.i386/ce.4 index 531904fd539c..20df32b88592 100644 --- a/share/man/man4/man4.i386/ce.4 +++ b/share/man/man4/man4.i386/ce.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 30, 2006 +.Dd December 13, 2022 .Dt CE 4 i386 .Os .Sh NAME @@ -49,6 +49,12 @@ Additional options: .Cd "device sppp" .Cd "options NETGRAPH" .Cd "options NETGRAPH_CRONYX" +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 14.0 +and later. .Sh DESCRIPTION The .Nm diff --git a/share/man/man4/man4.i386/cp.4 b/share/man/man4/man4.i386/cp.4 index 049bb0829749..4fbd6ab4a087 100644 --- a/share/man/man4/man4.i386/cp.4 +++ b/share/man/man4/man4.i386/cp.4 @@ -13,7 +13,7 @@ .\" Cronyx Id: cp.4,v 1.1.2.5 2004/06/21 17:47:40 rik Exp $ .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd December 13, 2022 .Dt CP 4 i386 .Os .Sh NAME @@ -38,6 +38,12 @@ Additional options: .Cd "device sppp" .Cd "options NETGRAPH" .Cd "options NETGRAPH_CRONYX" +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 14.0 +and later. .Sh DESCRIPTION The .Nm diff --git a/sys/dev/ce/if_ce.c b/sys/dev/ce/if_ce.c index 486397d2a2a9..7edde5af73bd 100644 --- a/sys/dev/ce/if_ce.c +++ b/sys/dev/ce/if_ce.c @@ -595,6 +595,7 @@ static int ce_attach (device_t dev) CE_UNLOCK (bd); splx (s); + gone_in_dev(dev, 14, "sync serial (T1/E1) drivers"); return 0; } diff --git a/sys/dev/cp/if_cp.c b/sys/dev/cp/if_cp.c index c8d080fcc601..73af8bafed92 100644 --- a/sys/dev/cp/if_cp.c +++ b/sys/dev/cp/if_cp.c @@ -530,6 +530,7 @@ static int cp_attach (device_t dev) adapter[unit] = b; CP_UNLOCK (bd); splx (s); + gone_in_dev(dev, 14, "sync serial (T1/E1) drivers"); return 0; }
git: 491ebfc123c9 - stable/12 - Add deprecation notices to ce,cp sync serial drivers
The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=491ebfc123c9322458a5746cba5592f74c268424 commit 491ebfc123c9322458a5746cba5592f74c268424 Author: Ed Maste AuthorDate: 2020-03-02 17:31:52 + Commit: Ed Maste CommitDate: 2022-12-22 15:48:47 + Add deprecation notices to ce,cp sync serial drivers And the related sconfig utility. Sync serial (e.g. E1/T1) interfaces are obsolete, and nobody responded to several inquires on the mailing lists about use of these drivers. Relnotes: Yes MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23928 (cherry picked from commit 20dfe27b2d031c4000f5be94fd1db8872167a537) (cherry picked from commit b8131156826d79205f37ac9e5c05826f9af6f28f) --- sbin/sconfig/sconfig.8| 8 +++- share/man/man4/man4.i386/ce.4 | 8 +++- share/man/man4/man4.i386/cp.4 | 8 +++- sys/dev/ce/if_ce.c| 1 + sys/dev/cp/if_cp.c| 1 + 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/sbin/sconfig/sconfig.8 b/sbin/sconfig/sconfig.8 index 713f76d88c9d..6514c48ed09a 100644 --- a/sbin/sconfig/sconfig.8 +++ b/sbin/sconfig/sconfig.8 @@ -11,7 +11,7 @@ .\" works or modified versions. .\" .\" $FreeBSD$ -.Dd October 3, 2016 +.Dd December 13, 2022 .Dt SCONFIG 8 i386 .Os .Sh NAME @@ -24,6 +24,12 @@ .Op Ar data_rate_options .Op Ar protocol_options ... .Op Ar interface_options ... +.Sh DEPRECATION NOTICE +The +.Nm +utility is not present in +.Fx 14.0 +and later. .Sh DESCRIPTION The .Nm diff --git a/share/man/man4/man4.i386/ce.4 b/share/man/man4/man4.i386/ce.4 index fec2dabcb8d7..f984632877fe 100644 --- a/share/man/man4/man4.i386/ce.4 +++ b/share/man/man4/man4.i386/ce.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 30, 2006 +.Dd December 13, 2022 .Dt CE 4 i386 .Os .Sh NAME @@ -49,6 +49,12 @@ Additional options: .Cd "device sppp" .Cd "options NETGRAPH" .Cd "options NETGRAPH_CRONYX" +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 14.0 +and later. .Sh DESCRIPTION The .Nm diff --git a/share/man/man4/man4.i386/cp.4 b/share/man/man4/man4.i386/cp.4 index 049bb0829749..4fbd6ab4a087 100644 --- a/share/man/man4/man4.i386/cp.4 +++ b/share/man/man4/man4.i386/cp.4 @@ -13,7 +13,7 @@ .\" Cronyx Id: cp.4,v 1.1.2.5 2004/06/21 17:47:40 rik Exp $ .\" $FreeBSD$ .\" -.Dd July 16, 2005 +.Dd December 13, 2022 .Dt CP 4 i386 .Os .Sh NAME @@ -38,6 +38,12 @@ Additional options: .Cd "device sppp" .Cd "options NETGRAPH" .Cd "options NETGRAPH_CRONYX" +.Sh DEPRECATION NOTICE +The +.Nm +driver is not present in +.Fx 14.0 +and later. .Sh DESCRIPTION The .Nm diff --git a/sys/dev/ce/if_ce.c b/sys/dev/ce/if_ce.c index 541db6ce16c9..3392de1b196e 100644 --- a/sys/dev/ce/if_ce.c +++ b/sys/dev/ce/if_ce.c @@ -743,6 +743,7 @@ static int ce_attach (device_t dev) CE_UNLOCK (bd); splx (s); + gone_in_dev(dev, 14, "sync serial (T1/E1) drivers"); return 0; } diff --git a/sys/dev/cp/if_cp.c b/sys/dev/cp/if_cp.c index 29643b2ba7f1..e7ab0ca32249 100644 --- a/sys/dev/cp/if_cp.c +++ b/sys/dev/cp/if_cp.c @@ -530,6 +530,7 @@ static int cp_attach (device_t dev) adapter[unit] = b; CP_UNLOCK (bd); splx (s); + gone_in_dev(dev, 14, "sync serial (T1/E1) drivers"); return 0; }
git: 0969415eb25d - stable/13 - geom: minor man page updates suggested by igor(1)
The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=0969415eb25d23d21ed27b8a2998d4042f4c88a9 commit 0969415eb25d23d21ed27b8a2998d4042f4c88a9 Author: Ed Maste AuthorDate: 2022-12-12 21:26:00 + Commit: Ed Maste CommitDate: 2022-12-22 15:52:34 + geom: minor man page updates suggested by igor(1) Reviewed by:pauamma Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37681 (cherry picked from commit 94db10b2db29f897e4934544a5efeaa704d06aa3) --- sbin/geom/core/geom.8 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/geom/core/geom.8 b/sbin/geom/core/geom.8 index 298fc2b1d4fd..377a5fe49472 100644 --- a/sbin/geom/core/geom.8 +++ b/sbin/geom/core/geom.8 @@ -62,10 +62,10 @@ The .Nm utility is used to control various GEOM classes. A class has to be aware of -.Xr geom 8 +.Nm communication methods, but there are also some standard commands which can be used for existing -.Xr geom 8 +.Nm unaware classes. Here is the list of standard commands: .Bl -tag -width ".Cm status" @@ -128,7 +128,7 @@ available under the name of .Nm g Ns Ar class . .Pp Currently available classes which are aware of -.Xr geom 8 : +.Nm : .Pp .Bl -bullet -offset indent -compact .It
git: fac7cabd10e5 - stable/13 - geom: add vinum as a recognized class
The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=fac7cabd10e59cee65a59436b205ff782200c9da commit fac7cabd10e59cee65a59436b205ff782200c9da Author: Ed Maste AuthorDate: 2022-12-12 17:13:58 + Commit: Ed Maste CommitDate: 2022-12-22 15:52:34 + geom: add vinum as a recognized class And note that it is deprecated. PR: 236569 Reported by:bcran Reviewed by:imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D37678 (cherry picked from commit d181a912670558d40bb3a7fcda2703608e152774) --- sbin/geom/core/geom.8 | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sbin/geom/core/geom.8 b/sbin/geom/core/geom.8 index 377a5fe49472..779bfb34cc82 100644 --- a/sbin/geom/core/geom.8 +++ b/sbin/geom/core/geom.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 14, 2018 +.Dd December 12, 2022 .Dt GEOM 8 .Os .Sh NAME @@ -162,6 +162,8 @@ SHSEC .It STRIPE .It +VINUM (deprecated) +.It VIRSTOR .El .Sh ENVIRONMENT @@ -210,6 +212,7 @@ geom md unload .Xr gsched 8 , .Xr gshsec 8 , .Xr gstripe 8 , +.Xr gvinum 8 , .Xr gvirstor 8 .Sh HISTORY The
git: 461210143fbb - stable/13 - imgact_binmisc: Optionally pre-open the interpreter vnode
The branch stable/13 has been updated by dfr: URL: https://cgit.FreeBSD.org/src/commit/?id=461210143fbb4228bd16b356a634120966f892f0 commit 461210143fbb4228bd16b356a634120966f892f0 Author: Doug Rabson AuthorDate: 2022-11-17 10:48:20 + Commit: Doug Rabson CommitDate: 2022-12-22 16:28:42 + imgact_binmisc: Optionally pre-open the interpreter vnode This allows the use of chroot and/or jail environments which depend on interpreters registed with imgact_binmisc to use emulator binaries from the host to emulate programs inside the chroot. Reviewed by:imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D37432 (cherry picked from commit 5eeb4f737f11b253ac330ae459b05e30fd16d0e8) --- sys/kern/imgact_binmisc.c| 49 sys/kern/kern_exec.c | 18 ++- sys/sys/imgact.h | 1 + sys/sys/imgact_binmisc.h | 3 ++- usr.sbin/binmiscctl/binmiscctl.8 | 8 +++ usr.sbin/binmiscctl/binmiscctl.c | 15 6 files changed, 83 insertions(+), 11 deletions(-) diff --git a/sys/kern/imgact_binmisc.c b/sys/kern/imgact_binmisc.c index 951822df06b1..0f3aca4ddc94 100644 --- a/sys/kern/imgact_binmisc.c +++ b/sys/kern/imgact_binmisc.c @@ -30,15 +30,18 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include #include #include +#include #include #include #include +#include #include @@ -63,6 +66,7 @@ typedef struct imgact_binmisc_entry { uint8_t *ibe_magic; uint8_t *ibe_mask; uint8_t *ibe_interpreter; + struct vnode *ibe_interpreter_vnode; ssize_t ibe_interp_offset; uint32_t ibe_interp_argcnt; uint32_t ibe_interp_length; @@ -114,7 +118,7 @@ static struct sx interp_list_sx; * Populate the entry with the information about the interpreter. */ static void -imgact_binmisc_populate_interp(char *str, imgact_binmisc_entry_t *ibe) +imgact_binmisc_populate_interp(char *str, imgact_binmisc_entry_t *ibe, int flags) { uint32_t len = 0, argc = 1; char t[IBE_INTERP_LEN_MAX]; @@ -150,6 +154,30 @@ imgact_binmisc_populate_interp(char *str, imgact_binmisc_entry_t *ibe) memcpy(ibe->ibe_interpreter, t, len); ibe->ibe_interp_argcnt = argc; ibe->ibe_interp_length = len; + + ibe->ibe_interpreter_vnode = NULL; + if (flags & IBF_PRE_OPEN) { + struct nameidata nd; + int error; + + tp = t; + while (*tp != '\0' && *tp != ' ') { + tp++; + } + *tp = '\0'; + NDINIT(&nd, LOOKUP, FOLLOW | ISOPEN, UIO_SYSSPACE, t, curthread); + + /* +* If there is an error, just stop now and fall back +* to the non pre-open case where we lookup during +* exec. +*/ + error = namei(&nd); + if (error) + return; + + ibe->ibe_interpreter_vnode = nd.ni_vp; + } } /* @@ -167,7 +195,7 @@ imgact_binmisc_new_entry(ximgact_binmisc_entry_t *xbe, ssize_t interp_offset, ibe->ibe_name = malloc(namesz, M_BINMISC, M_WAITOK|M_ZERO); strlcpy(ibe->ibe_name, xbe->xbe_name, namesz); - imgact_binmisc_populate_interp(xbe->xbe_interpreter, ibe); + imgact_binmisc_populate_interp(xbe->xbe_interpreter, ibe, xbe->xbe_flags); ibe->ibe_magic = malloc(xbe->xbe_msize, M_BINMISC, M_WAITOK|M_ZERO); memcpy(ibe->ibe_magic, xbe->xbe_magic, xbe->xbe_msize); @@ -199,6 +227,8 @@ imgact_binmisc_destroy_entry(imgact_binmisc_entry_t *ibe) free(ibe->ibe_interpreter, M_BINMISC); if (ibe->ibe_name) free(ibe->ibe_name, M_BINMISC); + if (ibe->ibe_interpreter_vnode) + vrele(ibe->ibe_interpreter_vnode); if (ibe) free(ibe, M_BINMISC); } @@ -271,15 +301,20 @@ imgact_binmisc_add_entry(ximgact_binmisc_entry_t *xbe) } } + /* +* Preallocate a new entry. We do this without holding the +* lock to avoid lock-order problems if IBF_PRE_OPEN is +* set. +*/ + ibe = imgact_binmisc_new_entry(xbe, interp_offset, argv0_cnt); + INTERP_LIST_WLOCK(); if (imgact_binmisc_find_entry(xbe->xbe_name) != NULL) { INTERP_LIST_WUNLOCK(); + imgact_binmisc_destroy_entry(ibe); return (EEXIST); } - /* Preallocate a new entry. */ - ibe = imgact_binmisc_new_entry(xbe, interp_offset, argv0_cnt); - SLIST_INSERT_HEAD(&interpreter_list, ibe, link); interp_list_ent
git: ab3c59a107c5 - main - rpc.tlsservd: Check for a tls syscall failure.
The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=ab3c59a107c56d4304b6ba2c36116b87a0122b4f commit ab3c59a107c56d4304b6ba2c36116b87a0122b4f Author: Rick Macklem AuthorDate: 2022-12-22 17:10:27 + Commit: Rick Macklem CommitDate: 2022-12-22 17:10:27 + rpc.tlsservd: Check for a tls syscall failure. Although the tls syscall to set up the upcall should not normally fail, the daemon should check for such a failure. This patch adds a check for that failure. MFC after: 1 week --- usr.sbin/rpc.tlsservd/rpc.tlsservd.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/usr.sbin/rpc.tlsservd/rpc.tlsservd.c b/usr.sbin/rpc.tlsservd/rpc.tlsservd.c index 2d520ac8e3d1..376f23c4950c 100644 --- a/usr.sbin/rpc.tlsservd/rpc.tlsservd.c +++ b/usr.sbin/rpc.tlsservd/rpc.tlsservd.c @@ -402,7 +402,16 @@ main(int argc, char **argv) rpctls_gothup = false; LIST_INIT(&rpctls_ssllist); - rpctls_syscall(RPCTLS_SYSC_SRVSETPATH, rpctls_sockname[mypos]); + if (rpctls_syscall(RPCTLS_SYSC_SRVSETPATH, rpctls_sockname[mypos]) < 0){ + if (rpctls_debug_level == 0) { + syslog(LOG_ERR, + "Can't set upcall socket path=%s errno=%d", + rpctls_sockname[mypos], errno); + exit(1); + } + err(1, "Can't set upcall socket path=%s", + rpctls_sockname[mypos]); + } rpctls_svc_run();
git: c7a063741720 - main - bspatch.1: fix missing argument
The branch main has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=c7a063741720ef81d4caa4613242579d12f1d605 commit c7a063741720ef81d4caa4613242579d12f1d605 Author: Mike Karels AuthorDate: 2022-12-22 17:13:32 + Commit: Mike Karels CommitDate: 2022-12-22 17:13:32 + bspatch.1: fix missing argument Fix typo MFC after: 3 days Reviewed by:gbe Differential Revision: https://reviews.freebsd.org/D37727 --- usr.bin/bsdiff/bspatch/bspatch.1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr.bin/bsdiff/bspatch/bspatch.1 b/usr.bin/bsdiff/bspatch/bspatch.1 index edbfb198eaed..eb532fed7f03 100644 --- a/usr.bin/bsdiff/bspatch/bspatch.1 +++ b/usr.bin/bsdiff/bspatch/bspatch.1 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 18, 2003 +.Dd December 22, 2022 .Dt BSPATCH 1 .Os .Sh NAME @@ -83,4 +83,5 @@ Users may also wish to verify after running that .Ar newfile matches the target file from which -.Ar was built. +.Ar patchfile +was built.
git: 6032cf3d6fb5 - main - nfscl: Improve the console message for NFSERR_NOFILEHANDLE
The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=6032cf3d6fb5d2e81ff463400bc0c6c8e00b3c3f commit 6032cf3d6fb5d2e81ff463400bc0c6c8e00b3c3f Author: Rick Macklem AuthorDate: 2022-12-22 17:35:15 + Commit: Rick Macklem CommitDate: 2022-12-22 17:35:15 + nfscl: Improve the console message for NFSERR_NOFILEHANDLE Since a NFSERR_NOFILEHANDLE reply from an NFSv4 server usually means that the file system is not exported on the server, change the console log message to indicate that. MFC after: 1 week --- sys/fs/nfsclient/nfs_clport.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index f5d7c3caea0f..53b4c58734c2 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -1179,7 +1179,6 @@ nfscl_maperr(struct thread *td, int error, uid_t uid, gid_t gid) case NFSERR_FHEXPIRED: case NFSERR_RESOURCE: case NFSERR_MOVED: - case NFSERR_NOFILEHANDLE: case NFSERR_MINORVERMISMATCH: case NFSERR_OLDSTATEID: case NFSERR_BADSEQID: @@ -1190,6 +1189,10 @@ nfscl_maperr(struct thread *td, int error, uid_t uid, gid_t gid) printf("nfsv4 client/server protocol prob err=%d\n", error); return (EIO); + case NFSERR_NOFILEHANDLE: + printf("nfsv4 no file handle: usually means the file " + "system is not exported on the NFSv4 server\n"); + return (EIO); default: tprintf(p, LOG_INFO, "nfsv4 err=%d\n", error); return (EIO);
git: 65308195e824 - main - bsdinstall: s/to small/too small/
The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=65308195e82487d82a1feace82686e5c45f88bd3 commit 65308195e82487d82a1feace82686e5c45f88bd3 Author: Mateusz Guzik AuthorDate: 2022-12-22 17:57:08 + Commit: Mateusz Guzik CommitDate: 2022-12-22 17:57:08 + bsdinstall: s/to small/too small/ Reported by:Sulev-Madis Silber --- usr.sbin/bsdinstall/scripts/zfsboot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bsdinstall/scripts/zfsboot b/usr.sbin/bsdinstall/scripts/zfsboot index 1e771710cb7c..c40a9484c8c4 100755 --- a/usr.sbin/bsdinstall/scripts/zfsboot +++ b/usr.sbin/bsdinstall/scripts/zfsboot @@ -318,7 +318,7 @@ msg_swap_mirror="Mirror Swap?" msg_swap_mirror_help="Mirror swap partitions for redundancy, breaks crash dumps" msg_swap_size="Swap Size" msg_swap_size_help="Customize how much swap space is allocated to each selected disk" -msg_swap_toosmall="The selected swap size (%s) is to small. Please enter a value greater than 100MB or enter 0 for no swap" +msg_swap_toosmall="The selected swap size (%s) is too small. Please enter a value greater than 100MB or enter 0 for no swap" msg_these_disks_are_too_small="These disks are smaller than the amount of requested\nswap (%s) and/or geli(8) (%s) partitions, which would\ntake 100%% or more of each of the following selected disks:\n\n %s\n\nRecommend changing partition size(s) and/or selecting a\ndifferent set of disks." msg_unable_to_get_disk_capacity="Unable to get disk capacity of \`%s'" msg_unsupported_partition_scheme="%s is an unsupported partition scheme"
git: 3cf65f8a7f8e - main - sh(1): Allow non-printing characters in prompt strings
The branch main has been updated by otis (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3cf65f8a7f8ee993118fe06f3c187ad30f875132 commit 3cf65f8a7f8ee993118fe06f3c187ad30f875132 Author: Juraj Lutter AuthorDate: 2022-12-08 20:30:26 + Commit: Juraj Lutter CommitDate: 2022-12-22 18:10:48 + sh(1): Allow non-printing characters in prompt strings Introduce new prompt format characters: - '\[' starts the sequence of non-printing chatacters - '\]' ends the sequence of non-printing characters Within these sequences, the following characters are now supported: - '\a' emits ASCII BEL (0x07, 007) character - '\e' emits ASCII ESC (0x1b, 033) character - '\r' emits ASCII CR (0x0d, 015) character - '\n' emits ASCII CRLF sequence These can be used to embed ANSI sequences into prompt strings. Example in .shrc: PS1="\[\e[7m\]\u@\h\[\e[0m\]:\w \\$ " This tries to maintain some degree of compatibility with GNU bash, that uses GNU readline library (which behaves slightly different from BSD editline): It has two "non-printing boundary" characters: - RL_PROMPT_START_IGNORE (\001) - RL_PROMPT_END_IGNORE (\002) while BSD editline only has one (when using EL_PROMPT_ESC setting), so for this purpose, ASCII \001 was chosen and both \[ and \] emits this character. And while here, enlarge PROMPTLEN from 128 to 192 characters. Reviewed by:jilles Approved by:jilles Differential Revision: https://reviews.freebsd.org/D37701 --- bin/sh/histedit.c | 2 +- bin/sh/parser.c | 47 +++ bin/sh/sh.1 | 20 +++- 3 files changed, 59 insertions(+), 10 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index 8812200279f0..0eb8c6c1784f 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -190,7 +190,7 @@ histedit(void) if (el != NULL) { if (hist) el_set(el, EL_HIST, history, hist); - el_set(el, EL_PROMPT, getprompt); + el_set(el, EL_PROMPT_ESC, getprompt, '\001'); el_set(el, EL_ADDFN, "sh-complete", "Filename completion", sh_complete); diff --git a/bin/sh/parser.c b/bin/sh/parser.c index e75798800edf..7f8283ca4dff 100644 --- a/bin/sh/parser.c +++ b/bin/sh/parser.c @@ -70,7 +70,7 @@ __FBSDID("$FreeBSD$"); * Shell command parser. */ -#definePROMPTLEN 128 +#definePROMPTLEN 192 /* values of checkkwd variable */ #define CHKALIAS 0x1 @@ -2060,6 +2060,44 @@ getprompt(void *unused __unused) if (*fmt == '\\') switch (*++fmt) { + /* +* Non-printing sequence begin and end. +*/ + case '[': + case ']': + ps[i] = '\001'; + break; + + /* +* Literal \ and some ASCII characters: +* \a BEL +* \e ESC +* \r CR +*/ + case '\\': + case 'a': + case 'e': + case 'r': + if (*fmt == 'a') + ps[i] = '\007'; + else if (*fmt == 'e') + ps[i] = '\033'; + else if (*fmt == 'r') + ps[i] = '\r'; + else + ps[i] = '\\'; + break; + + /* +* CRLF sequence +*/ + case 'n': + if (i < PROMPTLEN - 3) { + ps[i++] = '\r'; + ps[i] = '\n'; + } + break; + /* * Hostname. * @@ -2136,13 +2174,6 @@ getprompt(void *unused __unused) ps[i] = (geteuid() != 0) ? '$' : '#'; break; - /* -* A literal \. -*/ - case '\\': - ps[i
git: 5b9b55fbc432 - main - iommu_gas: avoid overflow in bounds check
The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=5b9b55fbc43261fc1467caaf7f2b70b8f752e479 commit 5b9b55fbc43261fc1467caaf7f2b70b8f752e479 Author: Doug Moore AuthorDate: 2022-12-22 20:31:57 + Commit: Doug Moore CommitDate: 2022-12-22 20:31:57 + iommu_gas: avoid overflow in bounds check Change the range test in iommu_gas_match_one from '< ubound' to '<= ubound', and pass a smaller-by-one ubound parameter to it, to avoid overflow in ubound calculation. Reported by:andrew Reviewed by:andrew (previous version) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D37764 --- sys/dev/iommu/iommu_gas.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/dev/iommu/iommu_gas.c b/sys/dev/iommu/iommu_gas.c index 5654bc7ed8de..86fc3bfa093c 100644 --- a/sys/dev/iommu/iommu_gas.c +++ b/sys/dev/iommu/iommu_gas.c @@ -309,7 +309,7 @@ struct iommu_gas_match_args { /* * The interval [beg, end) is a free interval between two iommu_map_entries. - * Addresses can be allocated only in the range [lbound, ubound). Try to + * Addresses can be allocated only in the range [lbound, ubound]. Try to * allocate space in the free interval, subject to the conditions expressed by * a, and return 'true' if and only if the allocation attempt succeeds. */ @@ -332,10 +332,10 @@ iommu_gas_match_one(struct iommu_gas_match_args *a, iommu_gaddr_t beg, start = roundup2(beg, a->common->alignment); if (start < beg) return (false); - end = MIN(end - IOMMU_PAGE_SIZE, ubound); + end = MIN(end - IOMMU_PAGE_SIZE - 1, ubound); offset = a->offset; size = a->size; - if (start + offset + size > end) + if (start + offset + size - 1 > end) return (false); /* Check for and try to skip past boundary crossing. */ @@ -349,7 +349,7 @@ iommu_gas_match_one(struct iommu_gas_match_args *a, iommu_gaddr_t beg, beg = roundup2(start + offset + 1, a->common->boundary); start = roundup2(beg, a->common->alignment); - if (start + offset + size > end || + if (start + offset + size - 1 > end || !vm_addr_bound_ok(start + offset, size, a->common->boundary)) { /* @@ -453,7 +453,7 @@ iommu_gas_find_space(struct iommu_domain *domain, * Walk the big-enough ranges tree until one satisfies alignment * requirements, or violates lowaddr address requirement. */ - addr = a->common->lowaddr + 1; + addr = a->common->lowaddr; for (curr = first; curr != NULL; curr = iommu_gas_next(curr, min_free)) { if ((first = RB_LEFT(curr, rb_entry)) != NULL && @@ -464,7 +464,7 @@ iommu_gas_find_space(struct iommu_domain *domain, return (0); } if (curr->end >= addr) { - /* All remaining ranges >= addr */ + /* All remaining ranges > addr */ break; } if ((first = RB_RIGHT(curr, rb_entry)) != NULL && @@ -502,14 +502,14 @@ iommu_gas_find_space(struct iommu_domain *domain, curr = iommu_gas_next(curr, min_free)) { if ((first = RB_LEFT(curr, rb_entry)) != NULL && iommu_gas_match_one(a, first->last, curr->start, - addr + 1, domain->end)) { + addr + 1, domain->end - 1)) { RB_INSERT_PREV(iommu_gas_entries_tree, &domain->rb_root, curr, a->entry); return (0); } if ((first = RB_RIGHT(curr, rb_entry)) != NULL && iommu_gas_match_one(a, curr->end, first->first, - addr + 1, domain->end)) { + addr + 1, domain->end - 1)) { RB_INSERT_NEXT(iommu_gas_entries_tree, &domain->rb_root, curr, a->entry); return (0);
git: f081a291a17d - main - compat32: move struct ptrace_sc_ret32 definition from .c to .h
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f081a291a17de0e28e5b7f5adba312f0dcb59b0f commit f081a291a17de0e28e5b7f5adba312f0dcb59b0f Author: Konstantin Belousov AuthorDate: 2022-12-01 01:31:58 + Commit: Konstantin Belousov CommitDate: 2022-12-22 21:11:35 + compat32: move struct ptrace_sc_ret32 definition from .c to .h Reviewed by:markj Sponsoreed by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37590 --- sys/compat/freebsd32/freebsd32.h | 5 + sys/compat/freebsd32/freebsd32_misc.c | 5 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h index 96dce0d1afa4..91d95d7852b3 100644 --- a/sys/compat/freebsd32/freebsd32.h +++ b/sys/compat/freebsd32/freebsd32.h @@ -492,6 +492,11 @@ struct timex32 { int32_t stbcnt; }; +struct ptrace_sc_ret32 { + uint32_tsr_retval[2]; + int sr_error; +}; + struct ptrace_coredump32 { int pc_fd; uint32_tpc_flags; diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index df7380252ced..7537ff3e9dee 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -133,11 +133,6 @@ struct ptrace_io_desc32 { uint32_tpiod_len; }; -struct ptrace_sc_ret32 { - uint32_tsr_retval[2]; - int sr_error; -}; - struct ptrace_vm_entry32 { int pve_entry; int pve_timestamp;
git: e6feeae2f915 - main - sys: rename td_coredump to td_remotereq
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e6feeae2f915c76275b83b7365ae966a8f8dd016 commit e6feeae2f915c76275b83b7365ae966a8f8dd016 Author: Konstantin Belousov AuthorDate: 2022-11-30 08:48:24 + Commit: Konstantin Belousov CommitDate: 2022-12-22 21:11:35 + sys: rename td_coredump to td_remotereq and TDB_COREDUMPRQ to TDB_COREDUMPREQ Reviewed by:markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37590 --- sys/kern/kern_sig.c| 12 ++-- sys/kern/sys_process.c | 8 sys/sys/proc.h | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index c50a37de07e6..11c0334181e1 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2639,12 +2639,12 @@ ptrace_coredump(struct thread *td) MPASS(td == curthread); p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); - if ((td->td_dbgflags & TDB_COREDUMPRQ) == 0) + if ((td->td_dbgflags & TDB_COREDUMPREQ) == 0) return; KASSERT((p->p_flag & P_STOPPED_TRACE) != 0, ("not stopped")); - tcq = td->td_coredump; - KASSERT(tcq != NULL, ("td_coredump is NULL")); + tcq = td->td_remotereq; + KASSERT(tcq != NULL, ("td_remotereq is NULL")); if (p->p_sysent->sv_coredump == NULL) { tcq->tc_error = ENOSYS; @@ -2660,8 +2660,8 @@ ptrace_coredump(struct thread *td) vn_rangelock_unlock(tcq->tc_vp, rl_cookie); PROC_LOCK(p); wake: - td->td_dbgflags &= ~TDB_COREDUMPRQ; - td->td_coredump = NULL; + td->td_dbgflags &= ~TDB_COREDUMPREQ; + td->td_remotereq = NULL; wakeup(p); } @@ -2792,7 +2792,7 @@ stopme: td->td_dbgflags |= TDB_SSWITCH; thread_suspend_switch(td, p); td->td_dbgflags &= ~TDB_SSWITCH; - if ((td->td_dbgflags & TDB_COREDUMPRQ) != 0) { + if ((td->td_dbgflags & TDB_COREDUMPREQ) != 0) { PROC_SUNLOCK(p); ptrace_coredump(td); PROC_SLOCK(p); diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index c61234e726b9..15b93cee0f5a 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -1559,7 +1559,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) error = EBUSY; goto coredump_cleanup_locked; } - KASSERT((td2->td_dbgflags & TDB_COREDUMPRQ) == 0, + KASSERT((td2->td_dbgflags & TDB_COREDUMPREQ) == 0, ("proc %d tid %d req coredump", p->p_pid, td2->td_tid)); tcq->tc_vp = fp->f_vnode; @@ -1569,10 +1569,10 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) tcq->tc_flags |= SVC_NOCOMPRESS; if ((pc->pc_flags & PC_ALL) != 0) tcq->tc_flags |= SVC_ALL; - td2->td_coredump = tcq; - td2->td_dbgflags |= TDB_COREDUMPRQ; + td2->td_remotereq = tcq; + td2->td_dbgflags |= TDB_COREDUMPREQ; thread_run_flash(td2); - while ((td2->td_dbgflags & TDB_COREDUMPRQ) != 0) + while ((td2->td_dbgflags & TDB_COREDUMPREQ) != 0) msleep(p, &p->p_mtx, PPAUSE, "crdmp", 0); error = tcq->tc_error; coredump_cleanup_locked: diff --git a/sys/sys/proc.h b/sys/sys/proc.h index f9e905bb22d2..1552da628b11 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -384,7 +384,7 @@ struct thread { int td_oncpu; /* (t) Which cpu we are on. */ void*td_lkpi_task; /* LinuxKPI task struct pointer */ int td_pmcpend; - void*td_coredump; /* (c) coredump request. */ + void*td_remotereq; /* (c) dbg remote request. */ off_t td_ktr_io_lim; /* (k) limit for ktrace file size */ #ifdef EPOCH_TRACE SLIST_HEAD(, epoch_tracker) td_epochs; @@ -522,7 +522,7 @@ enum { #defineTDB_FSTP0x1000 /* The thread is PT_ATTACH leader */ #defineTDB_STEP0x2000 /* (x86) PSL_T set for PT_STEP */ #defineTDB_SSWITCH 0x4000 /* Suspended in ptracestop */ -#defineTDB_COREDUMPRQ 0x8000 /* Coredump request */ +#defineTDB_COREDUMPREQ 0x8000 /* Coredump request */ /* * "Private" flags kept in td_pflags:
git: f0592b3c8dd8 - main - Add a thread debugging flag TDB_BOUNDARY
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f0592b3c8dd8e172f0e7165c11371108d4d8838d commit f0592b3c8dd8e172f0e7165c11371108d4d8838d Author: Konstantin Belousov AuthorDate: 2022-12-01 00:29:35 + Commit: Konstantin Belousov CommitDate: 2022-12-22 21:11:35 + Add a thread debugging flag TDB_BOUNDARY It indicates to a debugger that the thread is stopped at the kernel->user exit path. Reviewed by:markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37590 --- sys/kern/kern_sig.c | 5 - sys/kern/subr_syscall.c | 11 --- sys/sys/proc.h | 3 ++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 11c0334181e1..eea624019fff 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -279,7 +279,7 @@ static void ast_sig(struct thread *td, int tda) { struct proc *p; - int sig; + int old_boundary, sig; bool resched_sigs; p = td->td_proc; @@ -321,12 +321,15 @@ ast_sig(struct thread *td, int tda) !SIGISEMPTY(p->p_siglist)) { sigfastblock_fetch(td); PROC_LOCK(p); + old_boundary = ~TDB_BOUNDARY | (td->td_dbgflags & TDB_BOUNDARY); + td->td_dbgflags |= TDB_BOUNDARY; mtx_lock(&p->p_sigacts->ps_mtx); while ((sig = cursig(td)) != 0) { KASSERT(sig >= 0, ("sig %d", sig)); postsig(sig); } mtx_unlock(&p->p_sigacts->ps_mtx); + td->td_dbgflags &= old_boundary; PROC_UNLOCK(p); resched_sigs = true; } else { diff --git a/sys/kern/subr_syscall.c b/sys/kern/subr_syscall.c index 33dd50d3d50a..36830a13e596 100644 --- a/sys/kern/subr_syscall.c +++ b/sys/kern/subr_syscall.c @@ -73,6 +73,7 @@ syscallenter(struct thread *td) traced = (p->p_flag & P_TRACED) != 0; if (__predict_false(traced || td->td_dbgflags & TDB_USERWR)) { PROC_LOCK(p); + MPASS((td->td_dbgflags & TDB_BOUNDARY) == 0); td->td_dbgflags &= ~TDB_USERWR; if (traced) td->td_dbgflags |= TDB_SCE; @@ -201,7 +202,7 @@ syscallenter(struct thread *td) td->td_retval[1]); if (__predict_false(traced)) { PROC_LOCK(p); - td->td_dbgflags &= ~TDB_SCE; + td->td_dbgflags &= ~(TDB_SCE | TDB_BOUNDARY); PROC_UNLOCK(p); } (p->p_sysent->sv_set_syscall_retval)(td, error); @@ -280,9 +281,13 @@ syscallret(struct thread *td) */ if (traced && ((td->td_dbgflags & (TDB_FORK | TDB_EXEC)) != 0 || - (p->p_ptevents & PTRACE_SCX) != 0)) + (p->p_ptevents & PTRACE_SCX) != 0)) { + MPASS((td->td_dbgflags & TDB_BOUNDARY) == 0); + td->td_dbgflags |= TDB_BOUNDARY; ptracestop(td, SIGTRAP, NULL); - td->td_dbgflags &= ~(TDB_SCX | TDB_EXEC | TDB_FORK); + } + td->td_dbgflags &= ~(TDB_SCX | TDB_EXEC | TDB_FORK | + TDB_BOUNDARY); PROC_UNLOCK(p); } } diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 1552da628b11..f17207d741c1 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -522,7 +522,8 @@ enum { #defineTDB_FSTP0x1000 /* The thread is PT_ATTACH leader */ #defineTDB_STEP0x2000 /* (x86) PSL_T set for PT_STEP */ #defineTDB_SSWITCH 0x4000 /* Suspended in ptracestop */ -#defineTDB_COREDUMPREQ 0x8000 /* Coredump request */ +#defineTDB_BOUNDARY0x8000 /* ptracestop() at boundary */ +#defineTDB_COREDUMPREQ 0x0001 /* Coredump request */ /* * "Private" flags kept in td_pflags:
git: 0e07241c372d - main - ptrace(2): explain how to select specific thread to operate on
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0e07241c372d7352537a4a786c96a580a721be3c commit 0e07241c372d7352537a4a786c96a580a721be3c Author: Konstantin Belousov AuthorDate: 2022-12-05 22:43:18 + Commit: Konstantin Belousov CommitDate: 2022-12-22 21:11:35 + ptrace(2): explain how to select specific thread to operate on Requested by: emaste Reviewed by:markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37590 --- lib/libc/sys/ptrace.2 | 19 +++ 1 file changed, 19 insertions(+) diff --git a/lib/libc/sys/ptrace.2 b/lib/libc/sys/ptrace.2 index 4589fac92d26..01d83897a78b 100644 --- a/lib/libc/sys/ptrace.2 +++ b/lib/libc/sys/ptrace.2 @@ -122,6 +122,25 @@ Kernel drops any signals queued to the traced children, which could be either generated by not yet consumed debug events, or sent by other means, the later should not be done anyway. +.Sh SELECTING THE TARGET +The +.Fa pid +argument of the call specifies the target on which to perform +the requested operation. +For operations affecting the global process state, the process ID +is typically passed there. +Similarly, for operations affecting only a thread, the thread ID +needs to be passed. +.Pp +Still, for global operations, the ID of any thread can be used as the +target, and system will perform the request on the process owning +that thread. +If a thread operation got the process ID as +.Fa pid , +the system randomly selects a thread from among the threads owned +by the process. +For single-threaded processes there is no difference between specifying +process or thread ID as the target. .Sh DISABLING PTRACE The .Nm
git: 140ceb5d956b - main - ptrace(2): add PT_SC_REMOTE remote syscall request
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=140ceb5d956bb8795a77c23d3fd5ef047b0f3c68 commit 140ceb5d956bb8795a77c23d3fd5ef047b0f3c68 Author: Konstantin Belousov AuthorDate: 2022-11-30 08:45:52 + Commit: Konstantin Belousov CommitDate: 2022-12-22 21:11:35 + ptrace(2): add PT_SC_REMOTE remote syscall request Reviewed by:markj Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37590 --- sys/compat/freebsd32/freebsd32.h | 7 ++ sys/compat/freebsd32/freebsd32_misc.c | 32 sys/kern/kern_sig.c | 142 +- sys/kern/sys_process.c| 74 +- sys/sys/proc.h| 1 + sys/sys/ptrace.h | 16 6 files changed, 250 insertions(+), 22 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h index 91d95d7852b3..3f37b3d85435 100644 --- a/sys/compat/freebsd32/freebsd32.h +++ b/sys/compat/freebsd32/freebsd32.h @@ -503,4 +503,11 @@ struct ptrace_coredump32 { uint32_tpc_limit1, pc_limit2; }; +struct ptrace_sc_remote32 { + struct ptrace_sc_ret32 pscr_ret; + u_int pscr_syscall; + u_int pscr_nargs; + uint32_tpscr_args; +}; + #endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */ diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index 7537ff3e9dee..7e96dd9296ee 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -966,6 +966,7 @@ freebsd32_ptrace(struct thread *td, struct freebsd32_ptrace_args *uap) struct ptrace_lwpinfo pl; struct ptrace_vm_entry pve; struct ptrace_coredump pc; + struct ptrace_sc_remote sr; struct dbreg32 dbreg; struct fpreg32 fpreg; struct reg32 reg; @@ -979,10 +980,13 @@ freebsd32_ptrace(struct thread *td, struct freebsd32_ptrace_args *uap) struct ptrace_lwpinfo32 pl; struct ptrace_vm_entry32 pve; struct ptrace_coredump32 pc; + struct ptrace_sc_remote32 sr; uint32_t args[nitems(td->td_sa.args)]; struct ptrace_sc_ret32 psr; struct iovec32 vec; } r32; + syscallarg_t pscr_args[nitems(td->td_sa.args)]; + u_int pscr_args32[nitems(td->td_sa.args)]; void *addr; int data, error, i; @@ -1081,6 +1085,28 @@ freebsd32_ptrace(struct thread *td, struct freebsd32_ptrace_args *uap) r.pc.pc_limit = PAIR32TO64(off_t, r32.pc.pc_limit); data = sizeof(r.pc); break; + case PT_SC_REMOTE: + if (uap->data != sizeof(r32.sr)) { + error = EINVAL; + break; + } + error = copyin(uap->addr, &r32.sr, uap->data); + if (error != 0) + break; + CP(r32.sr, r.sr, pscr_syscall); + CP(r32.sr, r.sr, pscr_nargs); + if (r.sr.pscr_nargs > nitems(td->td_sa.args)) { + error = EINVAL; + break; + } + error = copyin(PTRIN(r32.sr.pscr_args), pscr_args32, + sizeof(u_int) * r32.sr.pscr_nargs); + if (error != 0) + break; + for (i = 0; i < r32.sr.pscr_nargs; i++) + pscr_args[i] = pscr_args32[i]; + r.sr.pscr_args = pscr_args; + break; default: addr = uap->addr; break; @@ -1141,6 +1167,12 @@ freebsd32_ptrace(struct thread *td, struct freebsd32_ptrace_args *uap) error = copyout(&r32.psr, uap->addr, MIN(uap->data, sizeof(r32.psr))); break; + case PT_SC_REMOTE: + ptrace_sc_ret_to32(&r.sr.pscr_ret, &r32.sr.pscr_ret); + error = copyout(&r32.sr.pscr_ret, uap->addr + + offsetof(struct ptrace_sc_remote32, pscr_ret), + sizeof(r32.psr)); + break; } return (error); diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index eea624019fff..df40cdf404db 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -39,9 +39,11 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_capsicum.h" #include "opt_ktrace.h" #include +#include #include #include #include @@ -75,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -82,6 +85,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2633,37 +2637,128 @@ out
git: a98613f23892 - main - ptrace(2): document PT_SC_REMOTE
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a98613f2389227effeb9d86e47e53ea01ecddfe5 commit a98613f2389227effeb9d86e47e53ea01ecddfe5 Author: Konstantin Belousov AuthorDate: 2022-12-02 03:00:08 + Commit: Konstantin Belousov CommitDate: 2022-12-22 21:11:42 + ptrace(2): document PT_SC_REMOTE Reviewed by:markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37590 --- lib/libc/sys/ptrace.2 | 73 +++ 1 file changed, 68 insertions(+), 5 deletions(-) diff --git a/lib/libc/sys/ptrace.2 b/lib/libc/sys/ptrace.2 index 01d83897a78b..e75d3b218f28 100644 --- a/lib/libc/sys/ptrace.2 +++ b/lib/libc/sys/ptrace.2 @@ -976,10 +976,44 @@ The size of .Vt "struct ptrace_coredump" must be passed in .Fa data . -.Pp -The process must be stopped before dumping core. +.It Dv PT_SC_REMOTE +Request to execute a syscall in the context of the traced process, +in the specified thread. +The +.Fa addr +argument must point to the +.Vt "struct ptrace_sc_remote" , +which describes the requested syscall and its arguments, and receives +the result. +The size of +.Vt "struct ptrace_sc_remote" +must be passed in +.Fa data. +.Bd -literal +struct ptrace_sc_remote { + struct ptrace_sc_ret pscr_ret; + u_int pscr_syscall; + u_int pscr_nargs; + u_long *pscr_args; +}; +.Ed +The +.Dv pscr_syscall +contains the syscall number to execute, the +.Dv pscr_nargs +is the number of supplied arguments, which are supplied in the +.Dv pscr_args +array. +Result of the execution is returned in the +.Dv pscr_ret +member. +Note that the request and its result do not affect the returned value from +the currently executed syscall, if any. +.El +.Sh PT_COREDUMP and PT_SC_REMOTE usage +The process must be stopped before dumping or initiating a remote system call. A single thread in the target process is temporarily unsuspended -in kernel to write the dump. +in the kernel to perform the action. If the .Nm call fails before a thread is unsuspended, there is no event to @@ -996,9 +1030,38 @@ an error occurred, it is recommended to unconditionally perform with .Dv WNOHANG flag after -.Dv PT_COREDUMP , +.Dv PT_COREDUMP +and +.Dv PT_SC_REMOTE , and silently accept zero result from it. -.El +.Pp +For +.Dv PT_SC_REMOTE , +the selected thread must be stopped in the safe place, which is +currently defined as a syscall exit, or a return from kernel to +user mode (basically, a signal handler call place). +Kernel returns +.Er EBUSY +status if attempt is made to execute remote syscall at unsafe stop. +.Pp +Note that neither +.Dv kern.trap_enotcap +sysctl setting, nor the corresponding +.Xr procctl 2 +flag +.Dv PROC_TRAPCAP_CTL_ENABLE +are obeyed during the execution of the syscall by +.Dv PT_SC_REMOTE . +In other words, +.Dv SIGTRAP +signal is not sent to a process executing in capability mode, +which violated a mode access restriction. +.Pp +Note that due to the mode of execution for the remote syscall, in +particular, the setting where only one thread is allowed to run, +the syscall might block on resources owned by suspended threads. +This might result in the target process deadlock. +In this situation, the only way out is to kill the target. .Sh ARM MACHINE-SPECIFIC REQUESTS .Bl -tag -width "Dv PT_SETVFPREGS" .It Dv PT_GETVFPREGS
git: 6403a140243d - main - tools/test/ptrace: update scescx to do remote getpid(2) on each SCX event
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6403a140243d4f5377f589f93aeb44fe75ea8d59 commit 6403a140243d4f5377f589f93aeb44fe75ea8d59 Author: Konstantin Belousov AuthorDate: 2022-12-02 01:26:13 + Commit: Konstantin Belousov CommitDate: 2022-12-22 21:32:09 + tools/test/ptrace: update scescx to do remote getpid(2) on each SCX event Reviewed by:markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37590 --- tools/test/ptrace/scescx.c | 34 ++ 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/tools/test/ptrace/scescx.c b/tools/test/ptrace/scescx.c index 582d1734427e..8f19f9a55889 100644 --- a/tools/test/ptrace/scescx.c +++ b/tools/test/ptrace/scescx.c @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -213,9 +214,13 @@ wait_info(int pid, int status, struct ptrace_lwpinfo *lwpinfo) printf("\n"); } +static int trace_syscalls = 1; +static int remote_getpid = 0; + static int trace_sc(int pid) { + struct ptrace_sc_remote pscr; struct ptrace_lwpinfo lwpinfo; int status; @@ -269,6 +274,24 @@ trace_sc(int pid) wait_info(pid, status, &lwpinfo); assert(lwpinfo.pl_flags & PL_FLAG_SCX); + if (remote_getpid) { + memset(&pscr, 0, sizeof(pscr)); + pscr.pscr_syscall = SYS_getpid; + pscr.pscr_nargs = 0; + if (ptrace(PT_SC_REMOTE, pid, (caddr_t)&pscr, + sizeof(pscr)) < 0) { + perror("PT_SC_REMOTE"); + ptrace(PT_KILL, pid, NULL, 0); + return (-1); + } else { + printf(TRACE "remote getpid %ld errno %d\n", + pscr.pscr_ret.sr_retval[0], pscr.pscr_ret.sr_error); + if (waitpid(pid, &status, 0) == -1) { + perror("waitpid"); + return (-1); + } + } + } if (lwpinfo.pl_flags & PL_FLAG_EXEC) get_pathname(pid); @@ -322,8 +345,6 @@ trace_cont(int pid) return (0); } -static int trace_syscalls = 1; - static int trace(pid_t pid) { @@ -340,12 +361,16 @@ main(int argc, char *argv[]) pid_t pid, pid1; trace_syscalls = 1; + remote_getpid = 0; use_vfork = 0; - while ((c = getopt(argc, argv, "csv")) != -1) { + while ((c = getopt(argc, argv, "crsv")) != -1) { switch (c) { case 'c': trace_syscalls = 0; break; + case 'r': + remote_getpid = 1; + break; case 's': trace_syscalls = 1; break; @@ -354,7 +379,8 @@ main(int argc, char *argv[]) break; default: case '?': - fprintf(stderr, "Usage: %s [-c] [-s] [-v]\n", argv[0]); + fprintf(stderr, "Usage: %s [-c] [-r] [-s] [-v]\n", + argv[0]); return (2); } }
git: 974be51b3f60 - main - Fixes for ptrace_syscallreq()
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=974be51b3f6070f9aae02e115ea6099f90bc9175 commit 974be51b3f6070f9aae02e115ea6099f90bc9175 Author: Konstantin Belousov AuthorDate: 2022-12-22 23:51:34 + Commit: Konstantin Belousov CommitDate: 2022-12-22 23:53:41 + Fixes for ptrace_syscallreq() Re-assign the sc local (syscall number) before moving args for SYS_syscall. Correct the audit and kdtrace hooks invocations. Fixes: 140ceb5d956bb8795a77c23d3fd5ef047b0f3c68 Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/kern_sig.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index df40cdf404db..e0ef60d0ca20 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2672,6 +2672,7 @@ ptrace_syscallreq(struct thread *td, struct proc *p, sc = tsr->ts_sa.code; if (sc == SYS_syscall || sc == SYS___syscall) { + sc = tsr->ts_sa.args[0]; memmove(&tsr->ts_sa.args[0], &tsr->ts_sa.args[1], sizeof(register_t) * (tsr->ts_nargs - 1)); } @@ -2692,7 +2693,7 @@ ptrace_syscallreq(struct thread *td, struct proc *p, #endif sy_thr_static = (se->sy_thrcnt & SY_THR_STATIC) != 0; - audited = AUDIT_SYSCALL_ENTER(tsr->ts_syscall, td) != 0; + audited = AUDIT_SYSCALL_ENTER(sc, td) != 0; if (!sy_thr_static) { error = syscall_thread_enter(td, se); @@ -2716,7 +2717,7 @@ ptrace_syscallreq(struct thread *td, struct proc *p, #ifdef KDTRACE_HOOKS if (se->sy_return != 0) (*systrace_probe_func)(&tsr->ts_sa, SYSTRACE_RETURN, - tsr->ts_ret->sr_error != 0 ? -1 : td->td_retval[0]); + tsr->ts_ret.sr_error != 0 ? -1 : td->td_retval[0]); #endif tsr->ts_ret.sr_retval[0] = td->td_retval[0];
git: 5ba0691da9e2 - main - Rename left off of eqos to if_eqos accordingly.
The branch main has been updated by ganbold: URL: https://cgit.FreeBSD.org/src/commit/?id=5ba0691da9e2e252411e5de3b58295f64fd8fefe commit 5ba0691da9e2e252411e5de3b58295f64fd8fefe Author: Søren Schmidt AuthorDate: 2022-12-23 05:28:50 + Commit: Ganbold Tsagaankhuu CommitDate: 2022-12-23 05:28:50 + Rename left off of eqos to if_eqos accordingly. --- sys/dev/eqos/if_eqos.c | 4 ++-- sys/dev/eqos/if_eqos_fdt.c | 2 +- sys/dev/eqos/if_eqos_if.m | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/eqos/if_eqos.c b/sys/dev/eqos/if_eqos.c index cacc51ef97b5..1eba702bb524 100644 --- a/sys/dev/eqos/if_eqos.c +++ b/sys/dev/eqos/if_eqos.c @@ -216,7 +216,7 @@ eqos_miibus_statchg(device_t dev) WR4(sc, GMAC_MAC_CONFIGURATION, reg); - EQOS_SET_SPEED(dev, IFM_SUBTYPE(mii->mii_media_active)); + IF_EQOS_SET_SPEED(dev, IFM_SUBTYPE(mii->mii_media_active)); WR4(sc, GMAC_MAC_1US_TIC_COUNTER, (sc->csr_clock / 100) - 1); } @@ -1143,7 +1143,7 @@ eqos_attach(device_t dev) } - if ((error = EQOS_INIT(dev))) + if ((error = IF_EQOS_INIT(dev))) return (error); mtx_init(&sc->lock, "eqos lock", MTX_NETWORK_LOCK, MTX_DEF); diff --git a/sys/dev/eqos/if_eqos_fdt.c b/sys/dev/eqos/if_eqos_fdt.c index 020aeb435285..5aa5e26a85fd 100644 --- a/sys/dev/eqos/if_eqos_fdt.c +++ b/sys/dev/eqos/if_eqos_fdt.c @@ -243,7 +243,7 @@ static device_method_t eqos_fdt_methods[] = { DEVMETHOD(device_probe, eqos_fdt_probe), /* EQOS interface */ - DEVMETHOD(eqos_init,eqos_fdt_init), + DEVMETHOD(if_eqos_init, eqos_fdt_init), DEVMETHOD_END }; diff --git a/sys/dev/eqos/if_eqos_if.m b/sys/dev/eqos/if_eqos_if.m index 0f56ce76c960..59eea33afa0e 100644 --- a/sys/dev/eqos/if_eqos_if.m +++ b/sys/dev/eqos/if_eqos_if.m @@ -28,7 +28,7 @@ # $Id: eqos_if.m 921 2022-08-09 18:38:11Z sos $ # -INTERFACE eqos; +INTERFACE if_eqos; CODE { static int