Jailbreaking means taking control. It means unlocking the computer within so that it becomes a true general purpose computer. It means being able to run your own software, not just what they approve. It means being able to circumvent their DRM if you want.
I believe the term either originally came from, or was at least popularized by people wanting to escape Apple's "walled garden", which is also viewed by some as a jail.
Modern game consoles (but lots of other devices, including Apple's iOS, which used to have one of the most restrictive environments to develop applications on - it's slightly better these day - as well) restrict the sort of code you're allowed to run on it to only what the manufacturer allows you to run.
"Jailbreaking" in this context means that you can bypass those sorts of restrictions, with the implementation of what that entails differing per device.
The alternate term you often hear used for this sort of hacking (and slightly older since it predates the iphone) is Homebrew.
https://ctf101.org/binary-exploitation/return-oriented-progr....
https://trustfoundry.net/2019/07/18/basic-rop-techniques-and...
This is important as modern no-execute et al. prevent you from simply dumping arbitrary code into memory and running it.
Consequently, modern exploits tend to look like: (1) figure out how memory is laid out, or close enough, (2) calculate where a useful function is, that you can call with arbitrary parameters (aka a gadget), (3) abuse that function to do your bidding by controlling its parameters and the instruction pointer.
(2) gets around your inability to write + execute code directly, because the system is by definition already set up to allow built-in code to execute. And that built-in code generally does lots of useful things (like reading and writing memory).
ASLR makes (1) harder, but fundamental efficiency reasons at the operating system code level mean than usually "everything" isn't fully randomized.
> Consequently, modern exploits tend to look like: (1) figure out how memory is laid out, or close enough, (2) calculate where a useful function is, that you can call with arbitrary parameters (aka a gadget), (3) abuse that function to do your bidding by controlling its parameters and the instruction pointer.
This is all correct, but generally a gadget is what a snippet of assembly / machine code that you call to get the CPU into a state to call a function. So its less a function and more a set of instructions (anywhere) that are useful.
So for example, you might have a gadget to set specific registers with values off the stack so you can call malloc with the correct size, etc.
Now get the hell off my lawn you whippersnappers, before I throw my teef at you.
https://en.wikipedia.org/wiki/Gadget_(disambiguation)#Scienc...
The idea being that a code "gadget" is something similarly small and innocuous-looking that turns out to have far, far more powerful effects than anyone would guess just by looking at it.