Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1376061pxk; Thu, 10 Sep 2020 13:50:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/qFsaimVFiF3uVsq4cqwqVPiKfPdoeWCewrb4ANGno79eFB4UJQ7MvmSL9r4/Xtshfp3p X-Received: by 2002:a17:906:a101:: with SMTP id t1mr10516287ejy.203.1599771012721; Thu, 10 Sep 2020 13:50:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599771012; cv=none; d=google.com; s=arc-20160816; b=bMY7M3i59FTmy/M/rEhKDKWDl3GDWeP0t2ov+zbIz0ghB78XovGfanSz3eifeaDQUG 5noTW7MQbguYWIIcv+OTInvt3OzUetX7vIdpP/FtjsCBkLIkOhh69Ee3OIXIONeEBpKW X4BOT18d3vqZz2+Jbo33hcV0i1dj0yOjq/S+f6OOn8C2t/X7m9uJaWMtEsr0zvbV8XMx plX3+up+sOgq6Eho5Ukb0Q7lnyNvTdMHfkshzcCOzYJjHdVI4+CNBwUcRt3u74UkPQC0 ujTQet4HwyH3nGSCrznNDkhNCFhpS01G9pje69Htpcb291TSXbNiabyiFYbdTQs52/m3 5fJQ== 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=dOtT3N7XbGpRxpxc8ChGzc7KDQ9tSEwlVL00HtmCks8=; b=cBuWUsuSEUGyqZH15cz3y6p6tC8h9n6szNmAMgYUgGD+MYk1POqfG28ObP9VZfxfuj UYljU/4jnEiy48mYz0TIwOHSOPDnn/e4xdyvHT4gbU3VKKG9xc/l+6v5rrw/aijF6fw1 dwJtOwrvO/SDGFLW6wDVS7EoEu44M8CADVGMkeShNXn182tMgthnwEkJWpLqE/kp1SWD X+TV2VAnzXOIUimG+ylQq6RsvuNopauhnVW2JMnzyOuOZkEQrUlEu1b4tkamNiDlTlL2 Nuz2wrlMXRKuGFCPN1b1H7Cm0tl34hiOdR4mxkVXPU7GVqJjN01OVj7OkPNT4XcigKfq eSIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="C/Nbbf4T"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v15si4680339edj.197.2020.09.10.13.49.50; Thu, 10 Sep 2020 13:50:12 -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=@google.com header.s=20161025 header.b="C/Nbbf4T"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726722AbgIJUrH (ORCPT + 99 others); Thu, 10 Sep 2020 16:47:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726913AbgIJU2U (ORCPT ); Thu, 10 Sep 2020 16:28:20 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34CE3C061757 for ; Thu, 10 Sep 2020 13:28:05 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id n22so7701423edt.4 for ; Thu, 10 Sep 2020 13:28:05 -0700 (PDT) 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=dOtT3N7XbGpRxpxc8ChGzc7KDQ9tSEwlVL00HtmCks8=; b=C/Nbbf4T5rPk5brkoe050E2pcKCOvUasKnRCCFebyKdoxklwvBx0WXCmqjsDrbtpQV jR6WiarrGjbLiEQkOEZuNuB/YvertASUjGXTd4haT9x7o9clqXR3JKVcu0UMmGqYZUmU VAsc6ulw4hGipMG2uE+lsgPcKmNCYpytB/IHs6Oxg8HuAoZWBCKBvclBqizD+4L+LwfK nsSI43tbcdKmURrSC9zJfS5oLkDHyWRaABxsMPLIICw+pxAgpBCM5dVXdO+OuZg2E//b 2h5kExRMIJy0tPvpHdEeBK6feABcxtN2G01klGZ6ScnLzyaR3hPS/Of9tc91a739PUWU 5RXw== 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=dOtT3N7XbGpRxpxc8ChGzc7KDQ9tSEwlVL00HtmCks8=; b=Sy099sNCgVDl/925BjbENNOGkADJ2zgPWVhaz5qoqzo575VgS9GZOnKydSYpFyMhAZ MmSSLVa7u1S3W7YnlrIHAqydb/LN1uvLGAjKPZiSxPwYVJm6/LRVHijzyDBVjpKhBTlI hNjgIXDCKvadE2CxCjUftc+VWTtyaN+0qgnyl4pUROG1owfUp/QLO2sOLedsXfs2i1OK uJxhsy+77dLTwbqh94ENYk8bM3KDb3EnUYgbw+HQE1R98+SJyWTOCEODLdz7gkHQ1XwM zrGvCK11z/xp/NrhnmIgIUjWVoXA568Ui2N8KyYnYAMftfElDG6TKjLOjMwJ7HL2rwVg tf/w== X-Gm-Message-State: AOAM531QsREc2eGD++Aprh+m98uUyGYC6b+eU6uRAEoeoZBTKnHdhUlr ThJPWzuQ25qNec1UA7V89DDp1Xw5fVZqbEBadPos7A== X-Received: by 2002:a50:fe98:: with SMTP id d24mr11069998edt.223.1599769681295; Thu, 10 Sep 2020 13:28:01 -0700 (PDT) MIME-Version: 1.0 References: <20200910202107.3799376-1-keescook@chromium.org> <20200910202107.3799376-4-keescook@chromium.org> In-Reply-To: <20200910202107.3799376-4-keescook@chromium.org> From: Jann Horn Date: Thu, 10 Sep 2020 22:27:35 +0200 Message-ID: Subject: Re: [RFC PATCH 3/6] security/fbfam: Use the api to manage statistics To: Kees Cook Cc: Kernel Hardening , John Wood , Matthew Wilcox , Jonathan Corbet , Alexander Viro , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Luis Chamberlain , Iurii Zaikin , James Morris , "Serge E. Hallyn" , linux-doc@vger.kernel.org, kernel list , linux-fsdevel , linux-security-module 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 Thu, Sep 10, 2020 at 10:21 PM Kees Cook wrote: > Use the previous defined api to manage statistics calling it accordingly > when a task forks, calls execve or exits. You defined functions that return error codes in the previous patch, but here you ignore the return values. That's a bad idea. You should probably check the return value in execve() (and fail the execution in the case where memory allocation fails), and make it so that the other functions always succeed.