Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3463489pxp; Tue, 8 Mar 2022 15:08:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7eaALfz4rJ4PK6kzyj5NEXrxRqRUJ2J2SzW8wd8av174Fwr39d2f08fMVSs93IuCYCDjH X-Received: by 2002:a17:902:f70c:b0:14e:f1a4:d894 with SMTP id h12-20020a170902f70c00b0014ef1a4d894mr19954390plo.65.1646780892911; Tue, 08 Mar 2022 15:08:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646780892; cv=none; d=google.com; s=arc-20160816; b=0VpXW4/WVT9ySt/b+7BLTUU+NZlA/cmKWSwoizgZ/ZZ1j4VfC8ndtzBimR80GKKed9 umIKErR23dAwHkEM2G8wa2q3Q6Dy81ppxTgr1d8OZ0tTsLEGbZXf5rg8o1zgriwTLcVj +2dXjKk76IP/CyOg2oQvqR9W2/YQaiynA0Mk48rt0Rm9kooJcSVcUzWIAcClmvYv7jTb 4AGV9qZ4dMIEN1EhSu4jVspH7rY3hnOXGJdJEDBah9ag3jCqx+BdGjK9ybdI4Mlpp/5G ZQN9wIx2pLAOnEeNy/W0GF05De7jDuMsSpv3K2uPVlWlBwq6hv70f3jbBLNyUQAZ4sGH VcSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=nDOGbN5ER5kyhrbrSeZfaKAJZ4dw3JtTr6jnBgdLbBI=; b=GOye7pvvoH4fqFhtFgCr53FL7pjP6zTB3LB53aH4fa7A7WZFe0hKNacq/sL4JHKLhr OUtDupfIPVpoxblYp6mvk9PO4d57VRlrGO7OF0MOaKxoQ83sLFwC2y7pkVozZeH8Hmyv nu75ul1PjX6bmM9t4kFMf0iCfc+9bjfZm4A7LLwGCE2hXJpKjyP+QMnWdFBSbaXnd1jt 23dEtvemqu36pBeyrgeAtqiI+MECkmBkvne8w5K39unxjTU/okNSpLy2F2d02pObfZQq gV63VU1iuhXp+3+QP56NGafJqjQtXHtiihrwn81Rryg4xrOf5fN/ph9VYmAynS416cxN G6CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kmHrGTMS; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id nv2-20020a17090b1b4200b001bf8183ea27si3768774pjb.39.2022.03.08.15.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 15:08:12 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kmHrGTMS; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 775AC65D3B; Tue, 8 Mar 2022 15:06:29 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350436AbiCHV0A (ORCPT + 99 others); Tue, 8 Mar 2022 16:26:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350429AbiCHVZ6 (ORCPT ); Tue, 8 Mar 2022 16:25:58 -0500 Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FDE15004E; Tue, 8 Mar 2022 13:25:00 -0800 (PST) Received: by mail-wm1-x332.google.com with SMTP id 7-20020a05600c228700b00385fd860f49so363200wmf.0; Tue, 08 Mar 2022 13:25:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=nDOGbN5ER5kyhrbrSeZfaKAJZ4dw3JtTr6jnBgdLbBI=; b=kmHrGTMSvm6tF864EuT2q9gVNsYXS3s2uIcUZWHBIrB9Q8oVsXygqnpmpDyJow/rtB lldvQxzcy5qU3NO7j9RwlGt7C5cuRxfx5L5x+qoB7R/6PFU+YEtXgbcO06pt+DNxgbRg 0kIjeFi+TQVc5+qYRitxrs1b2/ekbArAvz+zBucgyNYqI5PyyYZNMzlMSS3P4pF7aTxl 2zxa7YL1+Vy//v5c8ZaLvqYnfikwRN5rmd6yAm/wttKeNs2HOR4SKL2jEBPLrpWgeBb2 q2DN0hNxiKsbH8Uw0q7n9hZBcaeHq0Ptst/XDlYJYnZd9lcmkWIeR6bLTTqFO2/h3AW9 mGgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=nDOGbN5ER5kyhrbrSeZfaKAJZ4dw3JtTr6jnBgdLbBI=; b=oOK+g3dGp1xBl1FAjuaHaz5hzMPMZnAjEqydMNlMCPBSaVydHGFe1SOQ65QVxWdEpH oAExkNisWVkjanIS8KKsZIYVRsdYc+HkpFPBIhvuctrMttrwJUzPlkwn21FlfPui2+gh lYkVuAu+DbClc30432okKVk78XK9umHxiNMNKM13m+JRlqrENrsCqEXgU/6IyEh6K1qi PX6VxHLEOekiGUB63WqVoXdilD440ey0Psgcc0GncNauBOXaBE62a4ee2c6WIw87Ll4B T8nfrSqbuJAOcwWUrutuse/VQxayP2w7vdC/S5lPROuc3erTA7Q1lbTj+GbxfIWPXgbj II+Q== X-Gm-Message-State: AOAM531Zr8SFyb3nfttcM1TCbzST1CHlbWln/p6KGT6evzJHCKaPjiXl G/88QgE+PUyNBf2Adb5aww== X-Received: by 2002:a05:600c:3b1c:b0:389:8677:6c73 with SMTP id m28-20020a05600c3b1c00b0038986776c73mr934939wms.192.1646774698977; Tue, 08 Mar 2022 13:24:58 -0800 (PST) Received: from localhost.localdomain ([46.53.254.141]) by smtp.gmail.com with ESMTPSA id b3-20020a5d4d83000000b001f1d72a6f97sm26070wru.50.2022.03.08.13.24.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 13:24:58 -0800 (PST) Date: Wed, 9 Mar 2022 00:24:56 +0300 From: Alexey Dobriyan To: Kees Cook Cc: David Gow , Eric Biederman , Daniel Latypov , Magnus =?utf-8?B?R3Jvw58=?= , Alexander Viro , linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2] binfmt_elf: Introduce KUnit test Message-ID: References: <20220304044831.962450-1-keescook@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220304044831.962450-1-keescook@chromium.org> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 Thu, Mar 03, 2022 at 08:48:31PM -0800, Kees Cook wrote: > Adds simple KUnit test for some binfmt_elf internals: specifically a > regression test for the problem fixed by commit 8904d9cd90ee ("ELF: > fix overflow in total mapping size calculation"). > + /* No headers, no size. */ > + KUNIT_EXPECT_EQ(test, total_mapping_size(NULL, 0), 0); This is meaningless test. This whole function only makes sense if program headers are read and loading process advances far enough so that pointer is not NULL. Are we going to mock every single function in the kernel? Disgusting.