Line data Source code
1 :
2 : struct device;
3 :
4 : void *ldv_dev_get_drvdata(const struct device *dev);
5 : int ldv_dev_set_drvdata(struct device *dev, void *data);
6 :
7 : struct spi_master;
8 : struct device;
9 : struct spi_master *ldv_spi_alloc_master(struct device *host, unsigned size);
10 :
11 : #include <linux/ldv/err.h>
12 :
13 : #include <linux/types.h>
14 : void *ldv_kzalloc(size_t size, gfp_t flags);
15 :
16 : struct clk;
17 :
18 : extern void ldv_clk_disable(struct clk *clk);
19 : extern int ldv_clk_enable(void);
20 :
21 : #include <linux/ldv/common.h>
22 : #include <linux/ldv/irq.h>
23 : #include <verifier/common.h>
24 : #include <verifier/nondet.h>
25 : #include <verifier/memory.h>
26 : #include <verifier/thread.h>
27 :
28 : #include <linux/timer.h>
29 :
30 :
31 : struct ldv_struct_insmod_3 {
32 : int signal_pending;
33 : };
34 :
35 : struct ldv_struct_timer_scenario_1 {
36 : struct timer_list *arg0;
37 : int signal_pending;
38 : };
39 :
40 : /* EMG Function declarations */
41 : void ldv_dispatch_default_deregister_3_3_4(void);
42 : void ldv_dispatch_default_register_3_3_5(void);
43 : void ldv_dispatch_insmod_deregister_5_2(void);
44 : void ldv_dispatch_insmod_register_5_3(void);
45 : extern void ldv_dispatch_instance_deregister_4_1(struct timer_list *);
46 : void ldv_dispatch_instance_register_2_4(struct timer_list *);
47 : extern int ldv_emg_del_timer_sync(struct timer_list *);
48 : void ldv_factory_scenario_2(void *);
49 : void ldv_insmod_3(void *);
50 : void ldv_insmod_journal_exit_3_2(void (*)(void));
51 : int ldv_insmod_journal_init_3_9(int (*)(void));
52 : void ldv_main_5(void *);
53 : void ldv_timer_scenario_1(void *);
54 : void ldv_timer_scenario_callback_1_2(void (*)(unsigned long), unsigned long);
55 : int main(void);
56 :
57 : /* EMG variable declarations */
58 1 : struct ldv_thread ldv_thread_1;
59 1 : struct ldv_thread ldv_thread_2;
60 1 : struct ldv_thread ldv_thread_3;
61 1 : struct ldv_thread ldv_thread_5;
62 :
63 : /* EMG variable initialization */
64 :
65 : /* EMG function definitions */
66 : /* AUX_FUNC ldv_dispatch_default_deregister_3_3_4 */
67 : void ldv_dispatch_default_deregister_3_3_4() {
68 : struct ldv_struct_insmod_3 *cf_arg_2;
69 : /* Skip thread join call */
70 1 : return;
71 : }
72 :
73 : /* AUX_FUNC ldv_dispatch_default_register_3_3_5 */
74 : void ldv_dispatch_default_register_3_3_5() {
75 : struct ldv_struct_insmod_3 *cf_arg_2;
76 4 : cf_arg_2 = ldv_xmalloc(sizeof(struct ldv_struct_insmod_3));
77 3 : ldv_factory_scenario_2(cf_arg_2);
78 1 : return;
79 : }
80 :
81 : /* AUX_FUNC ldv_dispatch_insmod_deregister_5_2 */
82 : void ldv_dispatch_insmod_deregister_5_2() {
83 : struct ldv_struct_insmod_3 *cf_arg_3;
84 : /* Skip thread join call */
85 1 : return;
86 : }
87 :
88 : /* AUX_FUNC ldv_dispatch_insmod_register_5_3 */
89 : void ldv_dispatch_insmod_register_5_3() {
90 : struct ldv_struct_insmod_3 *cf_arg_3;
91 4 : cf_arg_3 = ldv_xmalloc(sizeof(struct ldv_struct_insmod_3));
92 4 : ldv_insmod_3(cf_arg_3);
93 1 : return;
94 : }
95 :
96 : /* AUX_FUNC ldv_dispatch_instance_register_2_4 */
97 : void ldv_dispatch_instance_register_2_4(struct timer_list *arg0) {
98 : struct ldv_struct_timer_scenario_1 *cf_arg_1;
99 4 : cf_arg_1 = ldv_xmalloc(sizeof(struct ldv_struct_timer_scenario_1));
100 2 : cf_arg_1->arg0 = arg0;
101 4 : ldv_timer_scenario_1(cf_arg_1);
102 1 : return;
103 : }
104 :
105 : /* AUX_FUNC ldv_factory_scenario_2 */
106 : void ldv_factory_scenario_2(void *arg0) {
107 : /* LDV {"thread": 2, "type": "CONTROL_FUNCTION_BEGIN", "comment": "Control function 'factory_scenario(timer)'", "function": "ldv_factory_scenario_2"} */
108 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
109 1 : struct timer_list *ldv_2_container_timer_list;
110 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
111 : /* LDV {"action": "DEFAULT_REGISTER_3", "type": "RECEIVE_BEGIN", "comment": "Proceed to TIMER callbacks invocations scenarios."} */
112 2 : ldv_free(arg0);
113 : /* LDV {"action": "DEFAULT_REGISTER_3", "type": "RECEIVE_END"} */
114 :
115 : /* LDV {"action": "DEFAULT_ALLOC_3", "type": "CONDITION_BEGIN", "comment": "Allocate memory after default registration."} */
116 3 : ldv_2_container_timer_list = ldv_xmalloc_unknown_size(0);
117 : /* LDV {"action": "DEFAULT_ALLOC_3", "type": "CONDITION_END"} */
118 :
119 : /* LDV {"action": "INSTANCE_REGISTER", "type": "DISPATCH_BEGIN", "comment": "Initiate scenario for TIMER callbacks invocations"} */
120 2 : ldv_dispatch_instance_register_2_4(ldv_2_container_timer_list);
121 : /* LDV {"action": "INSTANCE_REGISTER", "type": "DISPATCH_END"} */
122 :
123 : /* LDV {"action": "INSTANCE_DEREGISTER", "type": "DISPATCH_BEGIN", "comment": "Skip the action, since no callbacks has been found."} */
124 : /* Dispatch 'instance_deregister' is not expected by any process, skipping the action */
125 : /* Skip the dispatch because there is no process to receive the signal */
126 : /* LDV {"action": "INSTANCE_DEREGISTER", "type": "DISPATCH_END"} */
127 :
128 : /* LDV {"action": "DEFAULT_FREE_3", "type": "CONDITION_BEGIN", "comment": "Free memory before default deregistration."} */
129 2 : ldv_free(ldv_2_container_timer_list);
130 : /* LDV {"action": "DEFAULT_FREE_3", "type": "CONDITION_END"} */
131 :
132 : /* LDV {"action": "DEFAULT_DEREGISTER_3", "type": "RECEIVE_BEGIN", "comment": "Finish TIMER callbacks invocations scenarios."} */
133 : /* Skip a non-replicative signal receiving */
134 : /* LDV {"action": "DEFAULT_DEREGISTER_3", "type": "RECEIVE_END"} */
135 :
136 : /* Exit function at a terminal state */
137 1 : return;
138 : /* End of the process */
139 : return;
140 : /* LDV {"comment": "End of control function based on process 'factory_scenario(timer)'", "type": "CONTROL_FUNCTION_END", "function": "ldv_factory_scenario_2"} */
141 : }
142 :
143 : /* AUX_FUNC ldv_insmod_3 */
144 : void ldv_insmod_3(void *arg0) {
145 : /* LDV {"thread": 3, "type": "CONTROL_FUNCTION_BEGIN", "comment": "Control function 'insmod(artificial)'", "function": "ldv_insmod_3"} */
146 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
147 1 : void (*ldv_3_journal_exit_default)(void);
148 1 : int (*ldv_3_journal_init_default)(void);
149 1 : int ldv_3_ret_default;
150 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
151 : /* LDV {"action": "INSMOD_REGISTER", "type": "RECEIVE_BEGIN", "comment": "Trigger module initialization."} */
152 2 : ldv_free(arg0);
153 : /* LDV {"action": "INSMOD_REGISTER", "type": "RECEIVE_END"} */
154 :
155 : /* LDV {"action": "JOURNAL_INIT", "type": "CALL_BEGIN", "callback": true, "comment": "Initialize the module after insmod with 'journal_init' function. Invoke callback journal_init from ARTIFICIAL."} */
156 : /* LDV {"type": "CALLBACK", "call": "ldv_3_ret_default = (journal_init)();", "comment": "journal_init"} */
157 2 : ldv_3_ret_default = ldv_insmod_journal_init_3_9(ldv_3_journal_init_default);
158 : /* Callback post-call */
159 2 : ldv_3_ret_default = ldv_post_init(ldv_3_ret_default);
160 : /* LDV {"action": "JOURNAL_INIT", "type": "CALL_END"} */
161 :
162 4 : if (ldv_undef_int()) {
163 : /* LDV {"action": "INIT_FAILED", "type": "CONDITION_BEGIN", "comment": "Failed to initialize the module."} */
164 2 : ldv_assume(ldv_3_ret_default != 0);
165 : /* LDV {"action": "INIT_FAILED", "type": "CONDITION_END"} */
166 :
167 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "RECEIVE_BEGIN", "comment": "Trigger module exit."} */
168 : /* Skip a non-replicative signal receiving */
169 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "RECEIVE_END"} */
170 :
171 : /* Exit function at a terminal state */
172 1 : return;
173 : }
174 : else {
175 : /* LDV {"action": "INIT_SUCCESS", "type": "CONDITION_BEGIN", "comment": "Module has been initialized."} */
176 2 : ldv_assume(ldv_3_ret_default == 0);
177 : /* LDV {"action": "INIT_SUCCESS", "type": "CONDITION_END"} */
178 :
179 4 : if (ldv_undef_int()) {
180 : /* LDV {"action": "DEFAULT_REGISTER_3", "type": "DISPATCH_BEGIN", "comment": "Register 'TIMER' callbacks with unknown registration function."} */
181 2 : ldv_dispatch_default_register_3_3_5();
182 : /* LDV {"action": "DEFAULT_REGISTER_3", "type": "DISPATCH_END"} */
183 :
184 : /* LDV {"action": "DEFAULT_DEREGISTER_3", "type": "DISPATCH_BEGIN", "comment": "Deregister 'TIMER' callbacks with unknown deregistration function."} */
185 2 : ldv_dispatch_default_deregister_3_3_4();
186 : /* LDV {"action": "DEFAULT_DEREGISTER_3", "type": "DISPATCH_END"} */
187 :
188 : }
189 : else {
190 : /* LDV {"action": "NONE", "type": "CONDITION_BEGIN", "comment": "Skip default callbacks registrations and deregistrations."} */
191 : /* LDV {"action": "NONE", "type": "CONDITION_END"} */
192 :
193 : }
194 : /* LDV {"action": "JOURNAL_EXIT", "type": "CALL_BEGIN", "callback": true, "comment": "Exit the module before its unloading with 'journal_exit' function. Invoke callback journal_exit from ARTIFICIAL."} */
195 : /* LDV {"type": "CALLBACK", "call": "(journal_exit)();", "comment": "journal_exit"} */
196 4 : ldv_insmod_journal_exit_3_2(ldv_3_journal_exit_default);
197 : /* LDV {"action": "JOURNAL_EXIT", "type": "CALL_END"} */
198 :
199 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "RECEIVE_BEGIN", "comment": "Trigger module exit."} */
200 : /* Skip a non-replicative signal receiving */
201 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "RECEIVE_END"} */
202 :
203 : /* Exit function at a terminal state */
204 1 : return;
205 : }
206 : /* End of the process */
207 : return;
208 : /* LDV {"comment": "End of control function based on process 'insmod(artificial)'", "type": "CONTROL_FUNCTION_END", "function": "ldv_insmod_3"} */
209 : }
210 :
211 : /* AUX_FUNC_CALLBACK ldv_insmod_journal_exit_3_2 */
212 : void ldv_insmod_journal_exit_3_2(void (*arg0)(void)) {
213 4 : (journal_exit)();
214 2 : }
215 :
216 : /* AUX_FUNC_CALLBACK ldv_insmod_journal_init_3_9 */
217 : int ldv_insmod_journal_init_3_9(int (*arg0)(void)) {
218 3 : return (journal_init)();
219 1 : }
220 :
221 : /* AUX_FUNC ldv_main_5 */
222 : void ldv_main_5(void *arg0) {
223 : /* LDV {"thread": 5, "type": "CONTROL_FUNCTION_BEGIN", "comment": "Control function 'main(main)'", "function": "ldv_main_5"} */
224 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
225 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
226 : /* LDV {"action": "INIT", "type": "CONDITION_BEGIN", "comment": "Initialize rule models."} */
227 1 : ldv_initialize();
228 : /* LDV {"action": "INIT", "type": "CONDITION_END"} */
229 :
230 : /* LDV {"action": "INSMOD_REGISTER", "type": "DISPATCH_BEGIN", "comment": "Start environment model scenarios."} */
231 2 : ldv_dispatch_insmod_register_5_3();
232 : /* LDV {"action": "INSMOD_REGISTER", "type": "DISPATCH_END"} */
233 :
234 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "DISPATCH_BEGIN", "comment": "Stop environment model scenarios."} */
235 2 : ldv_dispatch_insmod_deregister_5_2();
236 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "DISPATCH_END"} */
237 :
238 : /* LDV {"action": "FINAL", "type": "CONDITION_BEGIN", "comment": "Check rule model state at the exit."} */
239 1 : ldv_check_final_state();
240 1 : ldv_stop();
241 : /* LDV {"action": "FINAL", "type": "CONDITION_END"} */
242 :
243 : /* Exit function at a terminal state */
244 0 : return;
245 : /* End of the process */
246 : return;
247 : /* LDV {"comment": "End of control function based on process 'main(main)'", "type": "CONTROL_FUNCTION_END", "function": "ldv_main_5"} */
248 : }
249 :
250 : /* AUX_FUNC ldv_timer_scenario_1 */
251 : void ldv_timer_scenario_1(void *arg0) {
252 : /* LDV {"thread": 1, "type": "CONTROL_FUNCTION_BEGIN", "comment": "Control function 'timer_scenario(timer)'", "function": "ldv_timer_scenario_1"} */
253 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
254 1 : struct timer_list *ldv_1_container_timer_list;
255 : /* Received labels */
256 1 : struct ldv_struct_timer_scenario_1 *data = (struct ldv_struct_timer_scenario_1*) arg0;
257 :
258 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
259 : /* LDV {"action": "INSTANCE_REGISTER", "type": "RECEIVE_BEGIN", "comment": "Begin TIMER callbacks invocations scenario."} */
260 : /* Assign recieved labels */
261 2 : if (data) {
262 1 : ldv_1_container_timer_list = data->arg0;
263 2 : ldv_free(data);
264 : }
265 : /* LDV {"action": "INSTANCE_REGISTER", "type": "RECEIVE_END"} */
266 :
267 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Time has come: call the timer callback. Invoke callback callback from TIMER."} */
268 : /* Callback pre-call */
269 2 : ldv_switch_to_interrupt_context();
270 6 : if (ldv_1_container_timer_list->function) {
271 : /* LDV {"type": "CALLBACK", "call": "(ldv_1_container_timer_list->function)(ldv_1_container_timer_list->data);", "comment": "callback"} */
272 4 : ldv_timer_scenario_callback_1_2(ldv_1_container_timer_list->function, ldv_1_container_timer_list->data);
273 : }
274 : /* Callback post-call */
275 3 : ldv_switch_to_process_context();
276 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
277 :
278 : /* LDV {"action": "INSTANCE_DEREGISTER", "type": "RECEIVE_BEGIN", "comment": "Finish TIMER callbacks invocations scenario."} */
279 : /* Skip a non-replicative signal receiving */
280 : /* LDV {"action": "INSTANCE_DEREGISTER", "type": "RECEIVE_END"} */
281 :
282 : /* Exit function at a terminal state */
283 3 : return;
284 : /* End of the process */
285 : return;
286 : /* LDV {"comment": "End of control function based on process 'timer_scenario(timer)'", "type": "CONTROL_FUNCTION_END", "function": "ldv_timer_scenario_1"} */
287 : }
288 :
289 : /* AUX_FUNC_CALLBACK ldv_timer_scenario_callback_1_2 */
290 : void ldv_timer_scenario_callback_1_2(void (*arg0)(unsigned long), unsigned long arg1) {
291 4 : (*arg0)(arg1);
292 2 : }
293 :
294 : /* AUX_FUNC main */
295 : int main() {
296 1 : ldv_main_5(0);
297 0 : return 0;
298 : }
299 :
300 :
301 : /* AUX_FUNC ERR_PTR */
302 : static inline void *ERR_PTR (long int error)
303 : {
304 :
305 : return ldv_err_ptr(error);
306 : }
307 :
308 : /* AUX_FUNC PTR_ERR */
309 : static inline long int PTR_ERR (void const *ptr)
310 : {
311 :
312 : return ldv_ptr_err(ptr);
313 : }
314 :
315 : /* AUX_FUNC IS_ERR */
316 : static inline long int IS_ERR (void const *ptr)
317 : {
318 :
319 : return ldv_is_err(ptr);
320 : }
321 :
322 : /* AUX_FUNC IS_ERR_OR_NULL */
323 : static inline long int IS_ERR_OR_NULL (void const *ptr)
324 : {
325 :
326 : return ldv_is_err_or_null(ptr);
327 : }
328 :
329 : /* AUX_FUNC ldv_del_timer_sync_5 */
330 : int ldv_del_timer_sync_5 (struct timer_list *ldv_func_arg1)
331 : {
332 :
333 : /* LDV {"type": "KERNEL_MODEL", "comment": "Perform the model code of the function 'del_timer_sync'"} */
334 : return ldv_emg_del_timer_sync(ldv_func_arg1);
335 : }
336 :
337 : /* AUX_FUNC kzalloc */
338 : static inline void *kzalloc (size_t size, gfp_t flags)
339 : {
340 :
341 : return ldv_kzalloc(size, flags);
342 : }
343 :
344 : /* AUX_FUNC ldv_del_timer_sync_7 */
345 : int ldv_del_timer_sync_7 (struct timer_list *ldv_func_arg1)
346 : {
347 0 :
348 : /* LDV {"type": "KERNEL_MODEL", "comment": "Perform the model code of the function 'del_timer_sync'"} */
349 0 : return ldv_emg_del_timer_sync(ldv_func_arg1);
350 : }
351 :
352 : /* AUX_FUNC ldv_del_timer_sync_8 */
353 : int ldv_del_timer_sync_8 (struct timer_list *ldv_func_arg1)
354 : {
355 0 :
356 : /* LDV {"type": "KERNEL_MODEL", "comment": "Perform the model code of the function 'del_timer_sync'"} */
357 0 : return ldv_emg_del_timer_sync(ldv_func_arg1);
358 : }
|