Skip to contentSkip to conversation

pty: Update slave device permission check to allow 0600

LTP Dan Carpenter 3 participants 4 messages Mar 31, 2025 – Apr 1, 2025

lore
Share & tools
lore
#0 lore raw

Systemd changed the default permissions for PTY slave devices from 0620 to 0600 in response to CVE-2024-28085. Allow either 0620 or 0600 as valid permissions.

testcases/kernel/pty/common.h +2 -1
index 51760b1d39fa..7cda16096d4d 100644
@@ -54,7 +54,8 @@ static inline int open_slave(const int masterfd)
 			st.st_uid, uid);
 	}
 
-	if (st.st_mode != (S_IFCHR | 0620)) {
+	if (st.st_mode != (S_IFCHR | 0620) &&
+	    st.st_mode != (S_IFCHR | 0600)) {
 		tst_brk(TBROK, "unexpected slave device permission: %o",
 			st.st_mode);
 	}
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by
#1 lore raw

Hi!

Quoted 14 lines

Systemd changed the default permissions for PTY slave devices from 0620 to 0600 in response to CVE-2024-28085. Allow either 0620 or 0600 as valid permissions.

testcases/kernel/pty/common.h +0 -0
index 51760b1d39fa..7cda16096d4d 100644

testcases/kernel/pty/common.h static inline int open_slave(const int masterfd) · line 61

Quoted 9 lines
testcases/kernel/pty/common.h +2 -1
@@ -54,7 +54,8 @@ static inline int open_slave(const int masterfd)
 			st.st_uid, uid);
 	}
 
-	if (st.st_mode != (S_IFCHR | 0620)) {
+	if (st.st_mode != (S_IFCHR | 0620) &&
+	    st.st_mode != (S_IFCHR | 0600)) {
 		tst_brk(TBROK, "unexpected slave device permission: %o",
 			st.st_mode);
 	}

Looks good to me:

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by
#2 lore raw

Hi all,

Quoted 27 lines

Hi!

Quoted 14 lines

Systemd changed the default permissions for PTY slave devices from 0620 to 0600 in response to CVE-2024-28085. Allow either 0620 or 0600 as valid permissions.

testcases/kernel/pty/common.h +0 -0
index 51760b1d39fa..7cda16096d4d 100644

testcases/kernel/pty/common.h static inline int open_slave(const int masterfd) · line 61

Quoted 9 lines
testcases/kernel/pty/common.h +2 -1
@@ -54,7 +54,8 @@ static inline int open_slave(const int masterfd)
 			st.st_uid, uid);
 	}
 
-	if (st.st_mode != (S_IFCHR | 0620)) {
+	if (st.st_mode != (S_IFCHR | 0620) &&
+	    st.st_mode != (S_IFCHR | 0600)) {
 		tst_brk(TBROK, "unexpected slave device permission: %o",
 			st.st_mode);
 	}

Looks good to me:

Quoted 1 line

LGTM as well.

I was thinking a bit if whether to check just for owner permission and ignore group or other, e.g.:

st.st_mode != (S_IFCHR | S_ISUID | S_ISGID)) {

But we probably want strict permission checking, thus:

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
In reply to Dan Carpenter

Hi all,

Quoted 3 lines

Systemd changed the default permissions for PTY slave devices from 0620 to 0600 in response to CVE-2024-28085. Allow either 0620 or 0600 as valid permissions.

Thanks, merged!

Kind regards,
Petr

Quoted 19 lines
testcases/kernel/pty/common.h +2 -1
index 51760b1d39fa..7cda16096d4d 100644
@@ -54,7 +54,8 @@ static inline int open_slave(const int masterfd)
 			st.st_uid, uid);
 	}
 
-	if (st.st_mode != (S_IFCHR | 0620)) {
+	if (st.st_mode != (S_IFCHR | 0620) &&
+	    st.st_mode != (S_IFCHR | 0600)) {
 		tst_brk(TBROK, "unexpected slave device permission: %o",
 			st.st_mode);
 	}
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp