int vfs_check_permission(fs_node_t* node, int want) {
if (!current_process) return 0; /* kernel context — allow all */
if (current_process->euid == 0) return 0; /* root — allow all */
- if (node->mode == 0) return 0; /* mode not set — permissive */
uint32_t mode = node->mode;
uint32_t perm;
if (!node) node = vfs_lookup(path);
if (!node) { ret = -ENOENT; goto out; }
+ /* Check execute permission on the file */
+ int exec_perm_rc = vfs_check_permission(node, 1); /* 1 = execute */
+ if (exec_perm_rc < 0) { ret = exec_perm_rc; goto out; }
+
uintptr_t entry = 0;
uintptr_t user_sp = 0;
uintptr_t new_as = 0;