Bug 429191 - partitionmanager crashes when sshfs mounts are present in /etc/fstab
Summary: partitionmanager crashes when sshfs mounts are present in /etc/fstab
Status: RESOLVED FIXED
Alias: None
Product: partitionmanager
Classification: Applications
Component: general (show other bugs)
Version: 4.2.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Andrius Štikonas
URL:
Keywords:
: 430475 433744 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-11-16 13:09 UTC by Dennis Lichtenthäler
Modified: 2021-03-01 01:58 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 20.12.2
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Lichtenthäler 2020-11-16 13:09:04 UTC
I have several sshfs entries in my /etc/fstab. Unless I remove them or comment them out, partitionmanager crashes when trying to scan devices.

STEPS TO REPRODUCE
1. add sshfs entries to /etc/fstab  (the format I'm using is "sshfs#user@host:/directory /target fuse noauto,defaults,users 0 0")
2. launch partitionmanager

OBSERVED RESULT
Thread 12 "m_DeviceScanner" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffd10da640 (LWP 632119)]
0x00007ffff7eec470 in readFstabEntries(QString const&) () from /usr/lib64/libkpmcore.so.10
(gdb) bt
#0  0x00007ffff7eec470 in readFstabEntries(QString const&) () from /usr/lib64/libkpmcore.so.10
#1  0x00007ffff7eed21a in possibleMountPoints(QString const&, QString const&) () from /usr/lib64/libkpmcore.so.10
#2  0x00007ffff7ec5eac in FileSystem::detectMountPoint(FileSystem*, QString const&) () from /usr/lib64/libkpmcore.so.10



EXPECTED RESULT
Shouldn't crash...

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 5.19.5
(available in About System)
KDE Plasma Version: 5.19.5
KDE Frameworks Version: 5.74.0
Qt Version: 5.15.1
Comment 1 Andrius Štikonas 2020-11-16 13:51:04 UTC
Workaround:

user@host:/directory /target fuse.sshfs noauto,defaults,users 0 0
Comment 2 Andrius Štikonas 2020-11-16 13:52:14 UTC
I think parser is choking on # in sshfs# thiking that it is comment.
Comment 3 Andrius Štikonas 2020-11-16 13:53:45 UTC
By the way, your fstab syntax is deprecated according to man fstab. You should migrate to the one I specified in workaround anyway. That said partitionmanager should not crash on it in any case.
Comment 4 Dennis Lichtenthäler 2020-11-18 13:36:53 UTC
(In reply to Andrius Štikonas from comment #3)
> By the way, your fstab syntax is deprecated according to man fstab. You
> should migrate to the one I specified in workaround anyway. 
You're right, that works!

>   That said
> partitionmanager should not crash on it in any case.
I agree :o)
Comment 5 Andrius Štikonas 2020-12-16 19:06:04 UTC
*** Bug 430475 has been marked as a duplicate of this bug. ***
Comment 6 joseteluisete 2021-01-05 10:46:57 UTC
I have the same problem but in my case with mhddfs.
I open KDE Partition Manager and after introducing my password it crashes.

Here is my fstab ...

UUID=BE78-6D97                            /boot/efi      vfat    umask=0077 0 2
UUID=5e31802a-970e-4d5e-83d7-114511d2b96c swap           swap    defaults,noatime,discard 0 0
UUID=683125e2-1176-4786-a706-ca0a8836841d /              ext4    defaults,noatime 0 1
UUID=cd65db9f-63d6-4160-9994-e812f40077dc /adds          ext4    defaults,noatime 0 2
UUID=f2ef4ef4-1603-4e2c-9833-e6a74c7c4dcd /apps          ext4    defaults,noatime 0 2
UUID=bbb9996a-6e05-430e-9221-48881bd95ddf /htpc          ext4    defaults,noatime,discard 0 2
UUID=04170d4f-491e-42be-aec1-f86fe19b7b09 /hdd1          ext4    defaults,noatime 0 2
UUID=d61c8d60-2d43-4034-b61c-ed695c1361db /hdd2          ext4    defaults,noatime 0 2
UUID=da887262-1011-44ce-8a80-d096e0c4281f /hdd3          ext4    defaults,noatime 0 2
mhddfs#/hdd1,/hdd2,/hdd3                  /htpc/video    fuse    defaults,allow_other 0 0

