Skip to content

Commit

Permalink
[syzkaller] Attempted fix for google/syzkaller#399
Browse files Browse the repository at this point in the history
syzkaller was failing to extract constants because of the above mentioned issue so I had to redeclare printf in sys/sys/systm.h
For more information on syzkaller, visit: https://github.com/google/syzkaller
  • Loading branch information
utkarsh009 committed Oct 27, 2017
1 parent 56d7239 commit 57996ef
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 32 deletions.
6 changes: 3 additions & 3 deletions sys/arch/x86/x86/intr.c
@@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.103 2017/09/03 06:24:49 cherry Exp $ */
/* $NetBSD: intr.c,v 1.104 2017/10/27 09:59:16 utkarsh009 Exp $ */

/*-
* Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -133,7 +133,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.103 2017/09/03 06:24:49 cherry Exp $");
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.104 2017/10/27 09:59:16 utkarsh009 Exp $");

#include "opt_intrdebug.h"
#include "opt_multiprocessor.h"
Expand Down Expand Up @@ -1374,7 +1374,7 @@ intr_printconfig(void)
CPU_INFO_ITERATOR cii;
void (*pr)(const char *, ...);

pr = printf;
pr = (void *)printf;
#ifdef DDB
extern int db_active;
if (db_active) {
Expand Down
4 changes: 2 additions & 2 deletions sys/ddb/db_interface.h
@@ -1,4 +1,4 @@
/* $NetBSD: db_interface.h,v 1.33 2017/01/04 21:25:41 christos Exp $ */
/* $NetBSD: db_interface.h,v 1.34 2017/10/27 09:59:16 utkarsh009 Exp $ */

/*-
* Copyright (c) 1995 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -75,6 +75,6 @@ void db_show_all_vmems(db_expr_t, bool, db_expr_t, const char *);

#define db_stacktrace() \
db_stack_trace_print((db_expr_t)(intptr_t)__builtin_frame_address(0), \
true, 65535, "", printf)
true, 65535, "", (void *)printf)

#endif /* _DDB_DB_INTERFACE_H_ */
4 changes: 2 additions & 2 deletions sys/ddb/db_panic.c
Expand Up @@ -25,7 +25,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: db_panic.c,v 1.3 2014/01/22 15:20:40 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: db_panic.c,v 1.4 2017/10/27 09:59:16 utkarsh009 Exp $");

#include <sys/types.h>
#include <sys/cpu.h>
Expand All @@ -52,7 +52,7 @@ void db_panic(void)
cpu_index(curcpu()));
db_stack_trace_print(
(db_expr_t)(intptr_t)__builtin_frame_address(0),
true, 65535, "", printf);
true, 65535, "", (void *)printf);
printf("cpu%u: End traceback...\n",
cpu_index(curcpu()));
intrace = 0;
Expand Down
6 changes: 3 additions & 3 deletions sys/kern/init_main.c
@@ -1,4 +1,4 @@
/* $NetBSD: init_main.c,v 1.490 2017/01/16 09:28:40 ryo Exp $ */
/* $NetBSD: init_main.c,v 1.491 2017/10/27 09:59:16 utkarsh009 Exp $ */

/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -97,7 +97,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.490 2017/01/16 09:28:40 ryo Exp $");
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.491 2017/10/27 09:59:16 utkarsh009 Exp $");

#include "opt_ddb.h"
#include "opt_inet.h"
Expand Down Expand Up @@ -1117,7 +1117,7 @@ banner(void)
printf_nolog("%s\n", notice);
pr = aprint_normal;
} else {
pr = printf;
pr = (void *)printf;
}

memset(pbuf, 0, sizeof(pbuf));
Expand Down
8 changes: 4 additions & 4 deletions sys/kern/subr_autoconf.c
@@ -1,4 +1,4 @@
/* $NetBSD: subr_autoconf.c,v 1.253 2017/06/01 02:45:13 chs Exp $ */
/* $NetBSD: subr_autoconf.c,v 1.254 2017/10/27 09:59:16 utkarsh009 Exp $ */

/*
* Copyright (c) 1996, 2000 Christopher G. Demetriou
Expand Down Expand Up @@ -77,7 +77,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.253 2017/06/01 02:45:13 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.254 2017/10/27 09:59:16 utkarsh009 Exp $");

#ifdef _KERNEL_OPT
#include "opt_ddb.h"
Expand Down Expand Up @@ -258,7 +258,7 @@ frob_cfdrivervec(struct cfdriver * const *cfdriverv,
const char *style, bool dopanic)
{
void (*pr)(const char *, ...) __printflike(1, 2) =
dopanic ? panic : printf;
dopanic ? panic : (void *)printf;
int i, error = 0, e2 __diagused;

for (i = 0; cfdriverv[i] != NULL; i++) {
Expand Down Expand Up @@ -290,7 +290,7 @@ frob_cfattachvec(const struct cfattachinit *cfattachv,
{
const struct cfattachinit *cfai = NULL;
void (*pr)(const char *, ...) __printflike(1, 2) =
dopanic ? panic : printf;
dopanic ? panic : (void *)printf;
int j = 0, error = 0, e2 __diagused;

for (cfai = &cfattachv[0]; cfai->cfai_name != NULL; cfai++) {
Expand Down
6 changes: 3 additions & 3 deletions sys/kern/subr_disk.c
@@ -1,4 +1,4 @@
/* $NetBSD: subr_disk.c,v 1.119 2017/06/01 02:45:13 chs Exp $ */
/* $NetBSD: subr_disk.c,v 1.120 2017/10/27 09:59:16 utkarsh009 Exp $ */

/*-
* Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -67,7 +67,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.119 2017/06/01 02:45:13 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.120 2017/10/27 09:59:16 utkarsh009 Exp $");

#include <sys/param.h>
#include <sys/kernel.h>
Expand Down Expand Up @@ -138,7 +138,7 @@ diskerr(const struct buf *bp, const char *dname, const char *what, int pri,
log(pri, fmt);
pr = addlog;
} else
pr = printf;
pr = (void *)printf;
(*pr)("%s%d%c: %s %sing fsbn ", dname, unit, partname, what,
bp->b_flags & B_READ ? "read" : "writ");
sn = bp->b_blkno;
Expand Down
7 changes: 4 additions & 3 deletions sys/kern/subr_prf.c
@@ -1,4 +1,4 @@
/* $NetBSD: subr_prf.c,v 1.160 2016/07/27 09:57:26 skrll Exp $ */
/* $NetBSD: subr_prf.c,v 1.161 2017/10/27 09:59:16 utkarsh009 Exp $ */

/*-
* Copyright (c) 1986, 1988, 1991, 1993
Expand Down Expand Up @@ -37,7 +37,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.160 2016/07/27 09:57:26 skrll Exp $");
__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.161 2017/10/27 09:59:16 utkarsh009 Exp $");

#ifdef _KERNEL_OPT
#include "opt_ddb.h"
Expand Down Expand Up @@ -1032,7 +1032,7 @@ printf_nolog(const char *fmt, ...)
/*
* printf: print a message to the console and the log
*/
void
int
printf(const char *fmt, ...)
{
va_list ap;
Expand All @@ -1047,6 +1047,7 @@ printf(const char *fmt, ...)

if (!panicstr)
logwakeup();
return 0;
}

/*
Expand Down
8 changes: 4 additions & 4 deletions sys/kern/vfs_subr.c
@@ -1,4 +1,4 @@
/* $NetBSD: vfs_subr.c,v 1.468 2017/06/04 07:58:29 hannken Exp $ */
/* $NetBSD: vfs_subr.c,v 1.469 2017/10/27 09:59:16 utkarsh009 Exp $ */

/*-
* Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -68,7 +68,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.468 2017/06/04 07:58:29 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.469 2017/10/27 09:59:16 utkarsh009 Exp $");

#ifdef _KERNEL_OPT
#include "opt_ddb.h"
Expand Down Expand Up @@ -1131,7 +1131,7 @@ vprint(const char *label, struct vnode *vp)

if (label != NULL)
printf("%s: ", label);
vprint_common(vp, "\t", printf);
vprint_common(vp, "\t", (void *)printf);
if (vp->v_data != NULL) {
printf("\t");
VOP_PRINT(vp);
Expand Down Expand Up @@ -1512,7 +1512,7 @@ vfs_vnode_print(struct vnode *vp, int full, void (*pr)(const char *, ...))

uvm_object_printit(&vp->v_uobj, full, pr);
(*pr)("\n");
vprint_common(vp, "", printf);
vprint_common(vp, "", (void *)printf);
if (full) {
struct buf *bp;

Expand Down
6 changes: 3 additions & 3 deletions sys/kern/vfs_wapbl.c
@@ -1,4 +1,4 @@
/* $NetBSD: vfs_wapbl.c,v 1.98 2017/10/23 19:03:40 jdolecek Exp $ */
/* $NetBSD: vfs_wapbl.c,v 1.99 2017/10/27 09:59:16 utkarsh009 Exp $ */

/*-
* Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
Expand Down Expand Up @@ -36,7 +36,7 @@
#define WAPBL_INTERNAL

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.98 2017/10/23 19:03:40 jdolecek Exp $");
__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.99 2017/10/27 09:59:16 utkarsh009 Exp $");

#include <sys/param.h>
#include <sys/bitops.h>
Expand Down Expand Up @@ -2167,7 +2167,7 @@ wapbl_dump(struct wapbl *wl)
#endif
if (!wl)
return;
wapbl_print(wl, 1, printf);
wapbl_print(wl, 1, (void *)printf);
}
#endif

Expand Down
4 changes: 2 additions & 2 deletions sys/sys/systm.h
@@ -1,4 +1,4 @@
/* $NetBSD: systm.h,v 1.272 2016/12/22 16:05:15 cherry Exp $ */
/* $NetBSD: systm.h,v 1.273 2017/10/27 09:59:17 utkarsh009 Exp $ */

/*-
* Copyright (c) 1982, 1988, 1991, 1993
Expand Down Expand Up @@ -221,7 +221,7 @@ void printf_tolog(const char *, ...) __printflike(1, 2);

void printf_nolog(const char *, ...) __printflike(1, 2);

void printf(const char *, ...) __printflike(1, 2);
int printf(const char *, ...) __printflike(1, 2);

int snprintf(char *, size_t, const char *, ...) __printflike(3, 4);

Expand Down
6 changes: 3 additions & 3 deletions sys/ufs/ufs/ufs_lookup.c
@@ -1,4 +1,4 @@
/* $NetBSD: ufs_lookup.c,v 1.146 2017/03/30 09:11:45 hannken Exp $ */
/* $NetBSD: ufs_lookup.c,v 1.147 2017/10/27 09:59:17 utkarsh009 Exp $ */

/*
* Copyright (c) 1989, 1993
Expand Down Expand Up @@ -37,7 +37,7 @@
*/

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.146 2017/03/30 09:11:45 hannken Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.147 2017/10/27 09:59:17 utkarsh009 Exp $");

#ifdef _KERNEL_OPT
#include "opt_ffs.h"
Expand Down Expand Up @@ -700,7 +700,7 @@ ufs_dirbad(struct inode *ip, doff_t offset, const char *how)
{
struct mount *mp = ITOV(ip)->v_mount;
void (*p)(const char *, ...) __printflike(1, 2) =
(mp->mnt_flag & MNT_RDONLY) == 0 ? panic : printf;
(mp->mnt_flag & MNT_RDONLY) == 0 ? panic : (void *)printf;

(*p)("%s: bad dir ino %ju at offset %d: %s\n",
mp->mnt_stat.f_mntonname, (uintmax_t)ip->i_number,
Expand Down

0 comments on commit 57996ef

Please sign in to comment.