Why Windows 10 requires the NX bit

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
Post Reply
clementttttttttt
Member
Member
Posts: 70
Joined: Tue Jul 14, 2020 4:01 am
Libera.chat IRC: clementttttttttt

Why Windows 10 requires the NX bit

Post by clementttttttttt »

Still remember I bought a new pc back in 2015 just because of that. Windows sucks.
nullplan
Member
Member
Posts: 1769
Joined: Wed Aug 30, 2017 8:24 am

Re: Why Windows 10 requires the NX bit

Post by nullplan »

Because it does? Because supporting both the NX bit and machines that don't have it is complicated? Because people were getting exploited by stack smashes like it's 1991, and MS decided to do something about it? What kind of dinosaur did you have that did not support the NX bit in 2015?

Windows sucks for many reasons, but the NX bit is not one of them.
Carpe diem!
User avatar
iansjack
Member
Member
Posts: 4688
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Why Windows 10 requires the NX bit

Post by iansjack »

clementttttttttt wrote:Still remember I bought a new pc back in 2015 just because of that. Windows sucks.
Windows 10 won't run on my 5150.
Without deviation from the norm, progress is not possible.

Frank Zappa
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: Why Windows 10 requires the NX bit

Post by Schol-R-LEA »

How old was this system? IIUC, AMD introduced the NX bit in 2003 when they introduced AMD64 (x86-64 - technically, AMD64 was specified in 1999, but 2003 was when it first hit the market), while Intel followed suit with the equivalent XD bit the next year. A system that doesn't have an NX (or XD, same thing) bit would have to date no later than around 2006, meaning that probably wouldn't have had the minimum memory capacity and runtime performance to run Windows 10 (or even Windows 7) regardless.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
User avatar
eekee
Member
Member
Posts: 872
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: Why Windows 10 requires the NX bit

Post by eekee »

Win10 won't run on my Toshiba T1200 either. ;)

Surprisingly, I have a 2GB laptop which runs Win10 quite well. I expect very little of it, mind you; just Zoom, occasionally one or two web pages, and a few other programs which were efficient in the 90s, never mind now. I have noticed it can be literally months behind my desktop in updates. I don't know why, but I guess MS might size-optimize the occasional well-debugged update for the little machines.

As for the NX bit, I wouldn't want to run a web browser on anything which didn't have one. Nor would I install anything from an app store on such a device. Dodgy downloaded software is the concern here, including scripted web pages. Now I think of it, maybe it's not such a bad thing I threw out my old eeePC 1005HA with the Android-x86 installation. (The charging port had melted and I didn't feel up to soldering it.)
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
foliagecanine
Member
Member
Posts: 148
Joined: Sun Aug 23, 2020 4:35 pm

Re: Why Windows 10 requires the NX bit

Post by foliagecanine »

eekee wrote:Surprisingly, I have a 2GB laptop which runs Win10 quite well
2GB!?! My (new) laptop's Win10 install eats over 5GB RAM just by existing! As soon as I open a program, it gobbles up my first 8GB RAM stick. And I don't think I'm running a ton of services or things.
I had to disable the thing that auto-closes programs when you run low on RAM, cause as soon as I hit 67% (of 16GB) it just crashed everything.
Sorry. A bit off topic.

Anyways, my desktop PC with a circa-2010 CPU (i7-880) seems to have an NX bit, as I got Win10 running at one point.
The only computer I've seen Win10 fail (or more accurately, the live Windows-ish thing that basically just gives you a command prompt) on was a laptop that is still running WinXP.
I haven't tried it in a while, but I'm pretty sure it failed because it didn't have PAE/NX.
I don't exactly know how old that was, but it was bought somewhere between 2002 and 2008.

Either way, it only had like a gig or two of RAM, so a full install wouldn't have been ideal anyways.
I mainly wanted to use Windows-ish to back it up, but I ended up just loading a linux image and dd-ing it for 50 hours (yes, it took forever. It was only like 60GB too!)
I even tried the built-in Windows XP backup program, but it needed a floppy drive, which that laptop didn't have #-o

Either way, I don't blame the Windows dev team for requiring the NX bit. It's been standard for a decade and a half.

EDIT: I don't know what I did or when, but now it is stable at 3GB when existing and 5GB when open something. I think I also fixed the 67% problem.
Last edited by foliagecanine on Sat Jan 30, 2021 10:29 pm, edited 1 time in total.
My OS: TritiumOS
https://github.com/foliagecanine/tritium-os
void warranty(laptop_t laptop) { if (laptop.broken) return laptop; }
I don't get it: Why's the warranty void?
nullplan
Member
Member
Posts: 1769
Joined: Wed Aug 30, 2017 8:24 am

Re: Why Windows 10 requires the NX bit

Post by nullplan »

foliagecanine wrote:I haven't tried it in a while, but I'm pretty sure it failed because it didn't have PAE/NX.
I did see a youtube video once about the Odyssey of installing Windows 10 on an old laptop. It failed on an old system because it had no PAE, then it failed on a somewhat less old system because it had PAE but failed to advertise that with CPUID, and then it finally worked the next CPU generation over. Unfortunately I forgot the name of the channel now.

Supporting both PAE and legacy paging is hard work, since the page table formats are completely different. Two layers instead of three, and each entry is four bytes instead of eight. You basically have to write the entire code twice.
foliagecanine wrote:Either way, I don't blame the Windows dev team for requiring the NX bit. It's been standard for a decade and a half.
Yeah. I may have overstated how problematic it would be for a general purpose OS (you just have a global variable containing either the NX bit or 0, initialize it once at startup, then OR in that variable instead of the NX bit directly whenever you need), but supporting those old systems would mean serious security flaws would open up, like enabling stack smashing like back in the bad old days. I mean, ROP still exists, but at least some DEP would be in place. I suppose you could go the OpenBSD route on 32-bit systems and lower the CS limit, but that is a bit inflexible, it makes kernel code injection harder (you have to inject the vDSO as low as possible in address space, when it is often put as high as possible to stay out of the way of legacy brk() heap expansion, or other user space expectations), and is not available on 64-bit systems. I am not aware of any 64-bit systems not supporting NX at this time, but I don't know what they will come up with next.
Carpe diem!
User avatar
eekee
Member
Member
Posts: 872
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: Why Windows 10 requires the NX bit

Post by eekee »

foliagecanine wrote:
eekee wrote:Surprisingly, I have a 2GB laptop which runs Win10 quite well
2GB!?! My (new) laptop's Win10 install eats over 5GB RAM just by existing! As soon as I open a program, it gobbles up my first 8GB RAM stick. And I don't think I'm running a ton of services or things.
I had to disable the thing that auto-closes programs when you run low on RAM, cause as soon as I hit 67% (of 16GB) it just crashed everything.
Sorry. A bit off topic.
I can't help replying with wonder, because my 8GB Win10 machine is almost entirely acceptable. However, it and the 2GB machine are both refurbs; they had OEM Win10 when I bought them. I expect the shop made that change and probably several others.

The few machines I still have which I'm sure don't have the NX bit are too old for Win XP never mind 10. :) In the case of the newest, a late-90s laptop, I think it's just a driver issue with the installer, but still!
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
nexos
Member
Member
Posts: 1078
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: Why Windows 10 requires the NX bit

Post by nexos »

@foliagecanine: If you bought your's retail, then it is probably because of all the junk manufacturers install on new machines. My W10 laptop has always been slow. I think on my next machine, I might purchase it and then overwrite Windows with Linux.
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
User avatar
austanss
Member
Member
Posts: 377
Joined: Sun Oct 11, 2020 9:46 pm
Location: United States

Re: Why Windows 10 requires the NX bit

Post by austanss »

foliagecanine wrote:
eekee wrote:Surprisingly, I have a 2GB laptop which runs Win10 quite well
2GB!?! My (new) laptop's Win10 install eats over 5GB RAM just by existing! As soon as I open a program, it gobbles up my first 8GB RAM stick. And I don't think I'm running a ton of services or things.
Obviously, the more RAM you have, the more RAM that will be used to index it. But it seems Windows does it rather inefficiently.
Skylight: https://github.com/austanss/skylight

I make stupid mistakes and my vision is terrible. Not a good combination.

NOTE: Never respond to my posts with "it's too hard".
User avatar
eekee
Member
Member
Posts: 872
Joined: Mon May 22, 2017 5:56 am
Location: Kerbin
Discord: eekee
Contact:

Re: Why Windows 10 requires the NX bit

Post by eekee »

Update: The stability of Windows Explorer is highly variable on my 8GB Win10 machine. (I barely use it on the 2GB machine.) This includes the desktop, the task bar, and the all-windows view which you get by pressing win-tab. It had been stable for a few months when I posted, but before that it was unstable. It went through another extremely unstable phase after a recent .NET update, 1/2 win-tab operations failing, but it got somewhat better after a couple of weeks. Every crash shuffles taskbar buttons (within the app groups), which is irritating. Rarely, crashes will reset the task bar's location and size.

My friend tells me Win10 gets extremely slow if you replace the shell (Explorer). I haven't tried, but I have noticed launching my modified version of CAL-4700 from MSYS2 is extremely slow, apparently because Windows Defender scans the target executable every time. CAL-4700 is a Plain English Programming IDE unrelated to MSYS2. On the other hand, my modified CAL-4700 (which I regularly recompile without any sort of security certificate or other verification) can launch itself and MSYS2's mintty (edit: and many other programs) just fine.
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie
Post Reply