Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1356266pxk; Thu, 10 Sep 2020 13:23:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjJ2ZZCyMzYw2d6TqWC8zkbNZvDUy6gUM9JH354LfQ1gUCVsWv+/ImB/0HSMh8WYThQAxj X-Received: by 2002:aa7:da16:: with SMTP id r22mr11532991eds.132.1599769397093; Thu, 10 Sep 2020 13:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599769397; cv=none; d=google.com; s=arc-20160816; b=lAu5MyxjHPUvv5Fhso4DatRmFCKe+byVdMD+LMzUPh0cJFixfnt/D0qOE3Gk0XXw/x eZlxPNVyg/VNQpMH3TwjcSMtk+1YMdkBxod7oZOiCjvtEHcNvHmSIAfMM1Yr4zuWT7Yo TrgMSuE9vkEa2OKF7wTvfzFmnXAMe5EScrbdQHuvYr4iccQF4O4injZR5fJMbIgyxaD9 oDv5GgAnblmQ5tqPeClr0G+gZbJaYSn+cn2mqD3bXq6RSHncx0t3LNdrG+sLcpjEO4tb Yyj0mZ6mBumAZSb3lVYpGN4zl4Ye5cHW46kKXXm4vwL5Dn2tXieEvN655MyfLShCH/pt 1hYw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=i8Xslrycj3wZ0DMCYzlf3YsQvnbbwZR8oamVvMIeqd8=; b=w0Zx0qjwcOSCcH9v64tHvhmbLbXjDBgDQdsrR2S9yR/of5of5oguZ4y/pcUrtNIfUJ QkwxRkWBBW2aeY8Mw+0G0Vqj74rgrFFC1aUmiioZ+MQZ1eQiBu5A64ve6rEiwsR6cmWg ykmBZxJBBXZCLPlh4DiT+jkjUrRoIAhYc88oSkKH0ISaNlqeI0zElVY9Edlrto41IaYF vt0X9JDxgR1fUtGMxmRCLVa1eh5YIFyxcZFC/sfvwUlMePxrgu5ztW+EIf7lQi+7aEyC LpcNCosXU73KCLMyJ9DiZ2r9KFTweDAO1Tykkw/pAPgcp6Sf8WnYeK0/LClWI9pM3gbg QhGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=N4ZcvLio; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z14si4339538eja.502.2020.09.10.13.22.54; Thu, 10 Sep 2020 13:23:17 -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=@chromium.org header.s=google header.b=N4ZcvLio; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726812AbgIJUWQ (ORCPT + 99 others); Thu, 10 Sep 2020 16:22:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726951AbgIJUVh (ORCPT ); Thu, 10 Sep 2020 16:21:37 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC532C06179E for ; Thu, 10 Sep 2020 13:21:19 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id v196so5512021pfc.1 for ; Thu, 10 Sep 2020 13:21:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i8Xslrycj3wZ0DMCYzlf3YsQvnbbwZR8oamVvMIeqd8=; b=N4ZcvLionYWpbEK4gXbRvbCv+cTM7NTQkjTbl0t2d2YCT5Z4d+Pb1z8TvbVJH3NLQu pGdG+OrRpe7FlA0k0vXQGINZGk4uSXR4KYfpS8yuHC0joRvBUjoVnIeUFSsCA/gsUHG4 bFvqJk8qJ7J0u2QmvU3MrRgUt8CMZ24ZyDXQs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i8Xslrycj3wZ0DMCYzlf3YsQvnbbwZR8oamVvMIeqd8=; b=XcLvHHjAmZ9Xv+uubREJK3fiHFgknwDdSkyOVCc3afr97llpu7T3JUk8E6+s30i4Wx Hi8mCkU1oH7+AgUwXYqZoBcTb747y2nw8n1q6U99L2EBMs9egwZ5a7EcbgS/gHkt+4Ih s9UMr2IYNHUFgwz7QyF0zPyYhtarK/9Y78+s7Fegv70wYH/hTE7IPg7H/3EknPV9Ertj CBaFrZrDmLpyhbHbkxSnbSyot8DguxYh8X9RZ2mVlEPWBifWMfDQpE06NEYrRQY90fom KCifTKBZAJHxuMb+DaIWmOHWqzvQVoWNKArGtkYZx4UXCjSnjcQ2r2AIvO4lEmidx1xA FpVA== X-Gm-Message-State: AOAM532ESRFJvHCXL5rGaUQMIEssSM89eWI69DepzRxxwxQKenwiuBqL QZualJG/MQUBOBDfs20v1kDp0w== X-Received: by 2002:a62:5f02:0:b029:13c:1611:6536 with SMTP id t2-20020a625f020000b029013c16116536mr6870569pfb.8.1599769278853; Thu, 10 Sep 2020 13:21:18 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id h1sm2709801pji.52.2020.09.10.13.21.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 13:21:16 -0700 (PDT) From: Kees Cook To: kernel-hardening@lists.openwall.com Cc: Kees Cook , 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, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org Subject: [RFC PATCH 3/6] security/fbfam: Use the api to manage statistics Date: Thu, 10 Sep 2020 13:21:04 -0700 Message-Id: <20200910202107.3799376-4-keescook@chromium.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200910202107.3799376-1-keescook@chromium.org> References: <20200910202107.3799376-1-keescook@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: John Wood Use the previous defined api to manage statistics calling it accordingly when a task forks, calls execve or exits. Signed-off-by: John Wood --- fs/exec.c | 2 ++ kernel/exit.c | 2 ++ kernel/fork.c | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/fs/exec.c b/fs/exec.c index a91003e28eaa..b30118674d32 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -71,6 +71,7 @@ #include "internal.h" #include +#include static int bprm_creds_from_file(struct linux_binprm *bprm); @@ -1940,6 +1941,7 @@ static int bprm_execve(struct linux_binprm *bprm, task_numa_free(current, false); if (displaced) put_files_struct(displaced); + fbfam_execve(); return retval; out: diff --git a/kernel/exit.c b/kernel/exit.c index 733e80f334e7..39a6139dcf31 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -67,6 +67,7 @@ #include #include #include +#include static void __unhash_process(struct task_struct *p, bool group_dead) { @@ -852,6 +853,7 @@ void __noreturn do_exit(long code) __this_cpu_add(dirty_throttle_leaks, tsk->nr_dirtied); exit_rcu(); exit_tasks_rcu_finish(); + fbfam_exit(); lockdep_free_task(tsk); do_task_dead(); diff --git a/kernel/fork.c b/kernel/fork.c index 49677d668de4..c933838450a8 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -107,6 +107,8 @@ #define CREATE_TRACE_POINTS #include +#include + /* * Minimum number of threads to boot the kernel */ @@ -941,6 +943,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node) #ifdef CONFIG_MEMCG tsk->active_memcg = NULL; #endif + + fbfam_fork(tsk); return tsk; free_stack: -- 2.25.1