Skip to content

testing/ostest: multiuser coverage for supplementary groups and setresuid - #3714

Open
Abhishekmishra2808 wants to merge 2 commits into
apache:masterfrom
Abhishekmishra2808:feature/supp-groups-and-sudo
Open

testing/ostest: multiuser coverage for supplementary groups and setresuid#3714
Abhishekmishra2808 wants to merge 2 commits into
apache:masterfrom
Abhishekmishra2808:feature/supp-groups-and-sudo

Conversation

@Abhishekmishra2808

@Abhishekmishra2808 Abhishekmishra2808 commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Expand testing/ostest/multiuser.c for the POSIX credential APIs added in the kernel PR
  • Add tests for supplementary groups, setresuid/setresgid ordering, getresuid/setreuid, and saved set-UID/GID child semantics
  • Added nsh# for root and nsh$ for user (when login enabled); otherwise, nsh>
  • Depends on the companion nuttx PR sched: supplementary groups and setresuid/setresgid nuttx#19767

Impact

This change only extends testing/ostest/multiuser.c to exercise the new kernel credential APIs. It adds coverage for supplementary groups, setresuid/setresgid drop ordering, getresuid/setreuid, and saved set-UID/GID behavior in a child task. Builds without CONFIG_SCHED_USER_IDENTITY are unchanged.

Testing

nsh# useradd testuser UserPass1!
nsh# cat /tmp/passwd
root:$pbkdf2-sha256$10000$uwK3GNfobksYkqa5H9-Rcw$kNsxMZi26PeLxdWKgFjNvZpOoouP_DcHyO2mwyACVc0:0:0:/
testuser:$pbkdf2-sha256$10000$LCsDACzp0RA26xvaHPsY2g$gfCJXfLINNOKNIpVqepoUaYJiMbB8ojezAlosZJnrXY:1000:1000:/
nsh# su testuser
nsh$ id
uid=1000(testuser) suid=0(root) gid=1000 sgid=0(root) groups=1000
nsh$ su root
password: 
nsh# id
uid=0(root) gid=0(root) groups=0(root)
nsh# 

@xiaoxiang781216

Copy link
Copy Markdown
Contributor

@Abhishekmishra2808 please fix ci warning and pr title/description

Add supplementary-group, setresuid/setresgid ordering, and saved
set-UID/GID child tests for the POSIX credential APIs.

Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
@Abhishekmishra2808
Abhishekmishra2808 force-pushed the feature/supp-groups-and-sudo branch from 6c7b378 to 4cf5292 Compare August 12, 2026 07:05
@Abhishekmishra2808 Abhishekmishra2808 changed the title nshlib: hard/soft credential drop and sudo via PR_NSHCRED_AUTHSETEID testing/ostest: multiuser coverage for supplementary groups and setresuid Aug 12, 2026
Comment thread nshlib/nsh_session.c Outdated

# if defined(CONFIG_NSH_READLINE) && \
(defined(CONFIG_READLINE_TABCOMPLETION) || defined(CONFIG_READLINE_EDIT))
readline_prompt(nsh_prompt());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

how about readline isn't enabled

@Abhishekmishra2808 Abhishekmishra2808 Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

updated the code, please take a look

@Abhishekmishra2808
Abhishekmishra2808 force-pushed the feature/supp-groups-and-sudo branch from 5c04648 to fbe1485 Compare August 12, 2026 17:38
When NSH_PROMPT_STRING_ROOT/USER are empty, keep NSH_PROMPT_STRING at
boot (for example, "nsh> ") so CI/NTFC boot detection still works.
After login, su, or telnet login, replace the last '>' with '#' (euid 0)
or '$' (non-zero euid) and ensure a trailing space.  Refresh readline
after console/telnet login when line editing is enabled.

Signed-off-by: Abhishek Mishra <mishra.abhishek2808@gmail.com>
@Abhishekmishra2808
Abhishekmishra2808 force-pushed the feature/supp-groups-and-sudo branch from fbe1485 to b07c609 Compare August 12, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants