selinux: bring the comment about multithreaded process handling back
PATCH 1/1 selinux: bring the comment about multithreaded process handling back
Since commit d9250dea3f89 ("SELinux: add boundary support and thread context assignment"), SELinux has been supporting assigning per-thread security context under a constraint and the comment was updated accordingly. However, seems like commit d84f4f992cbd ("CRED: Inaugurate COW credentials") accidentally brought the old comment back that doesn't match what the code does.
This just brings the updated comment back and does nothing else.
--- security/selinux/hooks.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
security/selinux/hooks.c +6 -1
@@ -6459,7 +6459,12 @@ static int selinux_setprocattr(const char *name, void *value, size_t size)if (sid ==0 ) goto abort_change; -/* Only allow single threaded processes to change context */ +/* +* SELinux allows to change context in the following case only. +* - Single threaded processes. +* - Multi threaded processes intend to change its context into +* more restricted domain (defined by TYPEBOUNDS statement). +*/ if (!current_is_single_threaded ()) { error =security_bounded_transition (tsec->sid, sid);if (error)
Signature · 1 line
2.40.1
Paul Moore
maintainerQuoted 21 lines · Munehisa Kamata
Since commit
d9250dea3f89("SELinux: add boundary support and thread context assignment"), SELinux has been supporting assigning per-thread security context under a constraint and the comment was updated accordingly. However, seems like commitd84f4f992cbd("CRED: Inaugurate COW credentials") accidentally brought the old comment back that doesn't match what the code does.This just brings the updated comment back and does nothing else.
Fixes d84f4f992cbd ("CRED: Inaugurate COW credentials")Signed-off-by Munehisa Kamata <[email protected]>--- security/selinux/hooks.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)security/selinux/hooks.c +0
-0
security/selinux/hooks.c static int selinux_setprocattr(const char *name, void *value, size_t size) · line 6467
Quoted 10 lines
security/selinux/hooks.c +6
-1@@ -6459,7 +6459,12 @@ static int selinux_setprocattr(const char *name, void *value, size_t size)if (sid ==0 ) goto abort_change; -/* Only allow single threaded processes to change context */ +/* +* SELinux allows to change context in the following case only. +* - Single threaded processes. +* - Multi threaded processes intend to change its context into +* more restricted domain (defined by TYPEBOUNDS statement). +*/
Hi Munehisa, good catch :)
Considering the ease of understanding the code below (the naming makes it pretty obvious what the functions do), I think I'd rather see the wrong comment simply removed with nothing added back to replace it. Does that sound good to you, and if so would you mind sending an updated patch?
Quoted 5 lines
security/selinux/hooks.c +0
-1if (!current_is_single_threaded ()) { error =security_bounded_transition (tsec->sid, sid);if (error) --2.40.1
Signature · 1 line
paul-moore.com
PATCH v2 1/1 selinux: remove the wrong comment about multithreaded process handling
Since commit d9250dea3f89 ("SELinux: add boundary support and thread context assignment"), SELinux has been supporting assigning per-thread security context under a constraint and the comment was updated accordingly. However, seems like commit d84f4f992cbd ("CRED: Inaugurate COW credentials") accidentally brought the old comment back that doesn't match what the code does.
Considering the ease of understanding the code, this patch just removes the wrong comment.
---
v1 -> v2: just remove the comment instead of bringing back the old one as suggested by Paul
security/selinux/hooks.c | 1 - 1 file changed, 1 deletion(-)
security/selinux/hooks.c +0 -1
@@ -6459,7 +6459,6 @@ static int selinux_setprocattr(const char *name, void *value, size_t size)if (sid ==0 ) goto abort_change; -/* Only allow single threaded processes to change context */ if (!current_is_single_threaded ()) { error =security_bounded_transition (tsec->sid, sid);if (error)
Signature · 1 line
2.40.1
Re: [PATCH v2] selinux: remove the wrong comment about multithreaded process handling
Quoted 11 lines · On Dec 6, 2023 Munehisa Kamata <[email protected]> wrote:
Since commit
d9250dea3f89("SELinux: add boundary support and thread context assignment"), SELinux has been supporting assigning per-thread security context under a constraint and the comment was updated accordingly. However, seems like commitd84f4f992cbd("CRED: Inaugurate COW credentials") accidentally brought the old comment back that doesn't match what the code does.Considering the ease of understanding the code, this patch just removes the wrong comment.
Quoted 8 lines
Fixes d84f4f992cbd ("CRED: Inaugurate COW credentials")Signed-off-by Munehisa Kamata <[email protected]>---
v1 -> v2: just remove the comment instead of bringing back the old one as suggested by Paul
security/selinux/hooks.c | 1 - 1 file changed, 1 deletion(-)
Merged into selinux/dev, thanks!
Quoted 14 lines
security/selinux/hooks.c +0
-1@@ -6459,7 +6459,6 @@ static int selinux_setprocattr(const char *name, void *value, size_t size)if (sid ==0 ) goto abort_change; -/* Only allow single threaded processes to change context */ if (!current_is_single_threaded ()) { error =security_bounded_transition (tsec->sid, sid);if (error)Signature · 1 line
2.40.1
--
paul-moore.com
Re: [PATCH v2] selinux: remove the wrong comment about multithreaded process handling
Quoted 17 lines · Paul Moore
Quoted 15 lines · On Dec 6, 2023 Munehisa Kamata <[email protected]> wrote:
Since commit
d9250dea3f89("SELinux: add boundary support and thread context assignment"), SELinux has been supporting assigning per-thread security context under a constraint and the comment was updated accordingly. However, seems like commitd84f4f992cbd("CRED: Inaugurate COW credentials") accidentally brought the old comment back that doesn't match what the code does.Considering the ease of understanding the code, this patch just removes the wrong comment.
Fixes d84f4f992cbd ("CRED: Inaugurate COW credentials")Signed-off-by Munehisa Kamata <[email protected]>---
Quoted 6 lines
Quoted 4 lines
v1 -> v2: just remove the comment instead of bringing back the old one as suggested by Paul
security/selinux/hooks.c | 1 - 1 file changed, 1 deletion(-)Merged into selinux/dev, thanks!
Thank you, too :)
Quoted 18 lines
Quoted 14 lines
security/selinux/hooks.c +0
-1@@ -6459,7 +6459,6 @@ static int selinux_setprocattr(const char *name, void *value, size_t size)if (sid ==0 ) goto abort_change; -/* Only allow single threaded processes to change context */ if (!current_is_single_threaded ()) { error =security_bounded_transition (tsec->sid, sid);if (error)Signature · 1 line
2.40.1--
paul-moore.com