The problem is the last line where I use mhddfs to create a virtual location (/htpc/video) where I can see all the files of 3 HDDs (/hdd1,/hdd2,/hdd3).
Comment 7 Andrius Štikonas 2021-01-07 01:26:34 UTC
Git commit 31706cffdc1df60b96010fbbdbbdc6ec192fd913 by Andrius Štikonas.
Committed on 07/01/2021 at 01:25.
Pushed by stikonas into branch 'master'.

Fix out of bounds read when parsing fstab.

M  +6    -0    src/core/fstab.cpp

https://invent.kde.org/system/kpmcore/commit/31706cffdc1df60b96010fbbdbbdc6ec192fd913
Comment 8 Andrius Štikonas 2021-01-07 01:39:18 UTC
Git commit dc38cb119608d0e48bc1492573aa732019e2b6a5 by Andrius Štikonas.
Committed on 07/01/2021 at 01:39.
Pushed by stikonas into branch 'release/20.12'.

Fix out of bounds read when parsing fstab.

M  +6    -0    src/core/fstab.cpp

https://invent.kde.org/system/kpmcore/commit/dc38cb119608d0e48bc1492573aa732019e2b6a5
Comment 9 joseteluisete 2021-01-20 17:15:01 UTC
Manjaro KDE has released today (2021.01.20) a lot of updates.
If I launch "partitionmanager -v" from Terminal, I have the following answer:
partitionmanager 20.12.1
but every time I launch the application I have the same error as before

Loaded backend plugin:  "pmsfdiskbackendplugin"
"Using backend plugin: pmsfdiskbackendplugin (1)"
"Scanning devices..."
"Device found: loop0"
smartctl initialization failed for  "/dev/loop0" :  No such file or directory
error during smart output parsing for  "/dev/loop0" :  No such file or directory
unknown file system type  ""  on  "/dev/loop0"
Segmentation fault (core dumped)

I don't have "sshfs" in my fstab, I have "mhddfs".

Is there anything I can do to help?
Do you need me to add any information from my system?
Comment 10 Andrius Štikonas 2021-01-20 17:24:08 UTC
Your version is too old. Please see here "Version Fixed in in" is 20.12.2
Comment 11 joseteluisete 2021-01-20 17:29:07 UTC
My mistake!
I thought I had the latest.
I'm sorry!
Comment 12 joseteluisete 2021-01-20 17:32:32 UTC
I just watched ...
https://apps.kde.org/en/partitionmanager

I should have read everything here and looked better before posting.
Sorry again!
:-)
Comment 13 Andrius Štikonas 2021-01-20 17:40:17 UTC
(In reply to joseteluisete from comment #12)
> I just watched ...
> https://apps.kde.org/en/partitionmanager
> 
> I should have read everything here and looked better before posting.
> Sorry again!
> :-)

You have the latest released. 20.12.2 is not yet released. Just wait a bit and you'll get a fix. Or you can compile from source if you really need fix earlier.
Comment 14 Andrius Štikonas 2021-02-28 12:46:41 UTC
*** Bug 433744 has been marked as a duplicate of this bug. ***
Comment 15 Rik 2021-02-28 13:21:58 UTC
I'm sorry perhaps I am a bit dim but I'm confused by the information presented here.

If I enter p=in a console window: 
 $ partitionmanager -v
I get the response...
 partitionmanager 4.2.0

Is this version supplied with FC33 KDE spin a prehistoric one?

B.t.w. I have no # characters, except the ones at the start of the comment lines in my fstab. I do not have sshfs entries, nor mhddfs.

