Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3819946pxk; Tue, 8 Sep 2020 03:27:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0UhUpdmtNN2zio5aS3o7Ii58rgMsWOKacYlmipZr4Nts1FVtCYvpKJo9mDxQ0qx0um4Ik X-Received: by 2002:a17:906:2552:: with SMTP id j18mr24479915ejb.476.1599560867407; Tue, 08 Sep 2020 03:27:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599560867; cv=none; d=google.com; s=arc-20160816; b=RBF0ZM2Hg4J76j6bdMfa8ABX5op/D91FHIR/xK3z8sUxaBiVHZrFNUkdYzo36abOkw WNehJLJ4SKlmj83ivvXOoPWp2XMeLBeIJYL3+zNAQ7OzX8N+nHswF6lCqf316tANCmfs a2sYm/cHqpT8jobAzpnnPArDCUY47/t+DI6r4AYF8T+PtDu0+xIOlrTsDPmJ9NsYjy8a nPHln43eTJjvpYMx3YhyD/xxHpPZCWiJqoSsuoqyJ+MdGOL8RD6KCYSckLeTgq/AcVTC gpW75SB2CPdX9QzZUKKXN0uKDVoG+mj7mKuuwgG/XUA4DwNRADtyI+EAGJKAVs5JINOX xoKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3PMzoeG0jLYH6a5jncrRPYuy7xbDoeom4wasamz/iBA=; b=rtllxHNX2o91lCq2Kx7K8NrfFmpfOCpNhlvvh7gPL/xalP7cZjyCLzShwaIEtKqV+B +W6kABkIoQy7z0qM9O951DUfO4rcd+BWdN/L2/UnHHY6NE7Vcc/JRZatq6ZE3XapnZY3 yv4fazcXueF4RaHKzuqji8gWshJcksBcFEFJLQShg0rwFRFfZwZusn8mfc0FBivywO7O Li8iBONro3Dpk+w1s1o4EVgwRJwlgvpGVpcQTLP9fIkgOBO/9XzAGT+VThJiyMYfo+EJ MvpnNP1merkzz01OuHYbFeYvvPBf1NNg6SHheWH0JjIo9HS7h/m3oaIr7T1wtkPdPrro 9m9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=UPjh9SJA; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d7si10806475ejc.635.2020.09.08.03.27.24; Tue, 08 Sep 2020 03:27:47 -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=fail header.i=@infradead.org header.s=casper.20170209 header.b=UPjh9SJA; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729233AbgIHKZx (ORCPT + 99 others); Tue, 8 Sep 2020 06:25:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729031AbgIHKZv (ORCPT ); Tue, 8 Sep 2020 06:25:51 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56BD7C061573; Tue, 8 Sep 2020 03:25:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=3PMzoeG0jLYH6a5jncrRPYuy7xbDoeom4wasamz/iBA=; b=UPjh9SJAsH6DRbPldgyO0bFYbz 7KeipEdsRPnr4iZ4TAKWE9HDIB1fr0vp9/zYDYNgB1ZG4onTRSLW0Dnc/JUIUqt/IH2MMwSGbssHX Fniw4/RGfZoJfdM4u4M0xwdH6FdB3DiT/MV8nUSOqmDlYLPvbHLjSkgx7Cb9qwaDryDE70wrPjgap gP+/74T0jJabj4DCVrcFzN0cIbIs4jYL2EBQMMsmHDDzNhsxKM3PEe3X1+vjbG8JWtXUm0THPl/aR sEo2QrKLub+CwnvETCVRJSuvURLxggHJ7WDnCa3sgHlT9hb9AlD1bTx01MyIPy1TGdjnEnh95wzD7 315lZ6cg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFaol-0005ND-2Y; Tue, 08 Sep 2020 10:25:39 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 205C8304B92; Tue, 8 Sep 2020 12:25:38 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 018B823D54AB1; Tue, 8 Sep 2020 12:25:37 +0200 (CEST) Date: Tue, 8 Sep 2020 12:25:37 +0200 From: peterz@infradead.org To: Christian =?iso-8859-1?Q?G=F6ttsche?= Cc: linux-kernel@vger.kernel.org, selinux@vger.kernel.org, linux-security-module@vger.kernel.org, Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman Subject: Re: [RFC PATCH] sched: only issue an audit on privileged operation Message-ID: <20200908102537.GU2674@hirez.programming.kicks-ass.net> References: <20200904160031.6444-1-cgzones@googlemail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200904160031.6444-1-cgzones@googlemail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 04, 2020 at 06:00:31PM +0200, Christian G?ttsche wrote: > sched_setattr(2) does via kernel/sched/core.c:__sched_setscheduler() > issue a CAP_SYS_NICE audit event unconditionally, even when the requested > operation does not require that capability / is un-privileged. > > Perform privilged/unprivileged catigorization first and perform a > capable test only if needed. > > Signed-off-by: Christian G?ttsche > --- > kernel/sched/core.c | 65 ++++++++++++++++++++++++++++++++------------- > 1 file changed, 47 insertions(+), 18 deletions(-) So who sodding cares about audit, and why is that a reason to make a trainwreck of code?