Samsung Laptop Bug Is Not Linux Specific
First time accepted submitter YurB writes "Matthew Garrett, a Linux kernel developer who was investigating the recent Linux-on-Samsung-in-UEFI-mode problem, has bricked a Samsung laptop using a test userspace program in Windows. The most fascinating part of the story is on what is actually causing the firmware boot failure: 'Unfortunately, it turns out that some Samsung laptops will fail to boot if too much of the [UEFI] variable storage space is used. We don't know what "too much" is yet, but writing a bunch of variables from Windows is enough to trigger it. I put some sample code here — it writes out 36 variables each containing a kilobyte of random data. I ran this as an administrator under Windows and then rebooted the system. It never came back.'"
Embrace Linux as an additional test suite for your hardware.
it writes out 36 variables each containing a kilobyte of random data
36k clearly isn't enough for anyone.
Does windows crash if it has 0 temp space or 0 ram free real+VM?
Or at least in older vers? or on systems with very low ram.
It doesn't appear to bother Matthew too much when he irrecoverably bricks a laptop. I wonder if his new employer Nebula is proving all the hardware to destroy or is it his previous employer Red Hat?
So installing too many operating system will result in a brick, Windows in particular uses a lot of NV storage for it's boot entry, be careful when using BCDEDIT.exe...
These guys are intentionally trying to brick their laptops? I understand what they're trying to do, but don't they care about their money going down the drain, or are they getting free laptops from Samsung somehow?
We all know perfectly well that malware makers will start including a module that purposefully bricks Samsung laptops so that extortionists can threaten to wipe out a batch of corporate-owned laptops in one blow if the company refuses to cough up a substantial amount. No matter how this affair plays out, I can't see it ending well for Samsung.
A truly excellent pizza parlor is a delight unto the heavens. Treasure the sauce and the toppings!
He forgot the line, "Try it yourself and see." :)
Reminds me of the old IRC days when n00bs would ask what the command was to get channel admin privelages. "+++ATH" was the normal answer. :)
-Charlie
Is this the same Matthew Garrett? and this one?
I'm pretty confident that this isn't out of pocket for him ... or he's REALLY dedicated to the Linux kernel and in that case, he needs to get a girlfriend.
Sorry, but if removing the battery or otherwise resetting the NVRAM to factory defaults resolves the issue, that's not even remotely "bricked".
There are TONS of ways to screw something up to the point of needing factory default reset. Just because you find some new clever way of doing it doesn't make it a bricking... Please reserve the word for cases where firmware is so screwed up the problem can only be resolved with a soldering iron.
Also, what is so special about a userspace program preventing the system from booting. The OS installer was a userspace program.
The OS SHOULD be able to manipulate your firmware, this lets it do fancy things like manage boot order, detect the current boot device - which is an educated guess on a legacy BIOS, configure addon firmware - LAN/SAN boot, configure OOB management cards etc. Most of you already flash your BIOS from userspace. [If] You have access to entirely overwrite the thing, you SHOULD have more fine grained control over firmware from the OS. Of course the OS requires administrator access to do this... DUH.
Queue up EFI haters (cuz teh Macs haz it) & people who think requiring kernels drivers to do double duty providing both kernel and their own special userspace interfaces to addon cards is AWESOME because dood, you should just give all your driver source to us anyway that way we can haz (semi-not-really) standard /sys interface to it for uzer to VI it.
Yes, I am jaded.
That's what swap space is for (aka the pagefile on Windows).
Your system will try to dump memory into swap space. If you don't have swap space, on Linux at least, processes will fail to run and you'll get some messages in dmesg that you're running out of available RAM.
Depending on the application, the application that is trying to allocate memory may crash.
I have yet to see a full system hault brcause of it though.
oooops
Microsoft doesn't want you installing other OSs on their machines.
“He’s not deformed, he’s just drunk!”
I've seen Windows machines run out of handles. First you see applications not drawing properly, or missing buttons, then you see windows failing to be created. When it tries to create the window, it fails, then you hear the "Critical Stop" sound played instead of a dialog appearing.
Sometimes, it won't even create menus, so you can't right-click on a program in your taskbar and close it, but you can still activate the window and press Alt+F4 to close the program.
Once your system gets into that state, start closing programs (Calc, Explorer windows, etc. ) until you can use your computer again. Once you've closed enough programs, your computer works again. Don't even need to reboot.
The code writes 48 1kb vars. The summary is wrong.
(char)rand();
Extremely minor nitpick, but converting an out-of-range value to a signed integral type causes implementation-defined behaviour (which could include raising a signal).
It's pretty safe to say that Microsoft will never release a compiler that breaks this, but portability could be maximised by making 'testdata' be 'unsigned char' and removing the cast in the quoted code (out-of-range conversions of unsigned integral types causes the value to be reduced using modular arithmetic - no cast is required or desired).
I have yet to see a full system hault brcause of it though.
Last time I discussed it, Linux would kill a heuristically-chosen process (the "OOM Killer", it will avoid killing a process owned by root, balanced by killing something using lots of RAM and maybe CPU, I can't remember). Windows will crash.
Both behaviours are acceptable. Arguably, the Linux one is worse in some cases -- it might leave the system in an unnoticed but inconsistent state.
This just goes to show that UEFI is top-heavy, fragile, and not ready for prime time.
The point is, this is reserved NVRAM space for UEFI's settings, and not memory or hard drive space that can usually be accessed from Windows or Linux userspace (some other comments have mentioned that UEFI-ready Linux kernels can save small crash dumps to this space). It's not that Windows hangs when the machine starts in this state, it's that the machine doesn't even POST far enough to start Windows (or Linux, or OS X, or any other OS).
Thanks for the Windows 95 tech support tip.
That's not what the OOM killer is for. Linux will allow over-commitment of memory (programs can malloc more memory (RAM plus swap) than is available). If all the malloc'ed memory is actually used, this can lead to more memory having been allocated than is available. This is when the OOM killer starts work killing tasks.
This behavior can be modified by changing the values in /proc/sys/vm/overcommit_ratio and /proc/sys/vm/overcommit_memory.
As an experiment, I wrote a little progrem that malloc'ed 200MB chunks of memory. I ran this on a Linux box with 2GB of RAM and all the SWAP disabled. The program could malloc 3GB of RAM before the allocation requests failed.
The real "Libtards" are the Libertarians!
That's often a case of running out of desktop heap rather than handles.
Interesting. Does this mean that before too long there's going to be a nice glut of Samsung laptops being sold as refurbs? Replace, reflash, resell?
fencepost
just a little off
As an experiment, I wrote a little progrem that malloc'ed 200MB chunks of memory. I ran this on a Linux box with 2GB of RAM and all the SWAP disabled. The program could malloc 3GB of RAM before the allocation requests failed.
You were running on 32 bit? You will hit the same limit whether you have 256MB or 16GB then.
Finally! A year of moderation! Ready for 2019?
Windows 7 and 8 give you messages that you are running low on memory. I'm not 100 percent sure, but I think they kill the largest userspace program (though this just might be the program dying from lack of ram). Running out of (disk) space is generally the bigger problem, linux doesn't like to log you in if it cannot syslog the attempt to disk.
Fix the bug for Linux, let M$ rot in hell.
Sorry, what? You are saying that a 32-bit machine with no swap and 256MB or RAM would allow 3GB of memory to malloc'ed? I don't think so. My point was that with a total of 2GB of memory in the system (2GB RAM and zero swap), a program can malloc 3GB.
The real "Libtards" are the Libertarians!
Huh? Someone needs a K&R refresher...
You can malloc() as much as you want until you run out of address space. That's 3GB on 32-bit systems, no matter how much RAM you have. Things will only go wrong if you attempt to use it for anything.
Sorry, but no. My tests showed that the amount of memory you can malloc() is dependent on the values in /proc/sys/vm/overcommit_ratio and /proc/sys/vm/overcommit_memory
The real "Libtards" are the Libertarians!
That's definitely a resource leak that I've hit before. It doesn't seem to be cleaned up completely by closing the offending process. Sure you can prolong the reboot for a while. But eventually you can only keep a couple of application windows open before hitting the limit and you'll need to reboot anyway to actually get some work done.
09F91102 no, 455FE104 nope, F190A1E8 uh-uh, 7A5F8A09 that's not it, C87294CE no. Ah! 452F6E403CDF10714E41DFAA257D313F.
I'm sorry, you're right - I was under the impression that overcommit_memory defaulted to permissive rather than heuristic allocation. However, overcommit_ratio is also ignored by default.
buffer overrun? and when the storage gets full it starts to over write other config data with junk.
That remind me of an assembly language course I took at the University, where we had to implement a mathematical algorithm in x86 assembly. My implementation bricked the PC, leaving it with a BIOS unable to boot or to enter setup. I never understood how it did it, but I now suspect that removing the battery for a while would have cured the disease.
Which is far better than this UEFI issue as Windows while misbehaving doesn't crash, and can actually be recovered (and if you don't know how, a simple reboot will fix it ).
The Linux folks actually read and understand the documentation and then use the mechanisms described. The Windows-folks are usually not so capable.
Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
And I thought that uefi was supposed to make this a better and more secure world.
Now this ...
And uefi can not boot iso9660 file systems. So no booting from a cd or dvd without jumping through hoops.
And uefi relies exclusively on the fat filesystem for its efi partition. That seems kinda backward to me.
Looks to me like we're losing functionality by using uefi.
https://en.wikipedia.org/wiki/Extensible_Firmware_Interface
The UEFI specification explicitly requires support for FAT32 for system partitions, and FAT12/FAT16 for removable media;
It's just a matter of time until this exploit is included in malware, so Samsung better start pumping out those firmware upgrades that guarantee enough space will be left to boot.
When the copyright term is "forever minus a day", live every day like it's the last.
I don't know which compiler this is for, but it is not defined whether "char" is signed or unsinged and gcc and MSVC have opposite defaults.
I bought a Samsung laptop at the start of January :( Not only that...I bought it specifically to install Ubuntu :( Bah.
Now what do I do?
Your suggestion is a good idea to avoid this code being copied to another platform and breaking there. Microsoft does specify what happens here though, and the program as written does the right thing. Both char and unsigned char casts get "Preserve low-order byte" when you start with a larger integer.
if that test was covered by warranty. That is an honest question; if i try to reproduce a bug which bricks a device, i do something which if partially intentionally. Its like dropping the device from a height which it should survive but does not.
Running out of (disk) space is generally the bigger problem, linux doesn't like to log you in if it cannot syslog the attempt to disk.
Rubbish. There is no way a syslog caller can know whether the log worked or not.
login might fail if it can't write the utmp/wtmp record, if it still does that.
Watch this Heartland Institute video
If you set overcommit aggressively enough or use a sufficiently old Linux kernel, you will be able to malloc() 3GB on any 32 bit system. Assuming you stay with the default 3/1GB memory split.
Any testing of overcommit done on 32 bit systems is a bit useless. 32 bit systems are pretty much embedded-only.
Finally! A year of moderation! Ready for 2019?
Really, so every Linux distro works with every piece of hardware right out of the box then?
I haven't thought of anything clever to put here, but then again most of you haven't either.