I added the last line myself and have tested the result, before, with partitionmanager without problems. 

But now it does crash on me, My report was marked as duplicate of bug 429191 but I have difficulty to see the similarities and don't see how the 429191 resolution can be applied for my application. 

My fstab:

#
# /etc/fstab
# Created by anaconda on Fri Feb 19 16:44:13 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=0e0895f8-822c-4e21-a311-d33c46842e59 /                       btrfs   subvol=root00   0 0
UUID=52c60c51-fe54-4d90-b6d6-13e5eb7e429b /boot                   ext4    defaults        1 2
UUID=0e0895f8-822c-4e21-a311-d33c46842e59 /home                   btrfs   subvol=home00   0 0
UUID=eccfb380-faf0-4b3c-a700-6c299e5f1da6 /home/Gedeeld           btrfs
Comment 16 Rik 2021-02-28 14:18:32 UTC
FYI,

Just tested gparted and it happily accepts my fstab and shows me the information I would expect. So for now my only known workaround is to resort to Gnome tools.

I'd rather not use it though |-/

KDE was my first choice.
Comment 17 Andrius Štikonas 2021-02-28 18:44:02 UTC
(In reply to Rik from comment #15)
> I'm sorry perhaps I am a bit dim but I'm confused by the information
> presented here.
> 
> If I enter p=in a console window: 
>  $ partitionmanager -v
> I get the response...
>  partitionmanager 4.2.0
> 
> Is this version supplied with FC33 KDE spin a prehistoric one?
> 
> B.t.w. I have no # characters, except the ones at the start of the comment
> lines in my fstab. I do not have sshfs entries, nor mhddfs.
> 
> I added the last line myself and have tested the result, before, with
> partitionmanager without problems. 
> 
> But now it does crash on me, My report was marked as duplicate of bug 429191
> but I have difficulty to see the similarities and don't see how the 429191
> resolution can be applied for my application. 
> 
> My fstab:
> 
> #
> # /etc/fstab
> # Created by anaconda on Fri Feb 19 16:44:13 2021
> #
> # Accessible filesystems, by reference, are maintained under '/dev/disk/'.
> # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
> #
> # After editing this file, run 'systemctl daemon-reload' to update systemd
> # units generated from this file.
> #
> UUID=0e0895f8-822c-4e21-a311-d33c46842e59 /                       btrfs  
> subvol=root00   0 0
> UUID=52c60c51-fe54-4d90-b6d6-13e5eb7e429b /boot                   ext4   
> defaults        1 2
> UUID=0e0895f8-822c-4e21-a311-d33c46842e59 /home                   btrfs  
> subvol=home00   0 0
> UUID=eccfb380-faf0-4b3c-a700-6c299e5f1da6 /home/Gedeeld           btrfs

As a workaround add defaults for the last entry in 4th field. It's the same bug though (out of bounds array access), although triggered by slightly different cause.
Comment 18 Rik 2021-02-28 22:51:55 UTC
Andrius, Thank you for the hint but still I think some-thing's fishy here...

As I removed the partitionmanager software before via discover, I had to re-install it and did so via https://apps.kde.org/en/partitionmanager 'install on linux' button (as discover itself seemed not able to find it anymore?). This did not work directly after removal (some conflict) but I retried later on and then it did. 

After re-install everything worked just fine again, as before, without proposed changes to fstab???

As suggested I will study man fstab to see why defaults is needed but for now it seems to work for me (without fstab change). 

 $ partitionmanager -v
 partitionmanager 4.1.0

P.S. What about that version? You mentioned 20.12.1 is too old so what about my 4.1.0 version?

I guess this is not an issue of partitionmanager alone...
Comment 19 Rik 2021-02-28 23:02:47 UTC
Oooh, I see an update is pending. 4.2.0-1.fc33.

Should I dare to update it or will the update get me back into trouble?
Comment 20 Andrius Štikonas 2021-02-28 23:03:54 UTC
(In reply to Rik from comment #18)
> Andrius, Thank you for the hint but still I think some-thing's fishy here...
> 
> As I removed the partitionmanager software before via discover, I had to
> re-install it and did so via https://apps.kde.org/en/partitionmanager
> 'install on linux' button (as discover itself seemed not able to find it
> anymore?). This did not work directly after removal (some conflict) but I
> retried later on and then it did. 
> 
> After re-install everything worked just fine again, as before, without
> proposed changes to fstab???
> 
> As suggested I will study man fstab to see why defaults is needed but for
> now it seems to work for me (without fstab change). 
> 
>  $ partitionmanager -v
>  partitionmanager 4.1.0
> 
> P.S. What about that version? You mentioned 20.12.1 is too old so what about
> my 4.1.0 version?
> 
> I guess this is not an issue of partitionmanager alone...

4.1.0 is older and should not be used in any circumstances as it has security bug (root privilege escalation).

4.2.0 should be secure bit it is still older than 20.12.1.

At the moment 20.12.2 is the only fixed version. It is already released as part of KDE February Application Release Service.
Comment 21 Rik 2021-02-28 23:09:56 UTC
4.1.0 is what I get when via via https://apps.kde.org/en/partitionmanager 'install on linux' button and also via the FC33 KDE spin?

How do I get the 20.12.1 for my distro?
Comment 22 Andrius Štikonas 2021-02-28 23:13:01 UTC
(In reply to Rik from comment #21)
> 4.1.0 is what I get when via via https://apps.kde.org/en/partitionmanager
> 'install on linux' button and also via the FC33 KDE spin?
> 
> How do I get the 20.12.1 for my distro?

You need 20.12.2, not 20.12.1. And at the moment you can't. It's not packaged by Fedora packager yet. Even Rawhide only has 20.12.0 which does not include the fix.

You either wait, get some live cd from some other distro or compile from source.
Comment 23 Rik 2021-02-28 23:24:45 UTC
So,

You suggest I compile the latest version from source. I'm not used to do this as I normally just use what's delivered in the package. Assuming Fedora packs a sane set of software for me.

I will try to see if / how this works out but I need some more time to find out how-to.

Thank you for now.
Comment 24 Andrius Štikonas 2021-02-28 23:32:50 UTC
(In reply to Rik from comment #23)
> So,
> 
> You suggest I compile the latest version from source. I'm not used to do
> this as I normally just use what's delivered in the package. Assuming Fedora
> packs a sane set of software for me.
> 
> I will try to see if / how this works out but I need some more time to find
> out how-to.
> 
> Thank you for now.

If you are unused then just get some other livecd for now to do your partitioning. At some point Fedora will update (although that might newer Fedora release).
Comment 25 Rik 2021-02-28 23:40:41 UTC
Don't worry, I will manage anyway. 

Just saying, This is bit disappointing as Fedora profiles as 'cutting edge' but apparently delivers an outdated KDE spin.
Comment 26 Rik 2021-03-01 00:21:51 UTC
b.t.w.

the update to 4.2.0 ...  

 $ partitionmanager -v
 partitionmanager 4.2.0

... did bring back the crash at startup.

Your hint to add 'defaults' in the last line did the trick and stopped the crashing in this 4.2.0 update.


#
# /etc/fstab
# Created by anaconda on Fri Feb 19 16:44:13 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=0e0895f8-822c-4e21-a311-d33c46842e59 /                       btrfs   subvol=root00   0 0
UUID=52c60c51-fe54-4d90-b6d6-13e5eb7e429b /boot                   ext4    defaults        1 2
UUID=0e0895f8-822c-4e21-a311-d33c46842e59 /home                   btrfs   subvol=home00   0 0
UUID=eccfb380-faf0-4b3c-a700-6c299e5f1da6 /home/Gedeeld           btrfs   defaults
Comment 27 joseteluisete 2021-03-01 01:58:00 UTC
I'm sorry. I've looking for hours.
I don't know how to be removed from CC List.