From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0E71C43461 for ; Thu, 10 Sep 2020 20:29:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9C208221E5 for ; Thu, 10 Sep 2020 20:29:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="C/Nbbf4T" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726997AbgIJU2n (ORCPT ); Thu, 10 Sep 2020 16:28:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726805AbgIJU2U (ORCPT ); Thu, 10 Sep 2020 16:28:20 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E886AC061573 for ; Thu, 10 Sep 2020 13:28:02 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id ay8so7671745edb.8 for ; Thu, 10 Sep 2020 13:28:02 -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=UW3oOx66H8MG3sOAIHWSROuEeAW2ZmfwP+H4aYEYyF6eIULl3rCrs8VQ03ejgbRg/C H5W9aYDo66dAvBN836SUmT8Y2l9M7vYlCnBXGuRd4g/kQMwet1OwiPXgyEf2cxS3LUnm IwcmLhIhZm3avMjY4Qq8dMtauqfbm5AzWYPxJmTA63dwREzRydYtz7BqddWfLW+k8Yxk KifO4iinNMxOcdCFqRZhfeV9f2saVPpbUu8jLD8xp/9DHQRkq3u+ZWUw/Y6arjo5LbIN PFP1ZyxjmyJQ0ChRFXXrJUp9Ole28gEd0Bnkh+IJRPSv7ox/uNta58KcPA2kofPMVomh cnzQ== X-Gm-Message-State: AOAM533hCF0nEteXDTONGaDLEw/vy1qfN3Ae0IFDvpE03mhHTpVXJATK 6girknYtGTSkyI2loB0LS2dsHyN4I79po5kdvam+qw== X-Google-Smtp-Source: ABdhPJw5R/5Ez4aDdMGu21cR5k0AUCPks8j2VqSHJM0t1OaVkhoHiaB7U2J+4k9K0u43oPA3YLYttkRf9QTiPALFrsk= 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-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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.