Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp832950pxb; Thu, 17 Feb 2022 16:05:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzOagpQG0zMAUiRquzTuv8YiFnXBzMWa+BGVOC884yr2Qo9UX5Zx3dr6d1KXRCM7ANNdsHF X-Received: by 2002:aca:40d5:0:b0:2d3:5a67:369b with SMTP id n204-20020aca40d5000000b002d35a67369bmr3945802oia.118.1645142741943; Thu, 17 Feb 2022 16:05:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645142741; cv=none; d=google.com; s=arc-20160816; b=q+kTBMW8ZZScmJRZSjE3g0U4DRcKI5AN+q7a2vKBjpEtmfXJujdiHRYy6AiJzE5ra5 hlH5qRbPXVmmR+488lL58WbpLb8QiunNpYAAZQKQLiML+fMzu+6Rz10C7r3GpJXRY0Mo isVvR+w5hsXkFLNBrKjXQ5tyXdP7i+k3bP0e2ar79acHyPIX2ZRvp4srPjtYaqLCOLFM GPZh00Hv2HrVDojSnyGYVFwXdeLg4tlnhGTty/7Q2ehz9n8KwCn8LX5VM4wyqSSYLhi9 LlASnYhKGpZAmM6w+SUPndeW6iE4MJ/53J7rZd2sNkc66sS/smUwxqc0x+e3h1CwAgQm czbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=7fIcF7s81zkutMwfNwbf5zubVlDI9OaU5K9fy74Q9B4=; b=fvZ4lEsT/nIFR7uzoXJjPw2eVjYxQFEVuzbfSKZmZ5xoG7sfzaA6PirXkJHpm/3MGo sz5/cblkwZvNUXcNSf8UnU6kbZGQcsOjlJfPgx+h/1tYx4Y8KTB+gRQjBujIRpV35pg8 zq+yeUFHy6+r1YqoWsid1cD/o6jiLISMR+6g7eqovFqZfvJoAzx9XgqyLXQ9rnRDcXPZ u9InrlJ41/41cLYFK9zsbpz5E0wAxAu1IGXKZNUK0WjQUSRRj56Sib5CqtEoNdDPyi7X e9JwZQCgSxNDIl0vn+ICGoFFmXQExnoh+Wl8BxbatKelFFOG/V/fO2zUi5iJ9IpLpffV QD2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=CbjKEehp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id bx41si492110oib.44.2022.02.17.16.05.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 16:05:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=CbjKEehp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 21884331D74; Thu, 17 Feb 2022 15:33:10 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243688AbiBQRZD (ORCPT + 99 others); Thu, 17 Feb 2022 12:25:03 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243687AbiBQRZC (ORCPT ); Thu, 17 Feb 2022 12:25:02 -0500 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46BEB2B3544 for ; Thu, 17 Feb 2022 09:24:47 -0800 (PST) Received: by mail-io1-xd2e.google.com with SMTP id q20so2211252ioi.0 for ; Thu, 17 Feb 2022 09:24:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=7fIcF7s81zkutMwfNwbf5zubVlDI9OaU5K9fy74Q9B4=; b=CbjKEehp+SO97pE4gjqRCL2QIc1uqC9YLBDOV46DzEWiC3Sqbnz4CABRm+m/ca4Eqv buTZ31TloBpK6VM7Z587Ywiyaf6uTxjFAEhwDX5nJSV1CS2+0w6L72L7j8WSQi53hABT 4QAI7u4+Ju3wP+USmHOrd0+P76dMc+h6l4SO0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=7fIcF7s81zkutMwfNwbf5zubVlDI9OaU5K9fy74Q9B4=; b=W32Z9j2alWwXaXXoQ0KkwGiFAejfZEA01/Fi4rAN8LrvAhPYEBmGcAb/dzJwo6k3EA gUkhEd3h09oApG7RBnkH4a5GeTaYj4o9x8mKDvqXurulQHeyeMdzoaAOgf9edPTPMeIH t+XxOE123LwtsjA3KlJZZwmTaZjWKyyKoeN2T2uOEof2PY0Iobi2+q2svTg3Lp56ctnL Yt3aeJcx5cnKeIa0DxorIlUsQQnWiepT3IX3TZI6NKE64IGona+KV+ajxHseD1fXrad0 TfFKlv/oOgG8/wASwi5L71belJoq0PxqYdYzKkXKaIKFg/Uu/s9D7WcU3EL3hffuuDSe 94WQ== X-Gm-Message-State: AOAM530CECXpuMzCyXjROLJJmAHaGQQZcS0K0GOZY4pv7cWZU6VkYq3u BYiaNXL+tlQCfamTZz08W+YuQA== X-Received: by 2002:a02:700e:0:b0:2ff:7cac:bd09 with SMTP id f14-20020a02700e000000b002ff7cacbd09mr2696324jac.32.1645118685905; Thu, 17 Feb 2022 09:24:45 -0800 (PST) Received: from [192.168.1.128] ([71.205.29.0]) by smtp.gmail.com with ESMTPSA id y7sm2105136ila.7.2022.02.17.09.24.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Feb 2022 09:24:45 -0800 (PST) Subject: Re: [PATCH] lib: overflow: Convert to Kunit To: Kees Cook , Daniel Latypov Cc: David Gow , Vitor Massaru Iha , Rasmus Villemoes , Nick Desaulniers , Arnd Bergmann , linux-kernel@vger.kernel.org, KUnit Development , linux-kselftest@vger.kernel.org, linux-hardening@vger.kernel.org, Shuah Khan References: <20220216224153.2242451-1-keescook@chromium.org> <202202170903.E39554DF@keescook> From: Shuah Khan Message-ID: <68057bea-7bf7-afb9-4c99-aa3b2c024133@linuxfoundation.org> Date: Thu, 17 Feb 2022 10:24:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <202202170903.E39554DF@keescook> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/17/22 10:09 AM, Kees Cook wrote: > On Wed, Feb 16, 2022 at 02:57:12PM -0800, Daniel Latypov wrote: >> On Wed, Feb 16, 2022 at 2:42 PM Kees Cook wrote: >>> >>> Convert overflow unit tests to KUnit, for better integration into the >>> kernel self test framework. Includes a rename of test_overflow.c to >>> overflow_kunit.c, and CONFIG_TEST_OVERFLOW to CONFIG_OVERFLOW_KUNIT_TEST. >>> >>> $ ./tools/testing/kunit/kunit.py config >>> ... >>> $ ./tools/testing/kunit/kunit.py run overflow >> >> JFYI, you can run this as a one-liner via >> >> $ ./tools/testing/kunit/kunit.py run --kunitconfig /dev/stdin <> CONFIG_KUNIT=y >> CONFIG_TEST_OVERFLOW=y >> EOF >> >> The above is taken from my own duplicate version of this patch >> [1] https://lore.kernel.org/linux-kselftest/20210503211536.1384578-1-dlatypov@google.com/ > > Ah-ha! I thought I remembered this conversion being proposed before but > I totally failed to find it. Thank you! I'll compare/adjust this patch > and add you as Co-developed-by. > >>> ... >>> [14:33:51] Starting KUnit Kernel (1/1)... >>> [14:33:51] ============================================================ >>> [14:33:51] ================== overflow (11 subtests) ================== >>> [14:33:51] [PASSED] u8_overflow_test >>> [14:33:51] [PASSED] s8_overflow_test >>> [14:33:51] [PASSED] u16_overflow_test >>> [14:33:51] [PASSED] s16_overflow_test >>> [14:33:51] [PASSED] u32_overflow_test >>> [14:33:51] [PASSED] s32_overflow_test >>> [14:33:51] [PASSED] u64_overflow_test >>> [14:33:51] [PASSED] s64_overflow_test >>> [14:33:51] [PASSED] overflow_shift_test >>> [14:33:51] [PASSED] overflow_allocation_test >>> [14:33:51] [PASSED] overflow_size_helpers_test >>> [14:33:51] ==================== [PASSED] overflow ===================== >>> [14:33:51] ============================================================ >>> [14:33:51] Testing complete. Passed: 11, Failed: 0, Crashed: 0, Skipped: 0, Errors: 0 >>> [14:33:51] Elapsed time: 12.525s total, 0.001s configuring, 12.402s building, 0.101s running >>> >>> Cc: David Gow >>> Cc: Vitor Massaru Iha >>> Cc: Rasmus Villemoes >>> Cc: Nick Desaulniers >>> Co-developed-by: Vitor Massaru Iha >>> Signed-off-by: Vitor Massaru Iha >>> Link: https://lore.kernel.org/lkml/20200720224418.200495-1-vitor@massaru.org/ >>> Signed-off-by: Kees Cook >> >> Reviewed-by: Daniel Latypov >> Looks good to me. I recall reviewing this when Vitor was working on this. Glad to this happen. Reviewed-by: Shuah Khan thanks, -- Shuah