@@ -385,3 +385,42 @@ __CPROVER_HIDE:;
385
385
// Thus, modelling it as non-deterministic.
386
386
return retval ;
387
387
}
388
+
389
+ /* FUNCTION: syscall */
390
+
391
+ #ifndef __CPROVER_ERRNO_H_INCLUDED
392
+ # include <errno.h>
393
+ # define __CPROVER_ERRNO_H_INCLUDED
394
+ #endif
395
+
396
+ long int __VERIFIER_nondet_long_int (void );
397
+ int __VERIFIER_nondet_int (void );
398
+
399
+ long int syscall (long int sysno , ...);
400
+
401
+ // This overapproximation is based on the syscall specification available at
402
+ // https://man7.org/linux/man-pages/man2/syscall.2.html and
403
+ // https://www.gnu.org/software/libc/manual/html_node/System-Calls.html.
404
+ //
405
+ // sysno is the system call number. The remaining arguments are the arguments
406
+ // for the system call. Each kind of system call has a definite number of
407
+ // arguments, from zero to five. If you code more arguments than the system
408
+ // call takes, the extra ones to the right are ignored.
409
+ long int syscall (long int sysno , ...)
410
+ {
411
+ __CPROVER_HIDE :;
412
+ (void )sysno ;
413
+ long int retval = __VERIFIER_nondet_long_int ();
414
+
415
+ if (retval == -1 )
416
+ {
417
+ // We should keep errno as non-deterministic as possible, since this model
418
+ // never takes into account any input.
419
+ errno = __VERIFIER_nondet_int ();
420
+ }
421
+
422
+ // The return value is the return value from the system call, unless the
423
+ // system call failed. This over-approximation doesn't take into account
424
+ // any system call operation, so we leave the return value as non-det.
425
+ return retval ;
426
+ }
0 commit comments