Skip to content

Instantly share code, notes, and snippets.

View Ethorbit's full-sized avatar

Ethorbit Ethorbit

View GitHub Profile
@Ethorbit
Ethorbit / linux-ryzen-nested-virtualization-crashing-host-solution.md
Last active January 5, 2025 19:47
The solution for a Linux hypervisor host crashing due to a Ryzen vulnerability with Nested Virtualization

My scenario: I wanted to use Hyper-V's GPU Partitioning and WSL technology inside a Proxmox Virtual machine so that I could continue using Linux natively while taking advantage of Microsoft's groundbreaking virtualization features.

Problem

There is a vulnerability with the Ryzen Processor that allows a nested virtual machine's application to crash the underlying host system and even compromise the host entirely.

Sources:

@Ethorbit
Ethorbit / patch-damages.sh
Created October 20, 2024 01:51
Bash script to replace all SWEP.Primary.Damage = # with SWEP.Primary.Damage = nZCSODmg(#), meant for patching CSO weapons en masse
#!/usr/bin/env bash
WEAPON_LUA_PATH="$1"
patch_damage() {
weapon_lua_file="$1"
primary_damage_line=$(cat "$weapon_lua_file" | grep "SWEP.Primary.Damage")
# File has no SWEP.Primary.Damage set, probably not a weapon
[ -z "$primary_damage_line" ] && return
@Ethorbit
Ethorbit / yt-paid-promotion-banner-remover.txt
Last active March 5, 2025 14:41
Ublock Origin filter to hide YouTube paid promotion banner so you can click the top left of video thumbnails again
www.youtube.com##div[class^='ytInlinePlayerControlsTopLeftControls']
@Ethorbit
Ethorbit / gpupv-acceleration-tut.md
Last active February 5, 2025 16:23
Hyper-V tutorial to partition GPU for virtualization + achieve full GPU acceleration with it and daily drive it.
@Ethorbit
Ethorbit / xinput-mouse.sh
Last active February 14, 2024 06:20
Sets xinput acceleration for all mice devices of the same name, in this case 'Razer Razer DeathAdder V2'
for xinput_id in $(xinput list | grep 'Razer Razer DeathAdder V2' | grep -o 'id=[0-9]*' | cut -c 4-); do
xinput --set-prop "$xinput_id" "libinput Accel Speed" -0.7
done
@Ethorbit
Ethorbit / proxmox-evsieve-hooks.sh
Created December 30, 2023 11:56
proxmox-evsieve-hooks.sh Allows me to switch virtual machines at the press of a button without the need to login to the web ui
#!/bin/bash
source /root/.bashrc
KEY="$1"
if [ -z "$KEY" ]; then
key_combo="key:rightshift key:rightalt key:rightctrl"
evsieve --input /dev/input/by-id/uinput-persist-z12-keyboard0 \
--hook $key_combo key:f5 exec-shell="$0 f5" \
--hook $key_combo key:f9 exec-shell="$0 f9" \
@Ethorbit
Ethorbit / second-gpu.sh
Last active December 22, 2023 03:35
A Proxmox hookscript (/var/lib/vz/snippets/second-gpu.sh) that releases my NVIDIA GPU after the VM stops so that I can display the host terminal.
#!/bin/bash
SECOND_GPU="0000:01:00.0"
# First argument is the vmid
# Second argument is the phase
VMID="$1"
shift
PHASE="$1"
if [ "$PHASE" = "post-stop" ]; then
@Ethorbit
Ethorbit / vfio-unbind-gpu.sh
Created August 6, 2023 02:42
Unbinds my NVIDIA GPU from the VFIO drivers and binds them to the nvidia drivers so the GPU can be used normally on the host again.
#!/bin/bash
virsh nodedev-reattach pci_0000_26_00_0
virsh nodedev-reattach pci_0000_26_00_1
modprobe nvidia
modprobe nvidia_modeset
modprobe nvidia_uvm
modprobe nvidia_drm
systemctl start nfancurve.service
@Ethorbit
Ethorbit / vfio-bind-gpu.sh
Created August 6, 2023 02:41
Binds my NVIDIA gpu to VFIO drivers so the GPU can be used for virtualization
#!/bin/bash
systemctl stop nfancurve.service
virsh nodedev-detach pci_0000_26_00_0
virsh nodedev-detach pci_0000_26_00_1
@Ethorbit
Ethorbit / default-desktop.service
Created June 13, 2023 04:55
Systemd service to set the default Steam Deck desktop session
[Unit]
Description=Forces gamescope to be the desktop session on boot
[Service]
Type=oneshot
ExecStart=/bin/sh -c 'grep gamescope /etc/sddm.conf.d/zz-steamos-autologin.conf || sudo -u deck /usr/sbin/steamos-session-select gamescope'
[Install]
WantedBy=multi-user.target