DOSFS not cheking for disc sizes it can't handle?
Pages: 1 2
André Timmermans (100) 655 posts |
A few months ago I had an issue in my boot sequence which I did not notice directly and which prevented the loading of FAT32FS during boot. Clicking on the 320GB USB disc showed the root directory correctly but accessing files or opening directories caused errors. It took me a while to figure that FAT32FS was not loaded and that it was DOSFS which was handling the disc. Wouldn’t it be wise to had checks to DOSFS so that it rejects drive sizes it cannot handle? |
Rick Murray (539) 13850 posts |
I asked about this half a decade ago, when DOSFS couldn’t handle >2GB and trashed the filesystem of a larger device in attempting to deal with it – https://www.riscosopen.org/forum/forums/2/topics/1056 320GB? That’s brave. I’m too cynical to give DOSFS a live filesystem of any size with important data on it. I usually use FAT32FS, but it’s a USB stick of ~4GB size with no “live” (as in not copied elsewhere) data… |
Oliver Tobias (3753) 16 posts |
Relicense RISC OS under an MIT style license – problem solved? |
Rick Murray (539) 13850 posts |
Yes. Because relicensing an entire OS made of many parts from many sources when you’re not the rights holder… That’s easily done. ;-) Had a quick look at FAT32FS. The library part is LGPL, so it might be possible to come to some sort of arrangement with Jeff if we’re going to lay DOSFS to rest… That said, FAT32FS is loadable and usable. It would just be really good if DOSFS could be modified to reject media it clearly can’t cope with. No if but maybe, just a simple “can’t”. |
Jeffrey Lee (213) 6048 posts |
Relicense RISC OS under an MIT style license I would have thought the bigger problem with that statement was the implication that relicensing the OS will make the heavens open and deliver us a flood of motivated developers. |
Rick Murray (539) 13850 posts |
Isn’t that what crowdsourcing is? Wishful thinking and the expectation of something from nothing? |
Rick Murray (539) 13850 posts |
In reality I think any “interested” developer is going to bail the moment they got their first STMFD and have the horrible realisation that it isn’t created by bolting together bits of frameworks of the current trendy language… What do you mean it’s not written in Scalar V% on Tarmac? Anybody who doesn’t use Scalar V% on Tarmac needs to change their entire world view about what software development really is!!! |
Oliver Tobias (3753) 16 posts |
That’s the only sane solution, isn’t it? (“Tried RISC OS on the Pi and it TRASHED MY USB DRIVE !!! !!! This would never had happened, if it were open source!! SAD!”) |
Jeffrey Lee (213) 6048 posts |
https://www.riscosopen.org/viewer/view/castle/RiscOS/Sources/FileSys/ImageFS/DOSFS/ Patches welcome. |
David Feugey (2125) 2709 posts |
Why? Open Source is not a proof of quality. I can prove it: the DOSFS module IS open source software. But not Free software, as OEM must pay for its use. |
Rick Murray (539) 13850 posts |
Quick hack time… :-)
Add this just after to reject anything over 4GB:
It will report “Error when reading SCSI::0.$ – Disc not understood – has it been formatted?” because DOSFS will no longer ‘claim’ the device as something it recognises. I rather suspect the trouble comes a few lines further down when:
“discsize()” is a defined macro that writes “((drec)→dr_discsize)” where “dr_sizesize” is defined as a word (which is itself defined as an unsigned int). Thus, anything over 4,294,967,295 (i.e. 4GB) simply can’t be correctly dealt with. A better “solution” might be to try assigning the disc size calculation to a long long and seeing if the result overflows UINT_MAX? At any rate – this “quick hack” will sanitise DOSFS from touching what it can’t handle. There might be another bug here, too. It’s an 8GB device being read, so not sure if it’s the directory is beyond the 4GB range, or what. It seems to me mighty suspicious. Here’s directory entries being read, like this: DOSFS 20:39:27: read_dir: lfnp = 201eb22c act:00000000 holds:NULLptr However look what happens here: DOSFS 20:39:27: read_dir: loop = 251 read_dir() scans through 384 entries, and not one single one with a loop value over 255/256 reads correctly. They’re just utter gibberish. |
Rick Murray (539) 13850 posts |
I can prove it better. OpenSSL Okay, fair enough, that’s just one OSS project, and crypto is hard. Oh, wait, what about bash? Or dealing with fancy MMS messages in Android (the OSS part)? And we need to talk about “Dirty Cow” (Linux and derivatives) just because it’s logo is pretty awesome: https://en.wikipedia.org/wiki/Dirty_COW This isn’t to say that non-OSS software is bug free. Far from it. As Meltdown and Spectre have shown, even the hardware has issues that can be used to gain access to data that isn’t supposed to be accessible. The difference is that it’s far easier to pretend that there’s nothing wrong with closed source software (FAKE NEWS!!!) and fail to provide fixes – Adobe is quite famous for this, which is why their name will be forever associated with one of the least secure internet technologies ever devised. And their idea of adding random scripting to PDFs is pretty awful given their woeful history with Flash and its gaping chasms (not security “holes”, Flash is a gaping chasm complete with waterfall). Furthermore, OSS can quite easily trash things just as much as anything else. Wanna talk to me about how utterly miserably awful Brasero is and how it ignores a specific user request to write DVDs slowly, spins them at max speed, tries to write that, fails, and down near trashes the disc or the drive or both in the process? Test repeated twice until I gave up, dropped the files on an SD card, and wrote them to DVD (peacefully) using Nero with Windows. ALL software can suffer from quirks, bugs, and problems. Anything else is just a delusion. |
Rick Murray (539) 13850 posts |
I should point out that while there appear to be this many entries in the directory structure, there are only 75 files actually present… |
Oliver Tobias (3753) 16 posts |
Just because it’s not closed source doesn’t mean it’s open source. “OEM must pay for its use” disqualifies it as open source software: 6. No Discrimination Against Fields of Endeavor Yesterday was the 20th anniversary of the introduction of the term “open source software” |
Steve Pampling (1551) 8172 posts |
I think you’re confusing “open source” with “free to all”, which is not surprising I suppose given the the person credited with coining the term actually seems confused:
So you see, even she seems to thing that “open source” and free software are equivalent which, given the existence of free to use software that originates from closed source, is rather strange. Do note that anyone can use the source free of charge provided they don’t try to sell anything derived from it because that specific point (sale of the derived item) is where the cost kicks in. |
Oliver Tobias (3753) 16 posts |
On the issue of quality and open source software I agree, there is no general correlation. Other factors could be much more relevant, e.g. the people writing the code, funding, etc. (Maybe I should have added a irony smiley to my stupid comment with the exclamation marks) |
Oliver Tobias (3753) 16 posts |
Did you even read that stuff? Let’s go back to the original announcement I already used software in the 80s and 90s and free to use software was called freeware. Free software aka libre software is this Stallmann / FSF / GPL thing. |
Steve Pampling (1551) 8172 posts |
Erm, how do you think I came by the bit I quoted?1 It’s toward the end of the article in which she covered the subterfuge of using a techie to deliver the phrase because perhaps the suggestion of a non-techie might fall flat but if a techie delivered it then it might fare better. I read her references to Stallman as carrying elements of what many others think of him – rarely positive.
Part of the fog and confusion Stallman generates, free software is simply free. Freeware is a term concatenating free and software because it’s “hip”/trendy/whatever. He would like people to believe that free software must have available source code and that simply isn’t so, it might be nice but then if a vendor releases a slightly limited version of their software as a reader for the files produced by the full fat version and accompanies it with the source what’s to stop the user modifying the free version into a full fat version and putting the amendment on the net thus putting say Adobe out of business? BTW. You might notice the hyphens in her article: free-to-use 1 It’s a habit, I read stuff |
Rick Murray (539) 13850 posts |
But blatant discrimination of “open source” (as a true concept) is perfectly acceptable when it is presented as a positive ideology and one that must not be questioned? Yes, I’m referring to the GPL and the fact that it exists and is compatible with only itself, which is not my definition of “open source”. The moment you start adding restrictions (OEMs must pay, GPL only compatible with GPL, etc) it ceases to be “open source” and becomes “source available”. For all the talk about “freedoms”, GPL is just that. Talk. Hot air. Religious pontification. |
David Feugey (2125) 2709 posts |
Just because it’s not OSI compliant doesn’t mean it’s not open source. Anyway, here source is visible and there are bugs. |
Jeffrey Lee (213) 6048 posts |
FYI I’m partway towards a fix for this – there are a few different places that need tweaking for out-of-range offsets to be caught correctly. |
Steffen Huber (91) 1953 posts |
Fat32Fs uses the efsl for its FAT work (and, if I understand Jeff Doggett correctly, it had to be extended to work with long filenames), which is GPL. Has anyone investigated alternatives to efsl, like e.g. FatFs http://elm-chan.org/fsw/ff/00index_e.html which seems to also support exFAT and has a very libre BSD licence? So we could throw away DOSFS and live happily ever after? |
Jeffrey Lee (213) 6048 posts |
I think this should be handled properly now (or better than it was before, at least). Let me know if anything’s broken which shouldn’t be! https://www.riscosopen.org/viewer/revisions/logs?ident=1518998757-800500.html |
Dominic Plunkett (2556) 34 posts |
In c/DOSdirs now that the malloc has been removed , can the checking for NULL pointer also be removed ? |
Jeffrey Lee (213) 6048 posts |
Yes – well spotted! |
Pages: 1 2