From owner-svn-src-head@freebsd.org Sat Jan 12 20:16:43 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF05E149D78F for ; Sat, 12 Jan 2019 20:16:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6300C6E418 for ; Sat, 12 Jan 2019 20:16:42 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x830.google.com with SMTP id k12so22608233qtf.7 for ; Sat, 12 Jan 2019 12:16:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OSNMuMB83ZDeCAA5jt56+HhGovQJy4WsFspdYsF96uQ=; b=wsTKg5juOMhcMb5uqV64S4xkgqqMxEu64yDxzxAcDSJuPdv1usgx8ID5v5RrNJ9ijY Bw5vmz6V85XAFQQqAh3ovguk9gy4tQqFA3p+3qAnZiq3hyqmWRpDrfu7E3jUiQDxJ9J6 iZrI3yS5GU6L9yTXnjxgpyCfzIpqOf0OMY0Tigvts447t3dAzc06FblLrh8N+D0NrXE/ zWiZMh7zwrVI2RuD/nuPo0Nznn6+k92NrRp6dH8PjmikZX4HJVuXZiJHS2ul1rID/lpW 3l/hzcteVggjCo/EYPKOBrth22GtoPj+I/7eOVggpJC2HWT4JiYHAThvyjQOABDbAsNl Nldg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OSNMuMB83ZDeCAA5jt56+HhGovQJy4WsFspdYsF96uQ=; b=as9Ad5A3IF84fZzGyuQwXmyGI18zSotrSFqNi33+NG9bw6TAdTW7L8+DhhcsoqCfyh iPBklE9vmu2w58tmOb86ZCWMGhUBfEPMNvpzmqjJoKcz4efUuDYXgbV+AcrI2EY/zHrz p7Ertv+D197MOcB16PxkQi915qWfeg7sDXyHaZ4bcGvSD6eGSXGyXXgc1/doBhlh/h2z HjlJudF7bFHz89H6W4aXIzds36BO6/Pw8bm7mhF6Dle6Vx6hWWRYHQ7Q/GIXq8t9Me+9 VE9soSe8lg1HSt0dVFs9CEv2Z8NildXX8EH/afYC2yPuEOUE/8tpScvOuMN6e0RquSKN y2xA== X-Gm-Message-State: AJcUukeV9ejD+LDn6vgA+/ibY7ZTUXmNwSRSDlRL/V+7YuI+fFWjKbIW fUnkBeYA2KDfH+hn+DqAeWzL4PJV/z7glOskYNIf0Q== X-Google-Smtp-Source: ALg8bN5CjeCdAe1fkL78e8oS1ZNTvAZYgfB24a8h28G2NzUgG8sXgAtFWjAnznZl0MUpxaFEIDHqepzB1pk7YkVjsfs= X-Received: by 2002:ac8:668c:: with SMTP id d12mr17924015qtp.242.1547324201717; Sat, 12 Jan 2019 12:16:41 -0800 (PST) MIME-Version: 1.0 References: <201901121121.x0CBLSiv058912@repo.freebsd.org> <201901122013.x0CKDhjA064204@slippy.cwsent.com> In-Reply-To: <201901122013.x0CKDhjA064204@slippy.cwsent.com> From: Warner Losh Date: Sat, 12 Jan 2019 13:16:30 -0700 Message-ID: Subject: Re: svn commit: r342962 - in head: sys/amd64/conf sys/arm64/conf sys/conf sys/kern sys/sys tests/sys/kern To: Cy Schubert Cc: Andrew Turner , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 6300C6E418 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Jan 2019 20:16:43 -0000 On Sat, Jan 12, 2019 at 1:14 PM Cy Schubert wrote: > In message <201901121121.x0CBLSiv058912@repo.freebsd.org>, Andrew > Turner writes > : > > Author: andrew > > Date: Sat Jan 12 11:21:28 2019 > > New Revision: 342962 > > URL: https://svnweb.freebsd.org/changeset/base/342962 > > > > Log: > > Add support for the Clang Coverage Sanitizer in the kernel (KCOV). > > > > When building with KCOV enabled the compiler will insert function calls > > to probes allowing us to trace the execution of the kernel from > userspace. > > These probes are on function entry (trace-pc) and on comparison > operations > > (trace-cmp). > > > > Userspace can enable the use of these probes on a single kernel thread > with > > an ioctl interface. It can allocate space for the probe with > KIOSETBUFSIZE, > > then mmap the allocated buffer and enable tracing with KIOENABLE, with > the > > trace mode being passed in as the int argument. When complete > KIODISABLE > > is used to disable tracing. > > > > The first item in the buffer is the number of trace event that have > > happened. Userspace can write 0 to this to reset the tracing, and is > > expected to do so on first use. > > > > The format of the buffer depends on the trace mode. When in PC tracing > just > > the return address of the probe is stored. Under comparison tracing the > > comparison type, the two arguments, and the return address are traced. > The > > former method uses on entry per trace event, while the later uses 4. As > > such they are incompatible so only a single mode may be enabled. > > > > KCOV is expected to help fuzzing the kernel, and while in development > has > > already found a number of issues. It is required for the syzkaller > system > > call fuzzer [1]. Other kernel fuzzers could also make use of it, either > > with the current interface, or by extending it with new modes. > > > > A man page is currently being worked on and is expected to be committed > > soon, however having the code in the kernel now is useful for other > > developers to use. > > > > [1] https://github.com/google/syzkaller > > > > Submitted by: Mitchell Horne (Earlier > version) > > Reviewed by: kib > > Testing by: tuexen > > Sponsored by: DARPA, AFRL > > Sponsored by: The FreeBSD Foundation (Mitchell Horne) > > Differential Revision: https://reviews.freebsd.org/D14599 > > > > Added: > > head/sys/kern/kern_kcov.c (contents, props changed) > > head/sys/sys/kcov.h (contents, props changed) > > head/tests/sys/kern/kcov.c (contents, props changed) > > Modified: > > head/sys/amd64/conf/GENERIC > > head/sys/arm64/conf/GENERIC > > head/sys/conf/files > > head/sys/conf/kern.pre.mk > > head/sys/conf/options > > head/sys/kern/kern_thread.c > > head/sys/sys/proc.h > > head/tests/sys/kern/Makefile > > > [...] > > Modified: head/sys/sys/proc.h > > > ============================================================================= > > = > > --- head/sys/sys/proc.h Sat Jan 12 11:14:59 2019 (r342961) > > +++ head/sys/sys/proc.h Sat Jan 12 11:21:28 2019 (r342962) > > @@ -175,6 +175,7 @@ struct filecaps; > > struct filemon; > > struct kaioinfo; > > struct kaudit_record; > > +struct kcov_info; > > struct kdtrace_proc; > > struct kdtrace_thread; > > struct mqueue_notifier; > > @@ -300,6 +301,7 @@ struct thread { > > sbintime_t td_sleeptimo; /* (t) Sleep timeout. */ > > int td_rtcgen; /* (s) rtc_generation of abs. > sleep */ > > size_t td_vslock_sz; /* (k) amount of vslock-ed space */ > > + struct kcov_info *td_kcov_info; /* (*) Kernel code coverage data */ > > #define td_endzero td_sigmask > > > > /* Copied during fork1() or create_thread(). */ > > > > This breaks 32-bit builds (see jenkins email to recent committers from > this morning). > > Inserting this here and calculating offsets for 64-bit platforms > without taking into consideration 32-bit is the reason why. Maybe we > should consider deorbit of 32-bit platforms sooner than later. > I have the missing mips 64-bit stuff for mips32. i386 already has the 64-bit ops, I believe. Arm has them. Just powerpc 32-bit will be left w/o them. Warner