Skip to content

SDLe fix: refactor, remove drop_privileges() and capability management from main.c - #9

Merged
dmkarthi merged 16 commits into
mainfrom
remove-privileged-access
May 14, 2026
Merged

SDLe fix: refactor, remove drop_privileges() and capability management from main.c#9
dmkarthi merged 16 commits into
mainfrom
remove-privileged-access

Conversation

@dmkarthi

@dmkarthi dmkarthi commented May 11, 2026

Copy link
Copy Markdown
Collaborator

dvledtx delegates all VFIO and hugepage operations to mtl_init() inside the MTL library. Whether those operations require elevated privileges is purely a system configuration concern, not an application concern.

With the recommended pre-configuration on the host:

  • udev rule granting the service user ownership of /dev/vfio/
  • LimitMEMLOCK=infinity in the systemd unit (or /etc/security/limits.conf)

mtl_init() succeeds without any elevated capabilities. The application should run as a plain unprivileged service user with no capability management needed.

Removes:

  • drop_privileges() function and its E-1 comment block
  • #include <linux/capability.h>
  • #include <sys/prctl.h>
  • #include <sys/syscall.h>
  • #include <sys/mman.h> (unused after removal)

Description

Checklist

Code Quality

  • Code follows project style guidelines
  • No unnecessary debug logs or commented-out code
  • No hardcoded values / secrets

Testing

  • Unit test added/modified accordingly
  • Perform manual basic sanity testing at system level

Review Readiness

  • PR title and description are clear and meaningful
  • Story/Task IDs are linked

Documentation

  • README or relevant docs updated (if applicable)

Security

  • No sensitive data exposed (keys, passwords, tokens)
  • Input validation added where needed

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes
  • Testing
  • Other... Please describe:

dmkarthi added 2 commits May 8, 2026 18:54
dvledtx delegates all VFIO and hugepage operations to mtl_init()
inside the MTL library. Whether those operations require elevated
privileges is purely a system configuration concern, not an
application concern.

With the recommended pre-configuration on the host:
  - udev rule granting the service user ownership of /dev/vfio/<group>
  - LimitMEMLOCK=infinity in the systemd unit (or /etc/security/limits.conf)

mtl_init() succeeds without any elevated capabilities. The application
should run as a plain unprivileged service user with no capability
management needed.

Removes:
  - drop_privileges() function and its E-1 comment block
  - #include <linux/capability.h>
  - #include <sys/prctl.h>
  - #include <sys/syscall.h>
  - #include <sys/mman.h> (unused after removal)
dvledtx delegates all VFIO and hugepage operations to mtl_init()
inside the MTL library. Whether those operations require elevated
privileges is purely a system configuration concern, not an
application concern.

With the recommended pre-configuration on the host:
  - udev rule granting the service user ownership of /dev/vfio/<group>
  - LimitMEMLOCK=infinity in the systemd unit (or /etc/security/limits.conf)

mtl_init() succeeds without any elevated capabilities. The application
should run as a plain unprivileged service user with no capability
management needed.

Removes:
  - drop_privileges() function and its E-1 comment block
  - #include <linux/capability.h>
  - #include <sys/prctl.h>
  - #include <sys/syscall.h>
  - #include <sys/mman.h> (unused after removal)
@dmkarthi
dmkarthi force-pushed the remove-privileged-access branch from 5173804 to cc9d191 Compare May 11, 2026 14:13
@dmkarthi dmkarthi changed the title refactor: remove drop_privileges() and capability management from main.c SDLe fix: refactor, remove drop_privileges() and capability management from main.c May 12, 2026
roshan-ku and others added 14 commits May 12, 2026 11:17
- Remove /tmp/ from ALLOWED_LOG_PREFIXES in main.c (world-writable,
  symlink attack risk)
- Add test_validate_log_path_rejects_tmp: verify /tmp paths are rejected
- Add test_validate_log_path_allows_var_log: verify /var/log/ is allowed
- Add test_validate_log_path_allows_cwd_relative: verify cwd-relative OK
- Add test_not_running_as_sudo: verify tests are not run as root
- Add lstat() check in main.c to reject config files that are symlinks
- Add test_main_rejects_symlinked_config unit test to verify rejection
@dmkarthi
dmkarthi merged commit 0985d6f into main May 14, 2026
1 check passed
@dmkarthi
dmkarthi deleted the remove-privileged-access branch May 14, 2026 08:35
sunilnom pushed a commit to sunilnom/directview-led-software-toolkit that referenced this pull request Jul 21, 2026
* adding PR template to structure the github repo

* template update

Signed-off-by: ayeshaa <ayesha.a@intel.com>

---------

Signed-off-by: ayeshaa <ayesha.a@intel.com>
sunilnom pushed a commit to sunilnom/directview-led-software-toolkit that referenced this pull request Jul 21, 2026
…t from main.c (OpenVisualCloud#9)

* refactor: remove drop_privileges() and capability management from main.c

dvledtx delegates all VFIO and hugepage operations to mtl_init()
inside the MTL library. Whether those operations require elevated
privileges is purely a system configuration concern, not an
application concern.

With the recommended pre-configuration on the host:
  - udev rule granting the service user ownership of /dev/vfio/<group>
  - LimitMEMLOCK=infinity in the systemd unit (or /etc/security/limits.conf)

mtl_init() succeeds without any elevated capabilities. The application
should run as a plain unprivileged service user with no capability
management needed.

Removes:
  - drop_privileges() function and its E-1 comment block
  - #include <linux/capability.h>
  - #include <sys/prctl.h>
  - #include <sys/syscall.h>
  - #include <sys/mman.h> (unused after removal)

* refactor: remove drop_privileges() and capability management from main.c

dvledtx delegates all VFIO and hugepage operations to mtl_init()
inside the MTL library. Whether those operations require elevated
privileges is purely a system configuration concern, not an
application concern.

With the recommended pre-configuration on the host:
  - udev rule granting the service user ownership of /dev/vfio/<group>
  - LimitMEMLOCK=infinity in the systemd unit (or /etc/security/limits.conf)

mtl_init() succeeds without any elevated capabilities. The application
should run as a plain unprivileged service user with no capability
management needed.

Removes:
  - drop_privileges() function and its E-1 comment block
  - #include <linux/capability.h>
  - #include <sys/prctl.h>
  - #include <sys/syscall.h>
  - #include <sys/mman.h> (unused after removal)

* ci: simplify FFmpeg skip check to pkg-config only, remove binary check

* ci: verify FFmpeg MTL plugin via nm on libavdevice to avoid SIGILL from running binary

* ci: remove binary execution from smoke test and FFmpeg verify - use file/ldd/nm instead

* ci: remove smoke tests completely

* ci: restore smoke tests and ffmpeg execution - compile with -march=x86-64 for runner portability

* SDLe: remove /tmp/ from allowed log paths and add validation tests

- Remove /tmp/ from ALLOWED_LOG_PREFIXES in main.c (world-writable,
  symlink attack risk)
- Add test_validate_log_path_rejects_tmp: verify /tmp paths are rejected
- Add test_validate_log_path_allows_var_log: verify /var/log/ is allowed
- Add test_validate_log_path_allows_cwd_relative: verify cwd-relative OK
- Add test_not_running_as_sudo: verify tests are not run as root

* ci: explicit FFmpeg binary/.so copy on restore with full verify output

* SDLe: reject symlinked config files to prevent symlink attacks

- Add lstat() check in main.c to reject config files that are symlinks
- Add test_main_rejects_symlinked_config unit test to verify rejection

* SDLe: add watchdog unit tests, logger enhancements

* SDLe: cap max resolution to 1920x1080

* docs: add troubleshooting kill command and Security.md

---------

Co-authored-by: Roshan Kumar <roshan.kumar@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants