All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selftests/exec: Remove pipe from TEST_GEN_FILES
@ 2022-01-27 16:33 Muhammad Usama Anjum
  2022-01-27 16:45 ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Muhammad Usama Anjum @ 2022-01-27 16:33 UTC (permalink / raw)
  To: Eric Biederman, Kees Cook, Shuah Khan
  Cc: Muhammad Usama Anjum, kernel, Shuah Khan, linux-kselftest, linux-kernel

pipe named FIFO special file is being created in execveat.c to perform
some tests. Makefile doesn't need to do anything with the pipe. When it
isn't found, Makefile generates the following build error:

make: *** No rule to make target '/linux_mainline/tools/testing/selftests/exec/pipe', needed by 'all'.  Stop.

Fixes: 61016db15b8e ("selftests/exec: Verify execve of non-regular files fail")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 tools/testing/selftests/exec/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile
index dd61118df66ed..12c5e27d32c16 100644
--- a/tools/testing/selftests/exec/Makefile
+++ b/tools/testing/selftests/exec/Makefile
@@ -5,7 +5,7 @@ CFLAGS += -D_GNU_SOURCE
 
 TEST_PROGS := binfmt_script non-regular
 TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216
-TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir pipe
+TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
 # Makefile is a run-time dependency, since it's accessed by the execveat test
 TEST_FILES := Makefile
 
-- 
2.30.2


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

* Re: [PATCH] selftests/exec: Remove pipe from TEST_GEN_FILES
  2022-01-27 16:33 [PATCH] selftests/exec: Remove pipe from TEST_GEN_FILES Muhammad Usama Anjum
@ 2022-01-27 16:45 ` Kees Cook
  2022-01-27 16:55   ` Muhammad Usama Anjum
  0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2022-01-27 16:45 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Eric Biederman, Shuah Khan, kernel, Shuah Khan, linux-kselftest,
	linux-kernel

On Thu, Jan 27, 2022 at 09:33:45PM +0500, Muhammad Usama Anjum wrote:
> pipe named FIFO special file is being created in execveat.c to perform
> some tests. Makefile doesn't need to do anything with the pipe. When it
> isn't found, Makefile generates the following build error:
> 
> make: *** No rule to make target '/linux_mainline/tools/testing/selftests/exec/pipe', needed by 'all'.  Stop.

Ah, good catch. However, I think this should be moved to EXTRA_CLEAN instead of
only removed from TEST_GEN_FILES. (i.e. "pipe" is created by
tools/testing/selftests/exec/execveat.c and should be removed.

-Kees

> 
> Fixes: 61016db15b8e ("selftests/exec: Verify execve of non-regular files fail")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
>  tools/testing/selftests/exec/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile
> index dd61118df66ed..12c5e27d32c16 100644
> --- a/tools/testing/selftests/exec/Makefile
> +++ b/tools/testing/selftests/exec/Makefile
> @@ -5,7 +5,7 @@ CFLAGS += -D_GNU_SOURCE
>  
>  TEST_PROGS := binfmt_script non-regular
>  TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216
> -TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir pipe
> +TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
>  # Makefile is a run-time dependency, since it's accessed by the execveat test
>  TEST_FILES := Makefile
>  
> -- 
> 2.30.2
> 

-- 
Kees Cook

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

* Re: [PATCH] selftests/exec: Remove pipe from TEST_GEN_FILES
  2022-01-27 16:45 ` Kees Cook
@ 2022-01-27 16:55   ` Muhammad Usama Anjum
  2022-01-27 17:23     ` Shuah Khan
  0 siblings, 1 reply; 4+ messages in thread
From: Muhammad Usama Anjum @ 2022-01-27 16:55 UTC (permalink / raw)
  To: Kees Cook
  Cc: usama.anjum, Eric Biederman, Shuah Khan, kernel, Shuah Khan,
	linux-kselftest, linux-kernel



On 1/27/22 9:45 PM, Kees Cook wrote:
> On Thu, Jan 27, 2022 at 09:33:45PM +0500, Muhammad Usama Anjum wrote:
>> pipe named FIFO special file is being created in execveat.c to perform
>> some tests. Makefile doesn't need to do anything with the pipe. When it
>> isn't found, Makefile generates the following build error:
>>
>> make: *** No rule to make target '/linux_mainline/tools/testing/selftests/exec/pipe', needed by 'all'.  Stop.
> 
> Ah, good catch. However, I think this should be moved to EXTRA_CLEAN instead of
> only removed from TEST_GEN_FILES. (i.e. "pipe" is created by
> tools/testing/selftests/exec/execveat.c and should be removed.
Hi,

Thank you. tools/testing/selftests/exec/execveat.c creates pipe file and
removes it after performing the test on it. I've looked at the code path
between creation and deletion of this file. It'll always be removed
automatically. So we shouldn't add it to EXTRA_CLEAN.

Thanks,
Usama

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

* Re: [PATCH] selftests/exec: Remove pipe from TEST_GEN_FILES
  2022-01-27 16:55   ` Muhammad Usama Anjum
@ 2022-01-27 17:23     ` Shuah Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Shuah Khan @ 2022-01-27 17:23 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Kees Cook
  Cc: Eric Biederman, Shuah Khan, kernel, linux-kselftest,
	linux-kernel, Shuah Khan

On 1/27/22 9:55 AM, Muhammad Usama Anjum wrote:
> 
> 
> On 1/27/22 9:45 PM, Kees Cook wrote:
>> On Thu, Jan 27, 2022 at 09:33:45PM +0500, Muhammad Usama Anjum wrote:
>>> pipe named FIFO special file is being created in execveat.c to perform
>>> some tests. Makefile doesn't need to do anything with the pipe. When it
>>> isn't found, Makefile generates the following build error:
>>>
>>> make: *** No rule to make target '/linux_mainline/tools/testing/selftests/exec/pipe', needed by 'all'.  Stop.
>>
>> Ah, good catch. However, I think this should be moved to EXTRA_CLEAN instead of
>> only removed from TEST_GEN_FILES. (i.e. "pipe" is created by
>> tools/testing/selftests/exec/execveat.c and should be removed.
> Hi,
> 
> Thank you. tools/testing/selftests/exec/execveat.c creates pipe file and
> removes it after performing the test on it. I've looked at the code path
> between creation and deletion of this file. It'll always be removed
> automatically. So we shouldn't add it to EXTRA_CLEAN.
> 

Thank you for finding and fixing the problem.

I see that pipe is created in prerequisites() and removed from run_tests()
after executing non-regular file test. The change looks fine and I ran a
quick test and it looks good.

On a separate note the test use its own Makefile for running a test and
copies it over in TEST_FILES - Just a bit strange, all seems to work well.

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

I can pull this in for rc3.

thanks,
-- Shuah


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

end of thread, other threads:[~2022-01-27 17:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-27 16:33 [PATCH] selftests/exec: Remove pipe from TEST_GEN_FILES Muhammad Usama Anjum
2022-01-27 16:45 ` Kees Cook
2022-01-27 16:55   ` Muhammad Usama Anjum
2022-01-27 17:23     ` Shuah Khan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.