open|creat: skip S_ISGID check on files created by non-group members
PATCH 1/1 open|creat: skip S_ISGID check on files created by non-group members
0fa3ecd87848 ("Fix up non-directory creation in SGID directories") fixes problem described in CVE-2018-13405. This commit is getting backported to older streams as well.
This patch removes S_ISGID check for files created by non-group members in LTP tests creat08 and open10.
Once 0fa3ecd87848 will be in non-rc kernel, we could add a new test for this CVE that would be limited to 4.18+ kernels.
--- testcases/kernel/syscalls/creat/creat08.c | 13 ++++++------- testcases/kernel/syscalls/open/open10.c | 12 +++++------- 2 files changed, 11 insertions(+), 14 deletions(-)
testcases/kernel/syscalls/creat/creat08.c +6 -7
@@ -361,13 +361,12 @@ int main(int ac, char **av) local_flag =FAILED ; } -/* Verify modes */ -if (!(buf.st_mode &S_ISGID )) { -tst_resm (TFAIL , -"%s: Incorrect modes, setgid bit should be set" , - setgid_B); - local_flag =FAILED ; - } +/* +* Skip S_ISGID check +* 0fa3ecd87848 ("Fix up non-directory creation in SGID directories") +* clears S_ISGID for files created by non-group members +*/ +close (fd);if (local_flag ==PASSED ) {
testcases/kernel/syscalls/open/open10.c +5 -7
@@ -345,13 +345,11 @@ int main(int ac, char *av[]) local_flag =FAILED ; } -/* Verify modes */ -if (!(buf.st_mode &S_ISGID )) { -tst_resm (TFAIL , -"%s: Incorrect modes, setgid bit not set" , - setgid_B); - local_flag =FAILED ; - } +/* +* Skip S_ISGID check +* 0fa3ecd87848 ("Fix up non-directory creation in SGID directories") +* clears S_ISGID for files created by non-group members +*/ if (local_flag ==PASSED ) {tst_resm (TPASS ,"Test passed in block2." );
Signature · 1 line
1.8.3.1
PATCH 1/1 open|creat: skip S_ISGID check on files created by non-group members
Thanks for the patch Jan.
Quoted 11 lines · Jan Stancek
0fa3ecd87848("Fix up non-directory creation in SGID directories") fixes problem described in CVE-2018-13405. This commit is getting backported to older streams as well.This patch removes
S_ISGIDcheck for files created by non-group members in LTP tests creat08 and open10.Once
0fa3ecd87848will be in non-rc kernel, we could add a new test for this CVE that would be limited to 4.18+ kernels.Signed-off-by Jan Stancek <[email protected]>
Quoted 53 lines
--- testcases/kernel/syscalls/creat/creat08.c | 13 ++++++------- testcases/kernel/syscalls/open/open10.c | 12 +++++------- 2 files changed, 11 insertions(+), 14 deletions(-)testcases/kernel/syscalls/creat/creat08.c +6
-7@@ -361,13 +361,12 @@ int main(int ac, char **av) local_flag =FAILED ; } -/* Verify modes */ -if (!(buf.st_mode &S_ISGID )) { -tst_resm (TFAIL , -"%s: Incorrect modes, setgid bit should be set" , - setgid_B); - local_flag =FAILED ; - } +/* +* Skip S_ISGID check +* 0fa3ecd87848 ("Fix up non-directory creation in SGID directories") +* clears S_ISGID for files created by non-group members +*/ +close (fd);if (local_flag ==PASSED ) {testcases/kernel/syscalls/open/open10.c +5
-8@@ -345,13 +345,11 @@ int main(int ac, char *av[]) local_flag =FAILED ; } -/* Verify modes */ -if (!(buf.st_mode &S_ISGID )) { -tst_resm (TFAIL , -"%s: Incorrect modes, setgid bit not set" , - setgid_B); - local_flag =FAILED ; - } +/* +* Skip S_ISGID check +* 0fa3ecd87848 ("Fix up non-directory creation in SGID directories") +* clears S_ISGID for files created by non-group members +*/ if (local_flag ==PASSED ) {tst_resm (TPASS ,"Test passed in block2." ); --
Quoted 2 lines
1.8.3.1
- Naresh
PATCH 1/1 open|creat: skip S_ISGID check on files created by non-group members
In reply to Jan StancekHi!
Quoted 6 lines
0fa3ecd87848("Fix up non-directory creation in SGID directories") fixes problem described in CVE-2018-13405. This commit is getting backported to older streams as well.This patch removes
S_ISGIDcheck for files created by non-group members in LTP tests creat08 and open10.
Looks good, acked.
Quoted 2 lines
Once
0fa3ecd87848will be in non-rc kernel, we could add a new test for this CVE that would be limited to 4.18+ kernels.
Given that this is CVE we may as well go a little bit further and write a test that will fail even on older kernels.
Quoted 59 lines
Signed-off-by Jan Stancek <[email protected]>--- testcases/kernel/syscalls/creat/creat08.c | 13 ++++++------- testcases/kernel/syscalls/open/open10.c | 12 +++++------- 2 files changed, 11 insertions(+), 14 deletions(-)testcases/kernel/syscalls/creat/creat08.c +6
-7@@ -361,13 +361,12 @@ int main(int ac, char **av) local_flag =FAILED ; } -/* Verify modes */ -if (!(buf.st_mode &S_ISGID )) { -tst_resm (TFAIL , -"%s: Incorrect modes, setgid bit should be set" , - setgid_B); - local_flag =FAILED ; - } +/* +* Skip S_ISGID check +* 0fa3ecd87848 ("Fix up non-directory creation in SGID directories") +* clears S_ISGID for files created by non-group members +*/ +close (fd);if (local_flag ==PASSED ) {testcases/kernel/syscalls/open/open10.c +5
-7@@ -345,13 +345,11 @@ int main(int ac, char *av[]) local_flag =FAILED ; } -/* Verify modes */ -if (!(buf.st_mode &S_ISGID )) { -tst_resm (TFAIL , -"%s: Incorrect modes, setgid bit not set" , - setgid_B); - local_flag =FAILED ; - } +/* +* Skip S_ISGID check +* 0fa3ecd87848 ("Fix up non-directory creation in SGID directories") +* clears S_ISGID for files created by non-group members +*/ if (local_flag ==PASSED ) {tst_resm (TPASS ,"Test passed in block2." );Signature · 5 lines
1.8.3.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 open|creat: skip S_ISGID check on files created by non-group members
----- Original Message -----
Quoted 9 lines
Hi!
Quoted 6 lines
0fa3ecd87848("Fix up non-directory creation in SGID directories") fixes problem described in CVE-2018-13405. This commit is getting backported to older streams as well.This patch removes
S_ISGIDcheck for files created by non-group members in LTP tests creat08 and open10.Looks good, acked.
Thanks, I almost forgot about this. Pushed.
Regards,
Jan
Quoted 73 lines
Quoted 3 lines
Once
0fa3ecd87848will be in non-rc kernel, we could add a new test for this CVE that would be limited to 4.18+ kernels.Given that this is CVE we may as well go a little bit further and write a test that will fail even on older kernels.
Quoted 59 lines
Signed-off-by Jan Stancek <[email protected]>--- testcases/kernel/syscalls/creat/creat08.c | 13 ++++++------- testcases/kernel/syscalls/open/open10.c | 12 +++++------- 2 files changed, 11 insertions(+), 14 deletions(-)testcases/kernel/syscalls/creat/creat08.c +6
-7@@ -361,13 +361,12 @@ int main(int ac, char **av) local_flag =FAILED ; } -/* Verify modes */ -if (!(buf.st_mode &S_ISGID )) { -tst_resm (TFAIL , -"%s: Incorrect modes, setgid bit should be set" , - setgid_B); - local_flag =FAILED ; - } +/* +* Skip S_ISGID check +* 0fa3ecd87848 ("Fix up non-directory creation in SGID directories") +* clears S_ISGID for files created by non-group members +*/ +close (fd);if (local_flag ==PASSED ) {testcases/kernel/syscalls/open/open10.c +5
-8@@ -345,13 +345,11 @@ int main(int ac, char *av[]) local_flag =FAILED ; } -/* Verify modes */ -if (!(buf.st_mode &S_ISGID )) { -tst_resm (TFAIL , -"%s: Incorrect modes, setgid bit not set" , - setgid_B); - local_flag =FAILED ; - } +/* +* Skip S_ISGID check +* 0fa3ecd87848 ("Fix up non-directory creation in SGID directories") +* clears S_ISGID for files created by non-group members +*/ if (local_flag ==PASSED ) {tst_resm (TPASS ,"Test passed in block2." ); --1.8.3.1
Quoted 2 lines
--
Mailing list info: https://lists.linux.it/listinfo/ltp--
Cyril Hrubis
[email protected]