@@ -31,6 +31,8 @@ char *invalid_kern_ptr = (char *)-1;
3131/* Passing NULL to string kfuncs (treated as a userspace ptr) */ 
3232SEC ("syscall" ) __retval (USER_PTR_ERR ) int  test_strcmp_null1 (void  * ctx ) { return  bpf_strcmp (NULL , "hello" ); }
3333SEC ("syscall" )  __retval (USER_PTR_ERR )int  test_strcmp_null2 (void  * ctx ) { return  bpf_strcmp ("hello" , NULL ); }
34+ SEC ("syscall" ) __retval (USER_PTR_ERR ) int  test_strcasecmp_null1 (void  * ctx ) { return  bpf_strcasecmp (NULL , "HELLO" ); }
35+ SEC ("syscall" )  __retval (USER_PTR_ERR )int  test_strcasecmp_null2 (void  * ctx ) { return  bpf_strcasecmp ("HELLO" , NULL ); }
3436SEC ("syscall" )  __retval (USER_PTR_ERR )int  test_strchr_null (void  * ctx ) { return  bpf_strchr (NULL , 'a' ); }
3537SEC ("syscall" )  __retval (USER_PTR_ERR )int  test_strchrnul_null (void  * ctx ) { return  bpf_strchrnul (NULL , 'a' ); }
3638SEC ("syscall" )  __retval (USER_PTR_ERR )int  test_strnchr_null (void  * ctx ) { return  bpf_strnchr (NULL , 1 , 'a' ); }
@@ -49,6 +51,8 @@ SEC("syscall")  __retval(USER_PTR_ERR)int test_strnstr_null2(void *ctx) { return
4951/* Passing userspace ptr to string kfuncs */ 
5052SEC ("syscall" ) __retval (USER_PTR_ERR ) int  test_strcmp_user_ptr1 (void  * ctx ) { return  bpf_strcmp (user_ptr , "hello" ); }
5153SEC ("syscall" ) __retval (USER_PTR_ERR ) int  test_strcmp_user_ptr2 (void  * ctx ) { return  bpf_strcmp ("hello" , user_ptr ); }
54+ SEC ("syscall" ) __retval (USER_PTR_ERR ) int  test_strcasecmp_user_ptr1 (void  * ctx ) { return  bpf_strcasecmp (user_ptr , "HELLO" ); }
55+ SEC ("syscall" ) __retval (USER_PTR_ERR ) int  test_strcasecmp_user_ptr2 (void  * ctx ) { return  bpf_strcasecmp ("HELLO" , user_ptr ); }
5256SEC ("syscall" ) __retval (USER_PTR_ERR ) int  test_strchr_user_ptr (void  * ctx ) { return  bpf_strchr (user_ptr , 'a' ); }
5357SEC ("syscall" ) __retval (USER_PTR_ERR ) int  test_strchrnul_user_ptr (void  * ctx ) { return  bpf_strchrnul (user_ptr , 'a' ); }
5458SEC ("syscall" ) __retval (USER_PTR_ERR ) int  test_strnchr_user_ptr (void  * ctx ) { return  bpf_strnchr (user_ptr , 1 , 'a' ); }
@@ -69,6 +73,8 @@ SEC("syscall") __retval(USER_PTR_ERR) int test_strnstr_user_ptr2(void *ctx) { re
6973/* Passing invalid kernel ptr to string kfuncs should always return -EFAULT */ 
7074SEC ("syscall" ) __retval (- EFAULT ) int  test_strcmp_pagefault1 (void  * ctx ) { return  bpf_strcmp (invalid_kern_ptr , "hello" ); }
7175SEC ("syscall" ) __retval (- EFAULT ) int  test_strcmp_pagefault2 (void  * ctx ) { return  bpf_strcmp ("hello" , invalid_kern_ptr ); }
76+ SEC ("syscall" ) __retval (- EFAULT ) int  test_strcasecmp_pagefault1 (void  * ctx ) { return  bpf_strcasecmp (invalid_kern_ptr , "HELLO" ); }
77+ SEC ("syscall" ) __retval (- EFAULT ) int  test_strcasecmp_pagefault2 (void  * ctx ) { return  bpf_strcasecmp ("HELLO" , invalid_kern_ptr ); }
7278SEC ("syscall" ) __retval (- EFAULT ) int  test_strchr_pagefault (void  * ctx ) { return  bpf_strchr (invalid_kern_ptr , 'a' ); }
7379SEC ("syscall" ) __retval (- EFAULT ) int  test_strchrnul_pagefault (void  * ctx ) { return  bpf_strchrnul (invalid_kern_ptr , 'a' ); }
7480SEC ("syscall" ) __retval (- EFAULT ) int  test_strnchr_pagefault (void  * ctx ) { return  bpf_strnchr (invalid_kern_ptr , 1 , 'a' ); }
0 commit comments