Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2737810ybf; Mon, 2 Mar 2020 14:38:09 -0800 (PST) X-Google-Smtp-Source: ADFU+vtwbKjwpideZzOABGlDimJ1UXL1bqq2IsQO3SZP62xarIK9b6EEJ0MGmJZjXukwOpzVxw8Q X-Received: by 2002:aca:ac4c:: with SMTP id v73mr501150oie.102.1583188689516; Mon, 02 Mar 2020 14:38:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583188689; cv=none; d=google.com; s=arc-20160816; b=prSfTol2zQP/XoCSap127KCjk/+8HdG20TG9eJuqS06o1ddgg0zNlEleUZuTCyeZZ1 DrA8f9I8v3tdVgAnJKfgPGpAhzYzkS7vkC+d6NFNxNDB2eHiJ2RNhy/6rRHO32h0XtTA tD+jy/ozzhhw3s40JpMTPBxseWmJOcfyhgLpSK9xslno3LJ7lz6dpr0UxrMFW0vXbBx+ A38RiH+MMb7nIPdXwdy2oLWxn0RfjSwNvqygvQZHDJJcyKBN2Y20Xo+FonqvDJ0OmGz0 VfLIbmOSu4sqS2XKX69FY9LtRUCcGu85tfZy47F3OPaADC5IBj6kclI1uV+E/NYIkNz9 sk2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=w4Md8j8zd2YWszLJ5ilbEdqON4mnmjdfj7ZdSWk0uFA=; b=uayLUSKFm4SB7ndiX5z5oK3NVBzOKWgG9bmjuCk85sI63Aho3HcF9K70CjA2Q5xSUg DOHwzzSSKBSywuOP9+X5OMx3H9xopb1GpDpy56SctuvbXj7qlaY5HufLmz9Axj/xUehV PD263UGqS72zoyjoeBb9rNotJh0YUn1ZaMTc8aC+WDXqcGPqcnkRLiQKXoxcYF8L31ie 6MLNRLk/zPdh6X8jaWVx0wr8ggCzYfaYRYLSCPmIinmOAmsYarLBX7CZMsGfMupC+qxF poGA4zOsFzV85+EZ7kE7LY1R4og0ptErHJrLfhujfrLVIUT5TI7aGkSc0X1vcyr3cQZr zj7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gzCkLslX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d22si7726430oti.316.2020.03.02.14.37.56; Mon, 02 Mar 2020 14:38:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gzCkLslX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727052AbgCBWhB (ORCPT + 99 others); Mon, 2 Mar 2020 17:37:01 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:42948 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726758AbgCBWhB (ORCPT ); Mon, 2 Mar 2020 17:37:01 -0500 Received: by mail-pl1-f193.google.com with SMTP id u3so374806plr.9 for ; Mon, 02 Mar 2020 14:37:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=w4Md8j8zd2YWszLJ5ilbEdqON4mnmjdfj7ZdSWk0uFA=; b=gzCkLslXcjE5DvGXTBYEg8m27pTpEadwL3rR2WycF7BhdT0ydKD+o2TQip8TbNMkVI /E60kejzEW91h8D3B8uxc3eJ/etME05K7T4nykaplWOLVz7dXkeogT97J97jUVvP77jD W8/glAXkpDq327B/D/MGty6SkacKs0Op008RYQXPQ7Ru+qBVAjMUUksd+tqP5h4trgyI eJYQsgbr1U/WpriL9Ha25BPRdJoKjMrkyOjY7jwefb+Rzc6UPdJLPZlpTIuGtcPQJTP2 VvvRlW2J+S0c9G4n3DCJmcYYP2npItu3nqsStYlzOvy70dZBJbyM9zWiucVyF9gWoZjE N4fw== 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=w4Md8j8zd2YWszLJ5ilbEdqON4mnmjdfj7ZdSWk0uFA=; b=dQxfCkZlXlVJpBPtMp0VL4dAyP8OtTKh2CFXAKY+5k9OR9kvucU6f/V6COKM5EF6bC HsJalHshGKvOMSrtXHckmbrDDRjiTXbqZQnqQftZjxiFERyDvc9/3pxX7Z/2Lo1m/PsW /jJlfJxpfXDPhyUAndlYSYWzvrnhw2B2E+kIvv7A1YlXyCG7o3LnZ4mSMxwrSgwW+0zY NOnEosrdSN2ydQsCMlbFUhlHFcuRa9KGwRlwyyvzFOGOMvEjtkwafwWjxN48PS0aytFb DPGIjUrK83iY3OkrxtcNi7JpZK3bjLPBj+csjG9W7HyfuzafmAv1GZge50ZP1Gmk0hvb zTtw== X-Gm-Message-State: ANhLgQ0mXC+8QA6NRQ8RzYrwQm2ldqdcQaB+vqZjvuy7JhWv6HH3WHbM uOry30jXu8LpumK1rm9eo6dvLQQ3t83wkznW+8mLYg== X-Received: by 2002:a17:90a:3a90:: with SMTP id b16mr184340pjc.29.1583188619857; Mon, 02 Mar 2020 14:36:59 -0800 (PST) MIME-Version: 1.0 References: <20200227024301.217042-1-trishalfonso@google.com> In-Reply-To: From: Brendan Higgins Date: Mon, 2 Mar 2020 14:36:48 -0800 Message-ID: Subject: Re: [RFC PATCH 1/2] Port KASAN Tests to KUnit To: Kees Cook Cc: Dmitry Vyukov , Patricia Alfonso , Andrey Ryabinin , David Gow , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , LKML , kasan-dev , "open list:KERNEL SELFTEST FRAMEWORK" , KUnit Development Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 2, 2020 at 9:52 AM Kees Cook wrote: > > On Sat, Feb 29, 2020 at 10:39 PM Dmitry Vyukov wrote: > > > > On Sat, Feb 29, 2020 at 2:56 AM Patricia Alfonso > > wrote: > > > On Thu, Feb 27, 2020 at 6:19 AM Dmitry Vyukov wrote: > > > > > > > > .On Thu, Feb 27, 2020 at 3:44 AM Patricia Alfonso > > > > > - pr_info("out-of-bounds in copy_from_user()\n"); > > > > > - unused = copy_from_user(kmem, usermem, size + 1); > > > > > > > > Why is all of this removed? > > > > Most of these tests are hard earned and test some special corner cases. > > > > > > > I just moved it inside IS_MODULE(CONFIG_TEST_KASAN) instead because I > > > don't think there is a way to rewrite this without it being a module. > > > > You mean these are unconditionally crashing the machine? If yes, > > please add a comment about this. > > > > Theoretically we could have a notion of "death tests" similar to gunit: > > https://stackoverflow.com/questions/3698718/what-are-google-test-death-tests > > KUnit test runner wrapper would need to spawn a separete process per > > each such test. Under non-KUnit test runner these should probably be > > disabled by default and only run if specifically requested (a-la > > --gunit_filter/--gunit_also_run_disabled_tests). > > Could also be used to test other things that unconditionally panic, > > e.g. +Kees may be happy for unit tests for some of the > > hardening/fortification features. > > I am not asking to bundle this with this change of course. > > A bunch of LKDTM tests can kill the system too. I collected the list > when building the selftest script for LKDTM: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/selftests/lkdtm/tests.txt > > I'm all for unittests (I have earlier kind-of-unit-tests in > lib/test_user_copy.c lib/test_overflow.c etc), but most of LKDTM is I took a brief look at lib/test_user_copy.c, it looks like it doesn't use TAP formatted output. How do you feel about someone converting them over to use KUnit? If nothing else, it would be good getting all the unit-ish tests to output in the same format. I proposed converting over some of the runtime tests over to KUnit as a LKMP project (Linux Kernel Mentorship Program) here: https://wiki.linuxfoundation.org/lkmp/lkmp_project_list#convert_runtime_tests_to_kunit_tests I am curious what you think about this. > designed to be full system-behavior testing ("does the system correct > BUG the current thread, when some deeper system state is violated?") Makes sense. Thanks!