Skip to content

meta-nilrt: udev-extraconf: update worldwritable permissions#965

Merged
rajendra-desai-ni merged 1 commit intoni:nilrt/master/nextfrom
Nasrulla-NI:worldwritable
Apr 15, 2026
Merged

meta-nilrt: udev-extraconf: update worldwritable permissions#965
rajendra-desai-ni merged 1 commit intoni:nilrt/master/nextfrom
Nasrulla-NI:worldwritable

Conversation

@Nasrulla-NI
Copy link
Copy Markdown

@Nasrulla-NI Nasrulla-NI commented Mar 9, 2026

Summary of Changes

Currently NILRT will automatically mount block and TTY devices as world-writable and should be updated to no longer do this.
We should try to avoid just changing the permissions and should instead have some way to toggle the world-writable permissions back on if needed. Hence to do this - /etc/natinst/share/ni-rt.ini - worldwritable.enabled="true" or worldwritable.enabled="false" is appended as per information provided from hardware config team/

  • Controls whether VFAT/TTY mounts are world-writable.
  • 0 = default restrictive (fmask=0002,dmask=0002)
  • 1 = world-writable (fmask=0000,dmask=0000)
  • Reads /** /etc/natinst/share/ni-rt.ini - worldwritable.enabled="true" or worldwritable.enabled="false" **

Justification

Please refer below feature
https://dev.azure.com/ni/DevCentral/_workitems/edit/3470239

Testing

Safemode:
VFAT and TTY:
- worldwritable.enabled="false"
worldwritable enabled_false

worldwritable.enabled="true"
worldwritable enabled_true

Runmode:
VFAT and TTY:
- worldwritable.enabled="false"
worldwritable_runmode_false

worldwritable.enabled="true"
worldwritable_runmode_true

  • I have built the core package feed with this PR in place. (bitbake packagefeed-ni-core)

Procedure

@Nasrulla-NI Nasrulla-NI force-pushed the worldwritable branch 3 times, most recently from cb7e86b to 502b0af Compare March 9, 2026 11:43
Copy link
Copy Markdown
Contributor

@amstewart amstewart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should try to avoid just changing the permissions and should instead have some way to toggle the world-writable permissions back on if needed.

Why? Because of VISA? VISA has to run as a user that isn't root or a member of the dialout group?

@Nasrulla-NI
Copy link
Copy Markdown
Author

We should try to avoid just changing the permissions and should instead have some way to toggle the world-writable permissions back on if needed.

Why? Because of VISA? VISA has to run as a user that isn't root or a member of the dialout group?

Thanks for the comment. Indeed, the change was aimed at supporting VISA, since it often runs as a non‑root user without dialout membership and needs access to these device nodes. So, added a config/feature flag so the relaxed permissions are enabled only when needed. This will be controlled from front end Hwconfig.

@Nasrulla-NI Nasrulla-NI marked this pull request as ready for review April 8, 2026 06:28
Copy link
Copy Markdown
Contributor

@rajendra-desai-ni rajendra-desai-ni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit message changes:

  • Change commit title to be more specific, something like:
    udev-extraconf: update worldwritable permissions
  • Update commit message to have more info about the changes
  • Signed-off tag should be at the end

Comment thread recipes-core/udev/udev-extraconf/scripts/ni-worldwritable.sh Outdated
Comment thread recipes-core/udev/udev-extraconf/scripts/ni-worldwritable.sh Outdated
Comment thread recipes-core/udev/udev-extraconf/scripts/ni-worldwritable.sh Outdated
Comment thread recipes-core/udev/udev-extraconf/scripts/mount.sh Outdated
Comment thread recipes-core/udev/udev-extraconf/scripts/mount.sh Outdated
@rajendra-desai-ni rajendra-desai-ni requested a review from a team April 8, 2026 14:29
@Nasrulla-NI Nasrulla-NI changed the title meta-nilrt: worldwritable permissions meta-nilrt: udev-extraconf: update worldwritable permissions Apr 10, 2026
@chaitu236 chaitu236 requested a review from Copilot April 14, 2026 16:12
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a runtime-configurable toggle (worldwritable.enabled from /etc/natinst/share/ni-rt.ini via nirtcfg) to control whether VFAT mounts and USB serial TTY devices are world-writable, defaulting to a more restrictive mode.

Changes:

  • Add a udev IMPORT helper script that exposes a NI_WORLDWRITABLE environment variable derived from worldwritable.enabled.
  • Update VFAT automount options to be restrictive by default (fmask=0002,dmask=0002) with an opt-in to world-writable.
  • Update USB serial udev rules to set MODE based on NI_WORLDWRITABLE.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
recipes-core/udev/udev-extraconf/scripts/ni-worldwritable.sh New udev IMPORT helper that maps worldwritable.enabled to NI_WORLDWRITABLE=0/1.
recipes-core/udev/udev-extraconf/scripts/mount.sh Makes VFAT mount permissions configurable at runtime instead of always world-writable.
recipes-core/udev/udev-extraconf/rules.d/usb-serial-permissions.rules Makes ttyUSB*/ttyACM* device mode configurable at runtime via udev IMPORT.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread recipes-core/udev/udev-extraconf/rules.d/usb-serial-permissions.rules Outdated
Comment thread recipes-core/udev/udev-extraconf/scripts/mount.sh Outdated
Comment thread recipes-core/udev/udev-extraconf/scripts/mount.sh
Comment thread recipes-core/udev/udev-extraconf/scripts/ni-worldwritable.sh
Comment thread recipes-core/udev/udev-extraconf/scripts/ni-worldwritable.sh Outdated
Comment thread recipes-core/udev/udev-extraconf/scripts/ni-worldwritable.sh Outdated
Comment thread recipes-core/udev/udev-extraconf/rules.d/usb-serial-permissions.rules Outdated
Copy link
Copy Markdown
Contributor

@chaitu236 chaitu236 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than copilot suggestions, looks good. I don't have any other feedback.

@Nasrulla-NI Nasrulla-NI force-pushed the worldwritable branch 2 times, most recently from b73b75f to 4804b9f Compare April 15, 2026 11:45
Comment thread recipes-core/udev/udev-extraconf/rules.d/usb-serial-permissions.rules Outdated
Comment thread recipes-core/udev/udev-extraconf/rules.d/usb-serial-permissions.rules Outdated
This features is to toggle the world-writable permissions for block and Serial devices to prevent unauthorised access.
This is done using by adding attribute in target_common.ini whcih should add a variable in
- /etc/natinst/share/ni-rt.ini - worldwritable.enabled="true" or worldwritable.enabled="false"

   Controls whether VFAT/TTY mounts are world-writable.
   False = default restrictive (fmask=0002,dmask=0002)
   True = world-writable (fmask=0000,dmask=0000)

Signed-off-by: Nasrulla Shariff <nasrulla.shariff@emerson.com>
@rajendra-desai-ni rajendra-desai-ni merged commit 0c8d26f into ni:nilrt/master/next Apr 15, 2026
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.

5 participants