Figured out what was wrong with the 5.17.11 kernel, it is an option I selected which strengthens the kernel by zeroing the stack to initialize everything before a call and after, this required an argument to gcc which gcc-12.1 doesn’t understand. It’s only an issue in a module used for Nvidia compatibility but Ubuntu and other debian based releases are depending upon the presence of this particular library and without it act very erratically, the kernel also seems to not be stable with this option so on both notes it was a bad choice. Was just trying to harden the systems against stack exploits.