diff mbox series

[1/6] selftests: capabilities: remove duplicate unneeded defines

Message ID 20230805073809.1753462-1-usama.anjum@collabora.com (mailing list archive)
State Accepted
Commit dfc033059bb6aa7d219fc25d113b3886131b0a6c
Headers show
Series [1/6] selftests: capabilities: remove duplicate unneeded defines | expand

Commit Message

Muhammad Usama Anjum Aug. 5, 2023, 7:37 a.m. UTC
These duplicate defines should automatically be picked up from kernel
headers. Use KHDR_INCLUDES to add kernel header files.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 tools/testing/selftests/capabilities/Makefile       | 2 +-
 tools/testing/selftests/capabilities/test_execve.c  | 8 --------
 tools/testing/selftests/capabilities/validate_cap.c | 8 --------
 3 files changed, 1 insertion(+), 17 deletions(-)

Comments

Muhammad Usama Anjum Aug. 22, 2023, 8:57 a.m. UTC | #1
Hi Shuah,

Christian Brauner had picked [PATCH 4/6]. Others are still not picked.
Please have a look.

Thanks,
Usama

On 8/5/23 12:37 PM, Muhammad Usama Anjum wrote:
> These duplicate defines should automatically be picked up from kernel
> headers. Use KHDR_INCLUDES to add kernel header files.
> 
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
>  tools/testing/selftests/capabilities/Makefile       | 2 +-
>  tools/testing/selftests/capabilities/test_execve.c  | 8 --------
>  tools/testing/selftests/capabilities/validate_cap.c | 8 --------
>  3 files changed, 1 insertion(+), 17 deletions(-)
> 
> diff --git a/tools/testing/selftests/capabilities/Makefile b/tools/testing/selftests/capabilities/Makefile
> index 6e9d98d457d5b..411ac098308f1 100644
> --- a/tools/testing/selftests/capabilities/Makefile
> +++ b/tools/testing/selftests/capabilities/Makefile
> @@ -2,7 +2,7 @@
>  TEST_GEN_FILES := validate_cap
>  TEST_GEN_PROGS := test_execve
>  
> -CFLAGS += -O2 -g -std=gnu99 -Wall
> +CFLAGS += -O2 -g -std=gnu99 -Wall $(KHDR_INCLUDES)
>  LDLIBS += -lcap-ng -lrt -ldl
>  
>  include ../lib.mk
> diff --git a/tools/testing/selftests/capabilities/test_execve.c b/tools/testing/selftests/capabilities/test_execve.c
> index df0ef02b40367..e3a352b020a79 100644
> --- a/tools/testing/selftests/capabilities/test_execve.c
> +++ b/tools/testing/selftests/capabilities/test_execve.c
> @@ -20,14 +20,6 @@
>  
>  #include "../kselftest.h"
>  
> -#ifndef PR_CAP_AMBIENT
> -#define PR_CAP_AMBIENT			47
> -# define PR_CAP_AMBIENT_IS_SET		1
> -# define PR_CAP_AMBIENT_RAISE		2
> -# define PR_CAP_AMBIENT_LOWER		3
> -# define PR_CAP_AMBIENT_CLEAR_ALL	4
> -#endif
> -
>  static int nerrs;
>  static pid_t mpid;	/*  main() pid is used to avoid duplicate test counts */
>  
> diff --git a/tools/testing/selftests/capabilities/validate_cap.c b/tools/testing/selftests/capabilities/validate_cap.c
> index cdfc94268fe6e..60b4e7b716a75 100644
> --- a/tools/testing/selftests/capabilities/validate_cap.c
> +++ b/tools/testing/selftests/capabilities/validate_cap.c
> @@ -9,14 +9,6 @@
>  
>  #include "../kselftest.h"
>  
> -#ifndef PR_CAP_AMBIENT
> -#define PR_CAP_AMBIENT			47
> -# define PR_CAP_AMBIENT_IS_SET		1
> -# define PR_CAP_AMBIENT_RAISE		2
> -# define PR_CAP_AMBIENT_LOWER		3
> -# define PR_CAP_AMBIENT_CLEAR_ALL	4
> -#endif
> -
>  #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19)
>  # define HAVE_GETAUXVAL
>  #endif
Muhammad Usama Anjum Sept. 4, 2023, 10:48 a.m. UTC | #2
On 8/22/23 1:57 PM, Muhammad Usama Anjum wrote:
> Hi Shuah,
> 
> Christian Brauner had picked [PATCH 4/6]. Others are still not picked.
> Please have a look.
Soft reminder

> 
> Thanks,
> Usama
> 
> On 8/5/23 12:37 PM, Muhammad Usama Anjum wrote:
>> These duplicate defines should automatically be picked up from kernel
>> headers. Use KHDR_INCLUDES to add kernel header files.
>>
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>> ---
>>  tools/testing/selftests/capabilities/Makefile       | 2 +-
>>  tools/testing/selftests/capabilities/test_execve.c  | 8 --------
>>  tools/testing/selftests/capabilities/validate_cap.c | 8 --------
>>  3 files changed, 1 insertion(+), 17 deletions(-)
>>
>> diff --git a/tools/testing/selftests/capabilities/Makefile b/tools/testing/selftests/capabilities/Makefile
>> index 6e9d98d457d5b..411ac098308f1 100644
>> --- a/tools/testing/selftests/capabilities/Makefile
>> +++ b/tools/testing/selftests/capabilities/Makefile
>> @@ -2,7 +2,7 @@
>>  TEST_GEN_FILES := validate_cap
>>  TEST_GEN_PROGS := test_execve
>>  
>> -CFLAGS += -O2 -g -std=gnu99 -Wall
>> +CFLAGS += -O2 -g -std=gnu99 -Wall $(KHDR_INCLUDES)
>>  LDLIBS += -lcap-ng -lrt -ldl
>>  
>>  include ../lib.mk
>> diff --git a/tools/testing/selftests/capabilities/test_execve.c b/tools/testing/selftests/capabilities/test_execve.c
>> index df0ef02b40367..e3a352b020a79 100644
>> --- a/tools/testing/selftests/capabilities/test_execve.c
>> +++ b/tools/testing/selftests/capabilities/test_execve.c
>> @@ -20,14 +20,6 @@
>>  
>>  #include "../kselftest.h"
>>  
>> -#ifndef PR_CAP_AMBIENT
>> -#define PR_CAP_AMBIENT			47
>> -# define PR_CAP_AMBIENT_IS_SET		1
>> -# define PR_CAP_AMBIENT_RAISE		2
>> -# define PR_CAP_AMBIENT_LOWER		3
>> -# define PR_CAP_AMBIENT_CLEAR_ALL	4
>> -#endif
>> -
>>  static int nerrs;
>>  static pid_t mpid;	/*  main() pid is used to avoid duplicate test counts */
>>  
>> diff --git a/tools/testing/selftests/capabilities/validate_cap.c b/tools/testing/selftests/capabilities/validate_cap.c
>> index cdfc94268fe6e..60b4e7b716a75 100644
>> --- a/tools/testing/selftests/capabilities/validate_cap.c
>> +++ b/tools/testing/selftests/capabilities/validate_cap.c
>> @@ -9,14 +9,6 @@
>>  
>>  #include "../kselftest.h"
>>  
>> -#ifndef PR_CAP_AMBIENT
>> -#define PR_CAP_AMBIENT			47
>> -# define PR_CAP_AMBIENT_IS_SET		1
>> -# define PR_CAP_AMBIENT_RAISE		2
>> -# define PR_CAP_AMBIENT_LOWER		3
>> -# define PR_CAP_AMBIENT_CLEAR_ALL	4
>> -#endif
>> -
>>  #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19)
>>  # define HAVE_GETAUXVAL
>>  #endif
>
Muhammad Usama Anjum Oct. 6, 2023, 8:33 a.m. UTC | #3
On 9/4/23 3:48 PM, Muhammad Usama Anjum wrote:
> On 8/22/23 1:57 PM, Muhammad Usama Anjum wrote:
>> Hi Shuah,
>>
>> Christian Brauner had picked [PATCH 4/6]. Others are still not picked.
>> Please have a look.
Shuah, I thought you had picked up these patches. But I'm unable to find
them in the linux-next. I'll be re-sending 6th patch separately. Can you
please pick up patch number 1, 2, 3 and 5 to your tree?

Thanks

> Soft reminder
> 
>>
>> Thanks,
>> Usama
>>
>> On 8/5/23 12:37 PM, Muhammad Usama Anjum wrote:
>>> These duplicate defines should automatically be picked up from kernel
>>> headers. Use KHDR_INCLUDES to add kernel header files.
>>>
>>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>>> ---
>>>  tools/testing/selftests/capabilities/Makefile       | 2 +-
>>>  tools/testing/selftests/capabilities/test_execve.c  | 8 --------
>>>  tools/testing/selftests/capabilities/validate_cap.c | 8 --------
>>>  3 files changed, 1 insertion(+), 17 deletions(-)
>>>
>>> diff --git a/tools/testing/selftests/capabilities/Makefile b/tools/testing/selftests/capabilities/Makefile
>>> index 6e9d98d457d5b..411ac098308f1 100644
>>> --- a/tools/testing/selftests/capabilities/Makefile
>>> +++ b/tools/testing/selftests/capabilities/Makefile
>>> @@ -2,7 +2,7 @@
>>>  TEST_GEN_FILES := validate_cap
>>>  TEST_GEN_PROGS := test_execve
>>>  
>>> -CFLAGS += -O2 -g -std=gnu99 -Wall
>>> +CFLAGS += -O2 -g -std=gnu99 -Wall $(KHDR_INCLUDES)
>>>  LDLIBS += -lcap-ng -lrt -ldl
>>>  
>>>  include ../lib.mk
>>> diff --git a/tools/testing/selftests/capabilities/test_execve.c b/tools/testing/selftests/capabilities/test_execve.c
>>> index df0ef02b40367..e3a352b020a79 100644
>>> --- a/tools/testing/selftests/capabilities/test_execve.c
>>> +++ b/tools/testing/selftests/capabilities/test_execve.c
>>> @@ -20,14 +20,6 @@
>>>  
>>>  #include "../kselftest.h"
>>>  
>>> -#ifndef PR_CAP_AMBIENT
>>> -#define PR_CAP_AMBIENT			47
>>> -# define PR_CAP_AMBIENT_IS_SET		1
>>> -# define PR_CAP_AMBIENT_RAISE		2
>>> -# define PR_CAP_AMBIENT_LOWER		3
>>> -# define PR_CAP_AMBIENT_CLEAR_ALL	4
>>> -#endif
>>> -
>>>  static int nerrs;
>>>  static pid_t mpid;	/*  main() pid is used to avoid duplicate test counts */
>>>  
>>> diff --git a/tools/testing/selftests/capabilities/validate_cap.c b/tools/testing/selftests/capabilities/validate_cap.c
>>> index cdfc94268fe6e..60b4e7b716a75 100644
>>> --- a/tools/testing/selftests/capabilities/validate_cap.c
>>> +++ b/tools/testing/selftests/capabilities/validate_cap.c
>>> @@ -9,14 +9,6 @@
>>>  
>>>  #include "../kselftest.h"
>>>  
>>> -#ifndef PR_CAP_AMBIENT
>>> -#define PR_CAP_AMBIENT			47
>>> -# define PR_CAP_AMBIENT_IS_SET		1
>>> -# define PR_CAP_AMBIENT_RAISE		2
>>> -# define PR_CAP_AMBIENT_LOWER		3
>>> -# define PR_CAP_AMBIENT_CLEAR_ALL	4
>>> -#endif
>>> -
>>>  #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19)
>>>  # define HAVE_GETAUXVAL
>>>  #endif
>>
>
Muhammad Usama Anjum Oct. 6, 2023, 10:09 a.m. UTC | #4
On 10/6/23 1:33 PM, Muhammad Usama Anjum wrote:
> On 9/4/23 3:48 PM, Muhammad Usama Anjum wrote:
>> On 8/22/23 1:57 PM, Muhammad Usama Anjum wrote:
>>> Hi Shuah,
>>>
>>> Christian Brauner had picked [PATCH 4/6]. Others are still not picked.
>>> Please have a look.
> Shuah, I thought you had picked up these patches. But I'm unable to find
> them in the linux-next. I'll be re-sending 6th patch separately. Can you
> please pick up patch number 1, 2, 3 and 5 to your tree?
Sent v2 for your ease. It has same patches.
https://lore.kernel.org/all/20231006100743.1631334-1-usama.anjum@collabora.com

> 
> Thanks
> 
>> Soft reminder
>>
>>>
>>> Thanks,
>>> Usama
>>>
>>> On 8/5/23 12:37 PM, Muhammad Usama Anjum wrote:
>>>> These duplicate defines should automatically be picked up from kernel
>>>> headers. Use KHDR_INCLUDES to add kernel header files.
>>>>
>>>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>>>> ---
>>>>  tools/testing/selftests/capabilities/Makefile       | 2 +-
>>>>  tools/testing/selftests/capabilities/test_execve.c  | 8 --------
>>>>  tools/testing/selftests/capabilities/validate_cap.c | 8 --------
>>>>  3 files changed, 1 insertion(+), 17 deletions(-)
>>>>
>>>> diff --git a/tools/testing/selftests/capabilities/Makefile b/tools/testing/selftests/capabilities/Makefile
>>>> index 6e9d98d457d5b..411ac098308f1 100644
>>>> --- a/tools/testing/selftests/capabilities/Makefile
>>>> +++ b/tools/testing/selftests/capabilities/Makefile
>>>> @@ -2,7 +2,7 @@
>>>>  TEST_GEN_FILES := validate_cap
>>>>  TEST_GEN_PROGS := test_execve
>>>>  
>>>> -CFLAGS += -O2 -g -std=gnu99 -Wall
>>>> +CFLAGS += -O2 -g -std=gnu99 -Wall $(KHDR_INCLUDES)
>>>>  LDLIBS += -lcap-ng -lrt -ldl
>>>>  
>>>>  include ../lib.mk
>>>> diff --git a/tools/testing/selftests/capabilities/test_execve.c b/tools/testing/selftests/capabilities/test_execve.c
>>>> index df0ef02b40367..e3a352b020a79 100644
>>>> --- a/tools/testing/selftests/capabilities/test_execve.c
>>>> +++ b/tools/testing/selftests/capabilities/test_execve.c
>>>> @@ -20,14 +20,6 @@
>>>>  
>>>>  #include "../kselftest.h"
>>>>  
>>>> -#ifndef PR_CAP_AMBIENT
>>>> -#define PR_CAP_AMBIENT			47
>>>> -# define PR_CAP_AMBIENT_IS_SET		1
>>>> -# define PR_CAP_AMBIENT_RAISE		2
>>>> -# define PR_CAP_AMBIENT_LOWER		3
>>>> -# define PR_CAP_AMBIENT_CLEAR_ALL	4
>>>> -#endif
>>>> -
>>>>  static int nerrs;
>>>>  static pid_t mpid;	/*  main() pid is used to avoid duplicate test counts */
>>>>  
>>>> diff --git a/tools/testing/selftests/capabilities/validate_cap.c b/tools/testing/selftests/capabilities/validate_cap.c
>>>> index cdfc94268fe6e..60b4e7b716a75 100644
>>>> --- a/tools/testing/selftests/capabilities/validate_cap.c
>>>> +++ b/tools/testing/selftests/capabilities/validate_cap.c
>>>> @@ -9,14 +9,6 @@
>>>>  
>>>>  #include "../kselftest.h"
>>>>  
>>>> -#ifndef PR_CAP_AMBIENT
>>>> -#define PR_CAP_AMBIENT			47
>>>> -# define PR_CAP_AMBIENT_IS_SET		1
>>>> -# define PR_CAP_AMBIENT_RAISE		2
>>>> -# define PR_CAP_AMBIENT_LOWER		3
>>>> -# define PR_CAP_AMBIENT_CLEAR_ALL	4
>>>> -#endif
>>>> -
>>>>  #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19)
>>>>  # define HAVE_GETAUXVAL
>>>>  #endif
>>>
>>
>
Shuah Khan Oct. 6, 2023, 11:45 p.m. UTC | #5
On 10/6/23 04:09, Muhammad Usama Anjum wrote:
> On 10/6/23 1:33 PM, Muhammad Usama Anjum wrote:
>> On 9/4/23 3:48 PM, Muhammad Usama Anjum wrote:
>>> On 8/22/23 1:57 PM, Muhammad Usama Anjum wrote:
>>>> Hi Shuah,
>>>>
>>>> Christian Brauner had picked [PATCH 4/6]. Others are still not picked.
>>>> Please have a look.
>> Shuah, I thought you had picked up these patches. But I'm unable to find
>> them in the linux-next. I'll be re-sending 6th patch separately. Can you
>> please pick up patch number 1, 2, 3 and 5 to your tree?

I though I picked these up. Looks like I didn't.

> Sent v2 for your ease. It has same patches.
> https://lore.kernel.org/all/20231006100743.1631334-1-usama.anjum@collabora.com
> 

Thank you. They are now in linux-kselftest next.

-- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/capabilities/Makefile b/tools/testing/selftests/capabilities/Makefile
index 6e9d98d457d5b..411ac098308f1 100644
--- a/tools/testing/selftests/capabilities/Makefile
+++ b/tools/testing/selftests/capabilities/Makefile
@@ -2,7 +2,7 @@ 
 TEST_GEN_FILES := validate_cap
 TEST_GEN_PROGS := test_execve
 
-CFLAGS += -O2 -g -std=gnu99 -Wall
+CFLAGS += -O2 -g -std=gnu99 -Wall $(KHDR_INCLUDES)
 LDLIBS += -lcap-ng -lrt -ldl
 
 include ../lib.mk
diff --git a/tools/testing/selftests/capabilities/test_execve.c b/tools/testing/selftests/capabilities/test_execve.c
index df0ef02b40367..e3a352b020a79 100644
--- a/tools/testing/selftests/capabilities/test_execve.c
+++ b/tools/testing/selftests/capabilities/test_execve.c
@@ -20,14 +20,6 @@ 
 
 #include "../kselftest.h"
 
-#ifndef PR_CAP_AMBIENT
-#define PR_CAP_AMBIENT			47
-# define PR_CAP_AMBIENT_IS_SET		1
-# define PR_CAP_AMBIENT_RAISE		2
-# define PR_CAP_AMBIENT_LOWER		3
-# define PR_CAP_AMBIENT_CLEAR_ALL	4
-#endif
-
 static int nerrs;
 static pid_t mpid;	/*  main() pid is used to avoid duplicate test counts */
 
diff --git a/tools/testing/selftests/capabilities/validate_cap.c b/tools/testing/selftests/capabilities/validate_cap.c
index cdfc94268fe6e..60b4e7b716a75 100644
--- a/tools/testing/selftests/capabilities/validate_cap.c
+++ b/tools/testing/selftests/capabilities/validate_cap.c
@@ -9,14 +9,6 @@ 
 
 #include "../kselftest.h"
 
-#ifndef PR_CAP_AMBIENT
-#define PR_CAP_AMBIENT			47
-# define PR_CAP_AMBIENT_IS_SET		1
-# define PR_CAP_AMBIENT_RAISE		2
-# define PR_CAP_AMBIENT_LOWER		3
-# define PR_CAP_AMBIENT_CLEAR_ALL	4
-#endif
-
 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 19)
 # define HAVE_GETAUXVAL
 #endif