royzah commented on code in PR #20425:
URL: https://github.com/apache/nuttx/pull/20425#discussion_r4161639348
##########
sched/task/task_prctl.c:
##########
@@ -187,6 +187,15 @@ int prctl(int option, ...)
goto errout;
#endif
+ case PR_CAPS_DROP:
+ this_task()->group->tg_caps &= ~va_arg(ap, int);
+ va_end(ap);
+ return OK;
Review Comment:
Done
##########
sched/task/task_prctl.c:
##########
Review Comment:
Done, the tail is just va_end and return OK now
##########
drivers/bch/bchdev_register.c:
##########
@@ -69,7 +69,7 @@ int bchdev_register(FAR const char *blkdev, FAR const char
*chardev,
/* Then setup the character device */
- ret = register_driver(chardev, &g_bch_fops, 0600, handle);
+ ret = register_rawdriver(chardev, &g_bch_fops, 0600, handle);
Review Comment:
Good call, dropped FSNODEFLAG_RAWIO and register_rawdriver(). Block and MTD
are checked by inode type in file_vopen(). A BCH node is a plain char driver,
so its type can't tell it apart, so bch_open() checks for itself
##########
fs/vfs/fs_open.c:
##########
@@ -72,7 +72,8 @@
****************************************************************************/
static int file_vopen(FAR struct file *filep, FAR const char *path,
- int oflags, mode_t umask, va_list ap)
+ int oflags, mode_t umask, bool fdopen,
Review Comment:
Dropped, file_vopen() checks every open now. Kernel threads hold all caps so
they're unaffected
##########
binfmt/binfmt_exec.c:
##########
@@ -270,6 +271,12 @@ int exec(FAR const char *filename, FAR char * const *argv,
{
int ret;
+ if (!nxsched_capable(PR_CAP_SPAWN))
Review Comment:
Moved, covers exec() and posix_spawn()
##########
fs/mount/fs_mount.c:
##########
@@ -592,6 +593,12 @@ int mount(FAR const char *source, FAR const char *target,
{
int ret;
+ if (!nxsched_capable(PR_CAP_RAWIO))
Review Comment:
Done
##########
fs/mount/fs_umount2.c:
##########
@@ -239,6 +240,12 @@ int umount2(FAR const char *target, unsigned int flags)
{
int ret;
+ if (!nxsched_capable(PR_CAP_RAWIO))
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]