On Tue, Sep 08, 2026 at 02:07:14PM -0400, Zack Rusin wrote: > Full panic text is useful on ordinary guests. Encrypted guests should > export it only when an administrator opts in. Reporting a crash does not > require transferring the log. > > Enable panic recording by default for ordinary VMware guests and disable > it when guest memory encryption is active. Expose the policy as the > boolean kernel.vmware_record_panic_msg sysctl and document that it > controls only the vmware.log transfer. > > Register the sysctl only after the panic buffer and dumper are ready, and > only when sysctl support is built. A registration failure leaves the > internal default in force. > > Signed-off-by: Zack Rusin <[email protected]> > --- > Documentation/admin-guide/sysctl/kernel.rst | 14 +++++++++++++ > arch/x86/kernel/cpu/vmware.c | 23 +++++++++++++++++++++ > 2 files changed, 37 insertions(+) > > diff --git a/Documentation/admin-guide/sysctl/kernel.rst > b/Documentation/admin-guide/sysctl/kernel.rst > index b6328cd0f43e..4577e935ddcf 100644 > --- a/Documentation/admin-guide/sysctl/kernel.rst > +++ b/Documentation/admin-guide/sysctl/kernel.rst > @@ -1690,6 +1690,20 @@ entry will default to 2 instead of 0. > = ============================================================= > > > +vmware_record_panic_msg > +======================= > + > +Controls whether panic kmsg data is written to the host's ``vmware.log``. > +This setting does not control the separate VMware guest-crash event. > + > += ============================================================== > +0 Do not write panic kmsg data to ``vmware.log``. This is the > + default for encrypted guests. > +1 Write panic kmsg data to ``vmware.log``. This is the default for > + ordinary guests. > += ==============================================================
This seems like it can be represented in a boolean value. Any reason why
you did not use proc_dobool for your handler? Would it make sense to
have vmware_record_panic_msg as a boolean?
Best
> +
> +
> warn_limit
> ==========
>
> diff --git a/arch/x86/kernel/cpu/vmware.c b/arch/x86/kernel/cpu/vmware.c
> index bf59653d6e07..3848811550e9 100644
> --- a/arch/x86/kernel/cpu/vmware.c
> +++ b/arch/x86/kernel/cpu/vmware.c
> @@ -31,6 +31,7 @@
> #include <linux/efi.h>
> #include <linux/reboot.h>
> #include <linux/static_call.h>
> +#include <linux/sysctl.h>
> #include <linux/wordpart.h>
> #include <linux/sched/cputime.h>
> #include <asm/div64.h>
> @@ -255,6 +256,19 @@ static int vmware_log_rpc(const char *buffer, size_t
> length)
> }
>
> static struct page *vmware_panic_page;
> +static int vmware_record_panic_msg;
> +
> +static const struct ctl_table vmware_panic_sysctls[] = {
> + {
> + .procname = "vmware_record_panic_msg",
> + .data = &vmware_record_panic_msg,
> + .maxlen = sizeof(vmware_record_panic_msg),
> + .mode = 0644,
> + .proc_handler = proc_dointvec_minmax,
> + .extra1 = SYSCTL_ZERO,
> + .extra2 = SYSCTL_ONE,
> + },
> +};
>
> static void vmware_panic_log_dump(struct kmsg_dumper *dumper,
> struct kmsg_dump_detail *detail)
> @@ -263,6 +277,9 @@ static void vmware_panic_log_dump(struct kmsg_dumper
> *dumper,
> char *buffer = page_address(vmware_panic_page);
> size_t length = 0;
>
> + if (!READ_ONCE(vmware_record_panic_msg))
> + return;
> +
> memcpy(buffer, VMWARE_LOG_PREFIX, VMWARE_LOG_PREFIX_LEN);
> kmsg_dump_rewind(&iter);
> (void)kmsg_dump_get_buffer(&iter, true,
> @@ -283,6 +300,9 @@ static int __init vmware_panic_log_init(void)
> if (!hypervisor_is_type(X86_HYPER_VMWARE))
> return 0;
>
> + vmware_record_panic_msg =
> + !cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT);
> +
> vmware_panic_page = alloc_page(GFP_KERNEL);
> if (!vmware_panic_page) {
> pr_err("failed to allocate panic log buffer\n");
> @@ -295,6 +315,9 @@ static int __init vmware_panic_log_init(void)
> __free_page(vmware_panic_page);
> vmware_panic_page = NULL;
> }
> + if (vmware_panic_page && IS_ENABLED(CONFIG_SYSCTL) &&
> + !register_sysctl("kernel", vmware_panic_sysctls))
> + pr_err("failed to register panic log sysctl\n");
>
> return 0;
> }
> --
> 2.53.0
>
signature.asc
Description: PGP signature

