From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751382AbbEXQLI (ORCPT ); Sun, 24 May 2015 12:11:08 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:36848 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751116AbbEXQLF (ORCPT ); Sun, 24 May 2015 12:11:05 -0400 Message-ID: <5561F7BF.7020704@virtuozzo.com> Date: Sun, 24 May 2015 19:09:35 +0300 From: Vasily Averin Organization: Odin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Andrew Morton , Vasily Averin CC: linux-kernel@vger.kernel.org, Kees Cook , Josh Boyer , Eric Paris Subject: Re: [PATCH] kernel/printk/printk.c: check_syslog_permissions() cleanup References: <554EFC49.2020800@odin.com> <20150514150154.dbfb8ab275aa30d0fe93172b@linux-foundation.org> In-Reply-To: <20150514150154.dbfb8ab275aa30d0fe93172b@linux-foundation.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15.05.2015 01:01, Andrew Morton wrote: > On Sun, 10 May 2015 09:35:53 +0300 Vasily Averin wrote: >> --- a/kernel/printk/printk.c >> +++ b/kernel/printk/printk.c >> @@ -484,11 +484,11 @@ int check_syslog_permissions(int type, bool from_file) >> * already done the capabilities checks at open time. >> */ >> if (from_file && type != SYSLOG_ACTION_OPEN) >> - return 0; >> + goto ok; > > This seems wrong - we should only call security_syslog() for opens? No I think my version is correct. Currently security hook _is_ called in this situation: from_file is set in /proc/kmsg handlers only, they use do_syslog() and call security_syslog() directly after check_syslog_permissions() call. My patch forces check_syslog_permissions() to call security hook in all cases, that allows to remove extra security_syslog() call from do_syslog(). I've changed patch comment and going to resend new patch version soon.