public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] open|creat: skip S_ISGID check on files created by non-group members
@ 2018-07-17  8:35 Jan Stancek
  2018-07-18 15:04 ` Naresh Kamboju
  2018-07-30 11:57 ` Cyril Hrubis
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Stancek @ 2018-07-17  8:35 UTC (permalink / raw)
  To: ltp

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.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/creat/creat08.c | 13 ++++++-------
 testcases/kernel/syscalls/open/open10.c   | 12 +++++-------
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/testcases/kernel/syscalls/creat/creat08.c b/testcases/kernel/syscalls/creat/creat08.c
index 50f2b39931b8..d22558ac3c53 100644
--- a/testcases/kernel/syscalls/creat/creat08.c
+++ b/testcases/kernel/syscalls/creat/creat08.c
@@ -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) {
diff --git a/testcases/kernel/syscalls/open/open10.c b/testcases/kernel/syscalls/open/open10.c
index 613f2288fbde..14feec9e127e 100644
--- a/testcases/kernel/syscalls/open/open10.c
+++ b/testcases/kernel/syscalls/open/open10.c
@@ -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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [LTP] [PATCH] open|creat: skip S_ISGID check on files created by non-group members
  2018-07-17  8:35 [LTP] [PATCH] open|creat: skip S_ISGID check on files created by non-group members Jan Stancek
@ 2018-07-18 15:04 ` Naresh Kamboju
  2018-07-30 11:57 ` Cyril Hrubis
  1 sibling, 0 replies; 4+ messages in thread
From: Naresh Kamboju @ 2018-07-18 15:04 UTC (permalink / raw)
  To: ltp

Thanks for the patch Jan.

On 17 July 2018 at 14:05, Jan Stancek <jstancek@redhat.com> wrote:
> 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.
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
Reviewed-by: Naresh Kamboju <naresh.kamboju@linaro.org>


> ---
>  testcases/kernel/syscalls/creat/creat08.c | 13 ++++++-------
>  testcases/kernel/syscalls/open/open10.c   | 12 +++++-------
>  2 files changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/creat/creat08.c b/testcases/kernel/syscalls/creat/creat08.c
> index 50f2b39931b8..d22558ac3c53 100644
> --- a/testcases/kernel/syscalls/creat/creat08.c
> +++ b/testcases/kernel/syscalls/creat/creat08.c
> @@ -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) {
> diff --git a/testcases/kernel/syscalls/open/open10.c b/testcases/kernel/syscalls/open/open10.c
> index 613f2288fbde..14feec9e127e 100644
> --- a/testcases/kernel/syscalls/open/open10.c
> +++ b/testcases/kernel/syscalls/open/open10.c
> @@ -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
>

- Naresh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH] open|creat: skip S_ISGID check on files created by non-group members
  2018-07-17  8:35 [LTP] [PATCH] open|creat: skip S_ISGID check on files created by non-group members Jan Stancek
  2018-07-18 15:04 ` Naresh Kamboju
@ 2018-07-30 11:57 ` Cyril Hrubis
  2018-07-30 12:27   ` Jan Stancek
  1 sibling, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2018-07-30 11:57 UTC (permalink / raw)
  To: ltp

Hi!
> 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.

Looks good, acked.

> 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.

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.

> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
>  testcases/kernel/syscalls/creat/creat08.c | 13 ++++++-------
>  testcases/kernel/syscalls/open/open10.c   | 12 +++++-------
>  2 files changed, 11 insertions(+), 14 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/creat/creat08.c b/testcases/kernel/syscalls/creat/creat08.c
> index 50f2b39931b8..d22558ac3c53 100644
> --- a/testcases/kernel/syscalls/creat/creat08.c
> +++ b/testcases/kernel/syscalls/creat/creat08.c
> @@ -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) {
> diff --git a/testcases/kernel/syscalls/open/open10.c b/testcases/kernel/syscalls/open/open10.c
> index 613f2288fbde..14feec9e127e 100644
> --- a/testcases/kernel/syscalls/open/open10.c
> +++ b/testcases/kernel/syscalls/open/open10.c
> @@ -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
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [LTP] [PATCH] open|creat: skip S_ISGID check on files created by non-group members
  2018-07-30 11:57 ` Cyril Hrubis
@ 2018-07-30 12:27   ` Jan Stancek
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Stancek @ 2018-07-30 12:27 UTC (permalink / raw)
  To: ltp




----- Original Message -----
> Hi!
> > 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.
> 
> Looks good, acked.

Thanks, I almost forgot about this. Pushed.

Regards,
Jan

> 
> > 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.
> 
> 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.
> 
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> > ---
> >  testcases/kernel/syscalls/creat/creat08.c | 13 ++++++-------
> >  testcases/kernel/syscalls/open/open10.c   | 12 +++++-------
> >  2 files changed, 11 insertions(+), 14 deletions(-)
> > 
> > diff --git a/testcases/kernel/syscalls/creat/creat08.c
> > b/testcases/kernel/syscalls/creat/creat08.c
> > index 50f2b39931b8..d22558ac3c53 100644
> > --- a/testcases/kernel/syscalls/creat/creat08.c
> > +++ b/testcases/kernel/syscalls/creat/creat08.c
> > @@ -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) {
> > diff --git a/testcases/kernel/syscalls/open/open10.c
> > b/testcases/kernel/syscalls/open/open10.c
> > index 613f2288fbde..14feec9e127e 100644
> > --- a/testcases/kernel/syscalls/open/open10.c
> > +++ b/testcases/kernel/syscalls/open/open10.c
> > @@ -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
> > 
> > 
> > --
> > Mailing list info: https://lists.linux.it/listinfo/ltp
> 
> --
> Cyril Hrubis
> chrubis@suse.cz
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-30 12:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-17  8:35 [LTP] [PATCH] open|creat: skip S_ISGID check on files created by non-group members Jan Stancek
2018-07-18 15:04 ` Naresh Kamboju
2018-07-30 11:57 ` Cyril Hrubis
2018-07-30 12:27   ` Jan Stancek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox