[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <201804111155.d856J7oR%fengguang.wu@intel.com>
Date: Wed, 11 Apr 2018 11:44:55 +0800
From: kbuild test robot <lkp@...el.com>
To: Joe Lawrence <joe.lawrence@...hat.com>
Cc: kbuild-all@...org, live-patching@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
Jiri Kosina <jikos@...nel.org>,
Josh Poimboeuf <jpoimboe@...hat.com>,
Petr Mladek <pmladek@...e.com>,
Miroslav Benes <mbenes@...e.cz>,
Libor Pecháček <lpechacek@...e.com>,
Nicolai Stange <nstange@...e.de>,
Artem Savkov <asavkov@...hat.com>
Subject: Re: [PATCH v2] selftests/livepatch: introduce tests
Hi Joe,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on v4.16]
[also build test ERROR on next-20180410]
[cannot apply to linus/master jikos-livepatching/for-next]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Joe-Lawrence/selftests-livepatch-introduce-tests/20180411-093112
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All error/warnings (new ones prefixed by >>):
lib/livepatch/test_klp_shadow_vars.c:76:9: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:76:9: sparse: got "\001"
lib/livepatch/test_klp_shadow_vars.c:79:9: sparse: Trying to use reserved word 'return' as identifier
lib/livepatch/test_klp_shadow_vars.c:79:16: sparse: Expected ; at end of declaration
lib/livepatch/test_klp_shadow_vars.c:79:16: sparse: got ret
lib/livepatch/test_klp_shadow_vars.c:80:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:80:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:88:9: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:88:9: sparse: got "\001"
lib/livepatch/test_klp_shadow_vars.c:91:9: sparse: Trying to use reserved word 'return' as identifier
lib/livepatch/test_klp_shadow_vars.c:91:16: sparse: Expected ; at end of declaration
lib/livepatch/test_klp_shadow_vars.c:91:16: sparse: got ret
lib/livepatch/test_klp_shadow_vars.c:92:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:92:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:97:9: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:97:9: sparse: got "\001"
lib/livepatch/test_klp_shadow_vars.c:99:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:99:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:104:9: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:104:9: sparse: got "\001"
lib/livepatch/test_klp_shadow_vars.c:106:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:106:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:114:9: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:114:9: sparse: got "\001"
lib/livepatch/test_klp_shadow_vars.c:117:9: sparse: Trying to use reserved word 'return' as identifier
lib/livepatch/test_klp_shadow_vars.c:117:16: sparse: Expected ; at end of declaration
lib/livepatch/test_klp_shadow_vars.c:117:16: sparse: got 0
lib/livepatch/test_klp_shadow_vars.c:118:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:118:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:124:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:124:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:138:16: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:138:16: sparse: got 0
lib/livepatch/test_klp_shadow_vars.c:139:16: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:139:16: sparse: got &
lib/livepatch/test_klp_shadow_vars.c:140:16: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:140:16: sparse: got &
lib/livepatch/test_klp_shadow_vars.c:141:16: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:141:16: sparse: got &
lib/livepatch/test_klp_shadow_vars.c:142:16: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:142:16: sparse: got &
lib/livepatch/test_klp_shadow_vars.c:149:13: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:149:13: sparse: got !
lib/livepatch/test_klp_shadow_vars.c:149:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:164:17: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:164:17: sparse: got ==
lib/livepatch/test_klp_shadow_vars.c:164:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:168:17: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:168:17: sparse: got ==
lib/livepatch/test_klp_shadow_vars.c:168:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:172:17: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:172:17: sparse: got ==
lib/livepatch/test_klp_shadow_vars.c:172:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:182:17: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:182:17: sparse: got ==
lib/livepatch/test_klp_shadow_vars.c:182:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:192:13: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:192:13: sparse: got !
lib/livepatch/test_klp_shadow_vars.c:192:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:195:25: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:195:25: sparse: got +
lib/livepatch/test_klp_shadow_vars.c:197:13: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:197:13: sparse: got !
lib/livepatch/test_klp_shadow_vars.c:197:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:200:25: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:200:25: sparse: got +
lib/livepatch/test_klp_shadow_vars.c:202:13: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:202:13: sparse: got !
lib/livepatch/test_klp_shadow_vars.c:202:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:209:17: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:209:17: sparse: got ==
lib/livepatch/test_klp_shadow_vars.c:209:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:216:28: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:216:28: sparse: got +
lib/livepatch/test_klp_shadow_vars.c:218:13: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:218:13: sparse: got !
lib/livepatch/test_klp_shadow_vars.c:218:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:224:9: sparse: Trying to use reserved word 'return' as identifier
lib/livepatch/test_klp_shadow_vars.c:224:16: sparse: Expected ; at end of declaration
lib/livepatch/test_klp_shadow_vars.c:224:16: sparse: got 0
lib/livepatch/test_klp_shadow_vars.c:225:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:225:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:231:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:231:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:113:23: sparse: undefined identifier 'ctor_data'
lib/livepatch/test_klp_shadow_vars.c:148:26: sparse: undefined identifier 'obj'
lib/livepatch/test_klp_shadow_vars.c:148:9: sparse: symbol 'ret' redeclared with different type (originally declared at lib/livepatch/test_klp_shadow_vars.c:136) - different base types
lib/livepatch/test_klp_shadow_vars.c:155:28: sparse: undefined identifier 'obj'
lib/livepatch/test_klp_shadow_vars.c:155:9: sparse: symbol 'sv1' redeclared with different type (originally declared at lib/livepatch/test_klp_shadow_vars.c:134) - different base types
lib/livepatch/test_klp_shadow_vars.c:156:28: sparse: undefined identifier 'obj'
lib/livepatch/test_klp_shadow_vars.c:156:9: sparse: symbol 'sv2' redeclared with different type (originally declared at lib/livepatch/test_klp_shadow_vars.c:134) - different base types
lib/livepatch/test_klp_shadow_vars.c:157:28: sparse: undefined identifier 'obj'
lib/livepatch/test_klp_shadow_vars.c:157:9: sparse: symbol 'sv3' redeclared with different type (originally declared at lib/livepatch/test_klp_shadow_vars.c:134) - different base types
lib/livepatch/test_klp_shadow_vars.c:163:26: sparse: undefined identifier 'obj'
lib/livepatch/test_klp_shadow_vars.c:163:9: sparse: symbol 'ret' has multiple initializers (originally initialized at lib/livepatch/test_klp_shadow_vars.c:148)
lib/livepatch/test_klp_shadow_vars.c:163:9: sparse: symbol 'ret' redeclared with different type (originally declared at lib/livepatch/test_klp_shadow_vars.c:136) - different base types
lib/livepatch/test_klp_shadow_vars.c:167:26: sparse: undefined identifier 'obj'
lib/livepatch/test_klp_shadow_vars.c:167:9: sparse: symbol 'ret' has multiple initializers (originally initialized at lib/livepatch/test_klp_shadow_vars.c:163)
lib/livepatch/test_klp_shadow_vars.c:167:9: sparse: symbol 'ret' redeclared with different type (originally declared at lib/livepatch/test_klp_shadow_vars.c:136) - different base types
lib/livepatch/test_klp_shadow_vars.c:171:26: sparse: too many errors
>> lib/livepatch/test_klp_shadow_vars.c:72:6: error: unknown type name 'klp_shadow_ctor_t'
klp_shadow_ctor_t ctor, void *ctor_data)
^~~~~~~~~~~~~~~~~
lib/livepatch/test_klp_shadow_vars.c:83:23: error: unknown type name 'klp_shadow_ctor_t'
gfp_t gfp_flags, klp_shadow_ctor_t ctor,
^~~~~~~~~~~~~~~~~
>> lib/livepatch/test_klp_shadow_vars.c:94:47: error: unknown type name 'klp_shadow_dtor_t'
void shadow_free(void *obj, unsigned long id, klp_shadow_dtor_t dtor)
^~~~~~~~~~~~~~~~~
lib/livepatch/test_klp_shadow_vars.c:101:40: error: unknown type name 'klp_shadow_dtor_t'
void shadow_free_all(unsigned long id, klp_shadow_dtor_t dtor)
^~~~~~~~~~~~~~~~~
lib/livepatch/test_klp_shadow_vars.c: In function 'test_klp_shadow_vars_init':
>> lib/livepatch/test_klp_shadow_vars.c:155:8: error: implicit declaration of function 'shadow_alloc'; did you mean 'shadow_dtor'? [-Werror=implicit-function-declaration]
sv1 = shadow_alloc(obj, id, size, gfp_flags, shadow_ctor, &var1);
^~~~~~~~~~~~
shadow_dtor
>> lib/livepatch/test_klp_shadow_vars.c:155:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
sv1 = shadow_alloc(obj, id, size, gfp_flags, shadow_ctor, &var1);
^
lib/livepatch/test_klp_shadow_vars.c:156:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
sv2 = shadow_alloc(obj + 1, id, size, gfp_flags, shadow_ctor, &var2);
^
lib/livepatch/test_klp_shadow_vars.c:157:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
sv3 = shadow_alloc(obj, id + 1, size, gfp_flags, shadow_ctor, &var3);
^
>> lib/livepatch/test_klp_shadow_vars.c:180:8: error: implicit declaration of function 'shadow_get_or_alloc'; did you mean 'klp_shadow_get_or_alloc'? [-Werror=implicit-function-declaration]
sv4 = shadow_get_or_alloc(obj + 2, id, size, gfp_flags, shadow_ctor, &var4);
^~~~~~~~~~~~~~~~~~~
klp_shadow_get_or_alloc
lib/livepatch/test_klp_shadow_vars.c:180:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
sv4 = shadow_get_or_alloc(obj + 2, id, size, gfp_flags, shadow_ctor, &var4);
^
lib/livepatch/test_klp_shadow_vars.c:181:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
ret = shadow_get_or_alloc(obj + 2, id, size, gfp_flags, shadow_ctor, &var4);
^
>> lib/livepatch/test_klp_shadow_vars.c:190:2: error: implicit declaration of function 'shadow_free'; did you mean 'shadow_get'? [-Werror=implicit-function-declaration]
shadow_free(obj, id, shadow_dtor); /* sv1 */
^~~~~~~~~~~
shadow_get
>> lib/livepatch/test_klp_shadow_vars.c:216:2: error: implicit declaration of function 'shadow_free_all'; did you mean 'klp_shadow_free_all'? [-Werror=implicit-function-declaration]
shadow_free_all(id + 1, shadow_dtor); /* sv3 */
^~~~~~~~~~~~~~~
klp_shadow_free_all
In file included from lib/livepatch/test_klp_shadow_vars.c:6:0:
lib/livepatch/test_klp_shadow_vars.c: At top level:
include/linux/module.h:130:42: error: redefinition of '__inittest'
static inline initcall_t __maybe_unused __inittest(void) \
^
>> lib/livepatch/test_klp_shadow_vars.c:232:1: note: in expansion of macro 'module_init'
module_init(test_klp_shadow_vars_exit);
^~~~~~~~~~~
include/linux/module.h:130:42: note: previous definition of '__inittest' was here
static inline initcall_t __maybe_unused __inittest(void) \
^
lib/livepatch/test_klp_shadow_vars.c:231:1: note: in expansion of macro 'module_init'
module_init(test_klp_shadow_vars_init);
^~~~~~~~~~~
lib/livepatch/test_klp_shadow_vars.c: In function '__inittest':
>> lib/livepatch/test_klp_shadow_vars.c:232:13: error: return from incompatible pointer type [-Werror=incompatible-pointer-types]
module_init(test_klp_shadow_vars_exit);
^
include/linux/module.h:131:11: note: in definition of macro 'module_init'
{ return initfn; } \
^~~~~~
lib/livepatch/test_klp_shadow_vars.c: At top level:
include/linux/module.h:132:6: error: redefinition of 'init_module'
int init_module(void) __attribute__((alias(#initfn)));
^
>> lib/livepatch/test_klp_shadow_vars.c:232:1: note: in expansion of macro 'module_init'
module_init(test_klp_shadow_vars_exit);
^~~~~~~~~~~
include/linux/module.h:132:6: note: previous definition of 'init_module' was here
int init_module(void) __attribute__((alias(#initfn)));
^
lib/livepatch/test_klp_shadow_vars.c:231:1: note: in expansion of macro 'module_init'
module_init(test_klp_shadow_vars_init);
^~~~~~~~~~~
cc1: some warnings being treated as errors
sparse warnings: (new ones prefixed by >>)
lib/livepatch/test_klp_atomic_replace.c:46:14: sparse: no member 'replace' in struct klp_patch
>> lib/livepatch/test_klp_atomic_replace.c:46:14: sparse: generating address of non-lvalue (8)
lib/livepatch/test_klp_atomic_replace.c: In function 'test_klp_atomic_replace_init':
lib/livepatch/test_klp_atomic_replace.c:46:7: error: 'struct klp_patch' has no member named 'replace'
patch.replace = replace;
^
--
lib/livepatch/test_klp_callbacks_demo2.c:81:14: sparse: no member 'replace' in struct klp_patch
>> lib/livepatch/test_klp_callbacks_demo2.c:81:14: sparse: generating address of non-lvalue (8)
lib/livepatch/test_klp_callbacks_demo2.c: In function 'test_klp_callbacks_demo2_init':
lib/livepatch/test_klp_callbacks_demo2.c:81:7: error: 'struct klp_patch' has no member named 'replace'
patch.replace = replace;
^
--
lib/livepatch/test_klp_shadow_vars.c:72:38: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:72:38: sparse: got ctor
lib/livepatch/test_klp_shadow_vars.c:76:9: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:76:9: sparse: got "001"
>> lib/livepatch/test_klp_shadow_vars.c:79:9: sparse: Trying to use reserved word 'return' as identifier
lib/livepatch/test_klp_shadow_vars.c:79:16: sparse: Expected ; at end of declaration
lib/livepatch/test_klp_shadow_vars.c:79:16: sparse: got ret
lib/livepatch/test_klp_shadow_vars.c:80:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:80:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:88:9: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:88:9: sparse: got "001"
lib/livepatch/test_klp_shadow_vars.c:91:9: sparse: Trying to use reserved word 'return' as identifier
lib/livepatch/test_klp_shadow_vars.c:91:16: sparse: Expected ; at end of declaration
lib/livepatch/test_klp_shadow_vars.c:91:16: sparse: got ret
lib/livepatch/test_klp_shadow_vars.c:92:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:92:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:97:9: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:97:9: sparse: got "001"
lib/livepatch/test_klp_shadow_vars.c:99:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:99:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:104:9: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:104:9: sparse: got "001"
lib/livepatch/test_klp_shadow_vars.c:106:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:106:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:114:9: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:114:9: sparse: got "001"
lib/livepatch/test_klp_shadow_vars.c:117:9: sparse: Trying to use reserved word 'return' as identifier
lib/livepatch/test_klp_shadow_vars.c:117:16: sparse: Expected ; at end of declaration
lib/livepatch/test_klp_shadow_vars.c:117:16: sparse: got 0
lib/livepatch/test_klp_shadow_vars.c:118:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:118:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:124:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:124:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:138:16: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:138:16: sparse: got 0
lib/livepatch/test_klp_shadow_vars.c:139:16: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:139:16: sparse: got &
lib/livepatch/test_klp_shadow_vars.c:140:16: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:140:16: sparse: got &
lib/livepatch/test_klp_shadow_vars.c:141:16: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:141:16: sparse: got &
lib/livepatch/test_klp_shadow_vars.c:142:16: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:142:16: sparse: got &
lib/livepatch/test_klp_shadow_vars.c:149:13: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:149:13: sparse: got !
>> lib/livepatch/test_klp_shadow_vars.c:149:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:164:17: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:164:17: sparse: got ==
lib/livepatch/test_klp_shadow_vars.c:164:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:168:17: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:168:17: sparse: got ==
lib/livepatch/test_klp_shadow_vars.c:168:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:172:17: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:172:17: sparse: got ==
lib/livepatch/test_klp_shadow_vars.c:172:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:182:17: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:182:17: sparse: got ==
lib/livepatch/test_klp_shadow_vars.c:182:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:192:13: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:192:13: sparse: got !
lib/livepatch/test_klp_shadow_vars.c:192:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:195:25: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:195:25: sparse: got +
lib/livepatch/test_klp_shadow_vars.c:197:13: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:197:13: sparse: got !
lib/livepatch/test_klp_shadow_vars.c:197:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:200:25: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:200:25: sparse: got +
lib/livepatch/test_klp_shadow_vars.c:202:13: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:202:13: sparse: got !
lib/livepatch/test_klp_shadow_vars.c:202:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:209:17: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:209:17: sparse: got ==
lib/livepatch/test_klp_shadow_vars.c:209:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:216:28: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:216:28: sparse: got +
lib/livepatch/test_klp_shadow_vars.c:218:13: sparse: Expected ) in function declarator
lib/livepatch/test_klp_shadow_vars.c:218:13: sparse: got !
lib/livepatch/test_klp_shadow_vars.c:218:9: sparse: Trying to use reserved word 'if' as identifier
lib/livepatch/test_klp_shadow_vars.c:224:9: sparse: Trying to use reserved word 'return' as identifier
lib/livepatch/test_klp_shadow_vars.c:224:16: sparse: Expected ; at end of declaration
lib/livepatch/test_klp_shadow_vars.c:224:16: sparse: got 0
lib/livepatch/test_klp_shadow_vars.c:225:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:225:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:231:1: sparse: Expected ; at the end of type declaration
lib/livepatch/test_klp_shadow_vars.c:231:1: sparse: got }
lib/livepatch/test_klp_shadow_vars.c:113:23: sparse: undefined identifier 'ctor_data'
lib/livepatch/test_klp_shadow_vars.c:148:26: sparse: undefined identifier 'obj'
lib/livepatch/test_klp_shadow_vars.c:148:9: sparse: symbol 'ret' redeclared with different type (originally declared at lib/livepatch/test_klp_shadow_vars.c:136) - different base types
lib/livepatch/test_klp_shadow_vars.c:155:28: sparse: undefined identifier 'obj'
lib/livepatch/test_klp_shadow_vars.c:155:9: sparse: symbol 'sv1' redeclared with different type (originally declared at lib/livepatch/test_klp_shadow_vars.c:134) - different base types
lib/livepatch/test_klp_shadow_vars.c:156:28: sparse: undefined identifier 'obj'
lib/livepatch/test_klp_shadow_vars.c:156:9: sparse: symbol 'sv2' redeclared with different type (originally declared at lib/livepatch/test_klp_shadow_vars.c:134) - different base types
lib/livepatch/test_klp_shadow_vars.c:157:28: sparse: undefined identifier 'obj'
lib/livepatch/test_klp_shadow_vars.c:157:9: sparse: symbol 'sv3' redeclared with different type (originally declared at lib/livepatch/test_klp_shadow_vars.c:134) - different base types
lib/livepatch/test_klp_shadow_vars.c:163:26: sparse: undefined identifier 'obj'
lib/livepatch/test_klp_shadow_vars.c:163:9: sparse: symbol 'ret' has multiple initializers (originally initialized at lib/livepatch/test_klp_shadow_vars.c:148)
lib/livepatch/test_klp_shadow_vars.c:163:9: sparse: symbol 'ret' redeclared with different type (originally declared at lib/livepatch/test_klp_shadow_vars.c:136) - different base types
lib/livepatch/test_klp_shadow_vars.c:167:26: sparse: undefined identifier 'obj'
lib/livepatch/test_klp_shadow_vars.c:167:9: sparse: symbol 'ret' has multiple initializers (originally initialized at lib/livepatch/test_klp_shadow_vars.c:163)
lib/livepatch/test_klp_shadow_vars.c:167:9: sparse: symbol 'ret' redeclared with different type (originally declared at lib/livepatch/test_klp_shadow_vars.c:136) - different base types
>> lib/livepatch/test_klp_shadow_vars.c:171:26: sparse: too many errors
lib/livepatch/test_klp_shadow_vars.c:72:6: error: unknown type name 'klp_shadow_ctor_t'
klp_shadow_ctor_t ctor, void *ctor_data)
^~~~~~~~~~~~~~~~~
lib/livepatch/test_klp_shadow_vars.c:83:23: error: unknown type name 'klp_shadow_ctor_t'
gfp_t gfp_flags, klp_shadow_ctor_t ctor,
^~~~~~~~~~~~~~~~~
lib/livepatch/test_klp_shadow_vars.c:94:47: error: unknown type name 'klp_shadow_dtor_t'
void shadow_free(void *obj, unsigned long id, klp_shadow_dtor_t dtor)
^~~~~~~~~~~~~~~~~
lib/livepatch/test_klp_shadow_vars.c:101:40: error: unknown type name 'klp_shadow_dtor_t'
void shadow_free_all(unsigned long id, klp_shadow_dtor_t dtor)
^~~~~~~~~~~~~~~~~
lib/livepatch/test_klp_shadow_vars.c: In function 'test_klp_shadow_vars_init':
lib/livepatch/test_klp_shadow_vars.c:155:8: error: implicit declaration of function 'shadow_alloc'; did you mean 'shadow_dtor'? [-Werror=implicit-function-declaration]
sv1 = shadow_alloc(obj, id, size, gfp_flags, shadow_ctor, &var1);
^~~~~~~~~~~~
shadow_dtor
lib/livepatch/test_klp_shadow_vars.c:155:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
sv1 = shadow_alloc(obj, id, size, gfp_flags, shadow_ctor, &var1);
^
lib/livepatch/test_klp_shadow_vars.c:156:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
sv2 = shadow_alloc(obj + 1, id, size, gfp_flags, shadow_ctor, &var2);
^
lib/livepatch/test_klp_shadow_vars.c:157:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
sv3 = shadow_alloc(obj, id + 1, size, gfp_flags, shadow_ctor, &var3);
^
lib/livepatch/test_klp_shadow_vars.c:180:8: error: implicit declaration of function 'shadow_get_or_alloc'; did you mean 'klp_shadow_get_or_alloc'? [-Werror=implicit-function-declaration]
sv4 = shadow_get_or_alloc(obj + 2, id, size, gfp_flags, shadow_ctor, &var4);
^~~~~~~~~~~~~~~~~~~
klp_shadow_get_or_alloc
lib/livepatch/test_klp_shadow_vars.c:180:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
sv4 = shadow_get_or_alloc(obj + 2, id, size, gfp_flags, shadow_ctor, &var4);
^
lib/livepatch/test_klp_shadow_vars.c:181:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
ret = shadow_get_or_alloc(obj + 2, id, size, gfp_flags, shadow_ctor, &var4);
^
lib/livepatch/test_klp_shadow_vars.c:190:2: error: implicit declaration of function 'shadow_free'; did you mean 'shadow_get'? [-Werror=implicit-function-declaration]
shadow_free(obj, id, shadow_dtor); /* sv1 */
^~~~~~~~~~~
shadow_get
lib/livepatch/test_klp_shadow_vars.c:216:2: error: implicit declaration of function 'shadow_free_all'; did you mean 'klp_shadow_free_all'? [-Werror=implicit-function-declaration]
shadow_free_all(id + 1, shadow_dtor); /* sv3 */
^~~~~~~~~~~~~~~
klp_shadow_free_all
In file included from lib/livepatch/test_klp_shadow_vars.c:6:0:
lib/livepatch/test_klp_shadow_vars.c: At top level:
include/linux/module.h:130:42: error: redefinition of '__inittest'
static inline initcall_t __maybe_unused __inittest(void) 151- ^
lib/livepatch/test_klp_shadow_vars.c:232:1: note: in expansion of macro 'module_init'
module_init(test_klp_shadow_vars_exit);
^~~~~~~~~~~
include/linux/module.h:130:42: note: previous definition of '__inittest' was here
static inline initcall_t __maybe_unused __inittest(void) 157- ^
lib/livepatch/test_klp_shadow_vars.c:231:1: note: in expansion of macro 'module_init'
module_init(test_klp_shadow_vars_init);
^~~~~~~~~~~
lib/livepatch/test_klp_shadow_vars.c: In function '__inittest':
lib/livepatch/test_klp_shadow_vars.c:232:13: error: return from incompatible pointer type [-Werror=incompatible-pointer-types]
module_init(test_klp_shadow_vars_exit);
^
include/linux/module.h:131:11: note: in definition of macro 'module_init'
{ return initfn; } 167- ^~~~~~
lib/livepatch/test_klp_shadow_vars.c: At top level:
include/linux/module.h:132:6: error: redefinition of 'init_module'
int init_module(void) __attribute__((alias(#initfn)));
^
lib/livepatch/test_klp_shadow_vars.c:232:1: note: in expansion of macro 'module_init'
module_init(test_klp_shadow_vars_exit);
^~~~~~~~~~~
include/linux/module.h:132:6: note: previous definition of 'init_module' was here
int init_module(void) __attribute__((alias(#initfn)));
^
lib/livepatch/test_klp_shadow_vars.c:231:1: note: in expansion of macro 'module_init'
module_init(test_klp_shadow_vars_init);
^~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/klp_shadow_ctor_t +72 lib/livepatch/test_klp_shadow_vars.c
70
71 void *shadow_alloc(void *obj, unsigned long id, size_t size, gfp_t gfp_flags,
> 72 klp_shadow_ctor_t ctor, void *ctor_data)
73 {
74 void *ret = klp_shadow_alloc(obj, id, size, gfp_flags, ctor,
75 ctor_data);
76 pr_info("klp_%s(obj=PTR%d, id=0x%lx, size=%zx, gfp_flags=%pGg), ctor=PTR%d, ctor_data=PTR%d = PTR%d\n",
77 __func__, ptr_id(obj), id, size, &gfp_flags, ptr_id(ctor),
78 ptr_id(ctor_data), ptr_id(ret));
> 79 return ret;
80 }
81
82 void *shadow_get_or_alloc(void *obj, unsigned long id, size_t size,
83 gfp_t gfp_flags, klp_shadow_ctor_t ctor,
84 void *ctor_data)
85 {
86 void *ret = klp_shadow_get_or_alloc(obj, id, size, gfp_flags, ctor,
87 ctor_data);
88 pr_info("klp_%s(obj=PTR%d, id=0x%lx, size=%zx, gfp_flags=%pGg), ctor=PTR%d, ctor_data=PTR%d = PTR%d\n",
89 __func__, ptr_id(obj), id, size, &gfp_flags, ptr_id(ctor),
90 ptr_id(ctor_data), ptr_id(ret));
91 return ret;
92 }
93
> 94 void shadow_free(void *obj, unsigned long id, klp_shadow_dtor_t dtor)
95 {
96 klp_shadow_free(obj, id, dtor);
97 pr_info("klp_%s(obj=PTR%d, id=0x%lx, dtor=PTR%d)\n",
98 __func__, ptr_id(obj), id, ptr_id(dtor));
99 }
100
> 101 void shadow_free_all(unsigned long id, klp_shadow_dtor_t dtor)
102 {
103 klp_shadow_free_all(id, dtor);
104 pr_info("klp_%s(id=0x%lx, dtor=PTR%d)\n",
105 __func__, id, ptr_id(dtor));
106 }
107
108
109 /* Shadow variable constructor - remember simple pointer data */
110 static int shadow_ctor(void *obj, void *shadow_data, void *ctor_data)
111 {
112 int **shadow_int = shadow_data;
113 *shadow_int = ctor_data;
114 pr_info("%s: PTR%d -> PTR%d\n",
115 __func__, ptr_id(shadow_int), ptr_id(ctor_data));
116
117 return 0;
118 }
119
120 static void shadow_dtor(void *obj, void *shadow_data)
121 {
122 pr_info("%s(obj=PTR%d, shadow_data=PTR%d)\n",
123 __func__, ptr_id(obj), ptr_id(shadow_data));
124 }
125
126 static int test_klp_shadow_vars_init(void)
127 {
128 void *obj = THIS_MODULE;
129 int id = 0x1234;
130 size_t size = sizeof(int *);
131 gfp_t gfp_flags = GFP_KERNEL;
132
133 int var1, var2, var3, var4;
134 int **sv1, **sv2, **sv3, **sv4;
135
136 void *ret;
137
138 ptr_id(0);
> 139 ptr_id(&var1);
140 ptr_id(&var2);
141 ptr_id(&var3);
142 ptr_id(&var4);
143
144 /*
145 * With an empty shadow variable hash table, expect not to find
146 * any matches.
147 */
148 ret = shadow_get(obj, id);
> 149 if (!ret)
150 pr_info(" got expected NULL result\n");
151
152 /*
153 * Allocate a few shadow variables with different <obj> and <id>.
154 */
> 155 sv1 = shadow_alloc(obj, id, size, gfp_flags, shadow_ctor, &var1);
> 156 sv2 = shadow_alloc(obj + 1, id, size, gfp_flags, shadow_ctor, &var2);
> 157 sv3 = shadow_alloc(obj, id + 1, size, gfp_flags, shadow_ctor, &var3);
158
159 /*
160 * Verify we can find our new shadow variables and that they point
161 * to expected data.
162 */
163 ret = shadow_get(obj, id);
164 if (ret == sv1 && *sv1 == &var1)
165 pr_info(" got expected PTR%d -> PTR%d result\n",
166 ptr_id(sv1), ptr_id(*sv1));
> 167 ret = shadow_get(obj + 1, id);
168 if (ret == sv2 && *sv2 == &var2)
169 pr_info(" got expected PTR%d -> PTR%d result\n",
170 ptr_id(sv2), ptr_id(*sv2));
> 171 ret = shadow_get(obj, id + 1);
172 if (ret == sv3 && *sv3 == &var3)
173 pr_info(" got expected PTR%d -> PTR%d result\n",
174 ptr_id(sv3), ptr_id(*sv3));
175
176 /*
177 * Allocate or get a few more, this time with the same <obj>, <id>.
178 * The second invocation should return the same shadow var.
179 */
> 180 sv4 = shadow_get_or_alloc(obj + 2, id, size, gfp_flags, shadow_ctor, &var4);
> 181 ret = shadow_get_or_alloc(obj + 2, id, size, gfp_flags, shadow_ctor, &var4);
182 if (ret == sv4 && *sv4 == &var4)
183 pr_info(" got expected PTR%d -> PTR%d result\n",
184 ptr_id(sv4), ptr_id(*sv4));
185
186 /*
187 * Free the <obj=*, id> shadow variables and check that we can no
188 * longer find them.
189 */
> 190 shadow_free(obj, id, shadow_dtor); /* sv1 */
191 ret = shadow_get(obj, id);
192 if (!ret)
193 pr_info(" got expected NULL result\n");
194
195 shadow_free(obj + 1, id, shadow_dtor); /* sv2 */
196 ret = shadow_get(obj + 1, id);
197 if (!ret)
198 pr_info(" got expected NULL result\n");
199
200 shadow_free(obj + 2, id, shadow_dtor); /* sv4 */
201 ret = shadow_get(obj + 2, id);
202 if (!ret)
203 pr_info(" got expected NULL result\n");
204
205 /*
206 * We should still find an <id+1> variable.
207 */
208 ret = shadow_get(obj, id + 1);
209 if (ret == sv3 && *sv3 == &var3)
210 pr_info(" got expected PTR%d -> PTR%d result\n",
211 ptr_id(sv3), ptr_id(*sv3));
212
213 /*
214 * Free all the <id+1> variables, too.
215 */
> 216 shadow_free_all(id + 1, shadow_dtor); /* sv3 */
217 ret = shadow_get(obj, id);
218 if (!ret)
219 pr_info(" shadow_get() got expected NULL result\n");
220
221
222 free_ptr_list();
223
224 return 0;
225 }
226
227 static void test_klp_shadow_vars_exit(void)
228 {
229 }
230
> 231 module_init(test_klp_shadow_vars_init);
> 232 module_init(test_klp_shadow_vars_exit);
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Download attachment ".config.gz" of type "application/gzip" (62852 bytes)
Powered by blists - more mailing lists