History

exec: Teach prepare_exec_creds how exec treats uids & gids

It is almost possible to use the result of prepare_exec_creds with no modifications during exec. Update prepare_exec_creds to initialize the suid and the fsuid to the euid, and the sgid and the fsgid to the egid. This is all that is needed to handle the common case of exec when nothing special like a setuid exec is happening. That this preserves the existing behavior of exec can be verified by examing bprm_fill_uid and cap_bprm_set_creds. This change makes it clear that the later parts of exec that update bprm->cred are just need to handle special cases such as setuid exec and change of domains.

Eric W. Biederman committed 6 years ago

Commit 87b047d1 parent b127c161 file · +3 −0Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/cred.c+3−0
@@ -315,6 +315,9 @@ struct cred *prepare_exec_creds(void) · 314 unmodified lines
315315 new->process_keyring = NULL;
316316 #endif
317317
318+ new->suid = new->fsuid = new->euid;
319+ new->sgid = new->fsgid = new->egid;
320+
318321 return new;
319322 }
320323

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t