Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1337930ybh; Thu, 16 Jul 2020 09:22:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWlaleRuUJOuslWhRreKnbj4CvFM8zciT0Ktg2KgHq558yf5Aa+X8bjy44zBwVbdM6k/3V X-Received: by 2002:a17:907:4003:: with SMTP id nj3mr4390243ejb.278.1594916572624; Thu, 16 Jul 2020 09:22:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594916572; cv=none; d=google.com; s=arc-20160816; b=Ewh3CYSGflcOWhNscICUpMul/z1ze548thNZnwNHsxWANrvu78BLKfxF92yxmptCDA BRBrxWbelUU71tikgetJGyR4YdLPLUUJYfpsV+by/b7BVlp5do6necpGKHxSUNQtlH+Y 0dk+8Co+jcjsBZiJ2OsZL8XGft3hJsK/F5an62LBNLYlLXL06hMMoNpv0iVhEZV0cnj3 Npb+lYrXJijHkpvSy3xQGPA8iXtlDrNNp0vWTpU7RXaXU2ZhsNb4wPqGt91lexhh0zYF HP/Q99KpPGNhQN7G2rmclnSZpmXiAUN3CvLdt2s+6tP6hHahk1D2gQ3cOKC3PH0uyjbG 03Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=eVyKsGqcnTfmfgMXI8u61q0DyoLaoA7ADBPKDJXxDGI=; b=N088YgSsUiRiwA4Yc5ex1JEMrJt260SwZGTSGCI7DtvmcUMBmAiu0E00/DiXPUL90u Tik3lGwdbOSqVRECb0BbsehLANvdfI6DM7ZfcxCXFuNd7NhqtQDHaAskKvoEKq2LcG/E bilx8yurOe2HQNOSECMe0dqK9JjlKhEiv4fAw1z2XrcTKVWW4C/whWNd8JeAp8v0Lbff T24hlbjnduLcf6hwhr+XvJaPQBho7wl0wwyNPYSyVaw+g99Hh7uulC1ATKV0DuseqkcV GXjEjnZsxoPZNOcnl/BxQ85f7VBPweQKAa5YEuqTWYKjN/5t12Ki0oxjQt30kY5v0yUz 0Jwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@massaru-org.20150623.gappssmtp.com header.s=20150623 header.b=Sid+fUx7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dg12si3371469edb.81.2020.07.16.09.22.29; Thu, 16 Jul 2020 09:22:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@massaru-org.20150623.gappssmtp.com header.s=20150623 header.b=Sid+fUx7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729262AbgGPQVY (ORCPT + 99 others); Thu, 16 Jul 2020 12:21:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728837AbgGPQVX (ORCPT ); Thu, 16 Jul 2020 12:21:23 -0400 Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85DD2C061755 for ; Thu, 16 Jul 2020 09:21:23 -0700 (PDT) Received: by mail-qk1-x741.google.com with SMTP id j80so6074492qke.0 for ; Thu, 16 Jul 2020 09:21:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=massaru-org.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=eVyKsGqcnTfmfgMXI8u61q0DyoLaoA7ADBPKDJXxDGI=; b=Sid+fUx7JJp9lDCQ/ip2Q7z8EKoEUuhmbS8Y/EAimMtaVJ5FieLYEELLhGMAMiQWkx HfDVTNkMwVvg4hvfQ19BuYQ2OQ4X71iMeVw0iyriGM/1aiedV1f0eyAzjNocWufgP6IY zOf8DiqwN/IyuOzMKXGuLMV626s18HFSUSVfCFIAdDfZ64NSz70wh8nAC6Hxt70bimg1 LqZtmP+xzip5LMLtZgwigc9G5xSJMChtVzcFwfBHlwh3pJCcVx1HLOIqU3y8P9cwOcIq FtTwr6ur5rj8lGXOZ3cQEhSWkfcXHGn/00jmHeSrYG3iRX8SuQqU8W+bLmVya7t8kI9A CDuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=eVyKsGqcnTfmfgMXI8u61q0DyoLaoA7ADBPKDJXxDGI=; b=YxTNreJkQzR5uH2C0w2wrpUDTBSgiOKE4gvvpBf5zPf4vXCQwolt1hH3NdVzcmk1nZ AWrHLxrFazed6mrJHq4BZowMvn2mtXhdj95unNrtdYS4YqRpUmY1HMwa9SYMgmyl2a+u CdbguJK6IM34ncNd7cbEvZY58UeMKo7lOS+JCvpJZXFSrATsNfuIAQnzFzg3fFx08kQZ 9KzUDvwuoddbXogbrTdEjEMmP54UabMjg+CaACnQwx+NWs3wNtZ8xRwHHusDvyZo7eu1 Y4JiGaL6XVjTPYQefNc0mCoyhzscClz2h2bMzcrm6KMFX9aV+y+ndRjXuKb4eeWRdtzd gl4A== X-Gm-Message-State: AOAM530t4Au2b7sdaDPjVfbJnyo5cZ6+DmIw90sjcEe8b/qkcZccCJ2r /w3af4igwmOqGdqkD6clTSpeog== X-Received: by 2002:a37:bd84:: with SMTP id n126mr4883951qkf.310.1594916482698; Thu, 16 Jul 2020 09:21:22 -0700 (PDT) Received: from bbking.lan ([2804:14c:4a5:36c::cd2]) by smtp.gmail.com with ESMTPSA id o184sm8118760qkd.41.2020.07.16.09.21.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 09:21:21 -0700 (PDT) Message-ID: Subject: Re: [RFC 0/3] kunit: add support to use modules From: Vitor Massaru Iha To: David Gow Cc: KUnit Development , "open list:KERNEL SELFTEST FRAMEWORK" , Linux Kernel Mailing List , Brendan Higgins , Kees Cook , Shuah Khan , linux-kernel-mentees@lists.linuxfoundation.org Date: Thu, 16 Jul 2020 13:21:17 -0300 In-Reply-To: References: <20200715031120.1002016-1-vitor@massaru.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.3 (3.36.3-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-07-15 at 11:47 +0800, David Gow wrote: > On Wed, Jul 15, 2020 at 11:11 AM Vitor Massaru Iha > wrote: > > Currently, KUnit does not allow the use of tests as a module. > > This prevents the implementation of tests that require userspace. > > If this is what I think it is, thanks! I'll hopefully get a chance to > play with it over the next few days. > > Can we clarify what this means: the current description is a little > misleading, as KUnit tests can already be built and run as modules, > and "tests that require userspace" is a bit broad. > > As I understand it, this patchset does three things: > - Let kunit_tool install modules to a root filesystem and boot UML > with that filesystem. > - Have tests inherit the mm of the process that started them, which > (if the test is in a module), provides a user-space memory context so > that copy_{from,to}_user() works. > - Port the test_user_copy.c tests to KUnit, using this new feature. > > A few comments from my quick glance over it: > - The rootfs support is useful: I'm curious how it'll interact with > non-UML architectures in [1]. It'd be nice for this to be extensible > and to not explicitly state UML where possible. Hm, I didn't think about other architectures. Which ones are you thinking ? > - The inheriting of the mm stuff still means that > copy_{from,to}_user() will only work if loaded as a module. This > really needs to be documented. (Ideally, we'd find a way of having > this work even for built-in tests, but I don't have any real ideas as > to how that could be done). Sure, I'll write the documentation. > - It'd be nice to split the test_user_copy.c test port into a > separate > commit. In fact, it may make sense to also split the kunit_tool > changes and the mm changes into separate series, as they're both > quite > useful independently. > I'll do it. Thanks for the review.