Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bindmounting fail in supervisor #47

Open
reppers opened this issue Aug 8, 2019 · 0 comments
Open

Bindmounting fail in supervisor #47

reppers opened this issue Aug 8, 2019 · 0 comments
Labels

Comments

@reppers
Copy link

reppers commented Aug 8, 2019

When an application is started by by the supervisor a check is made to see if all file bindings are valid by calling DoesLinkExist in "framework/daemons/linux/supervisor/app.c". This function may fail during certain conditions. This happened to me with a shared object file which caused a crash on the main application. This fault only appears after the first reboot which is very bad since the system probably will be considered valid and out of probation at this time.

Scenario:

  1. Application in installed and started
  2. DoesLinkExist returns false
  3. An empty file is created in the sandbox
  4. A file is bindmounted on/over the empty file.
  5. The application starts successfully.
  6. Systems goes out of probation.
  7. System reboot
  8. DoesLinkExist returns true (BUG) and the file listed in the application .adef is never bindmounted into the sandbox.
  9. The application fails since it sees the empty file.

The DoesLinkExist function checks the inodes for equality, but inodes are only unique within its own filesystem. The condtion thats triggers the bug is that the empty file created in step 3 just happed to get the same inode number(flash partition) as the file that is supposed to be bindmounted into the sandbox (e.g rootfs partition) which causes the bindmount to be ignored.

The suggested solution is to also check the device for equality.
(legato 18.10.3)
+++ b/framework/daemons/linux/supervisor/app.c
@@ -1810,10 +1810,20 @@ static bool DoesLinkExist
}
else
{

  •        if (srcStat.st_ino == destStat.st_ino)
    
  •        if ((srcStat.st_dev == destStat.st_dev) && (srcStat.st_ino == destStat.st_ino))
          {
    
@CoRfr CoRfr added the bug label Aug 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants