Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755029AbbBUALg (ORCPT ); Fri, 20 Feb 2015 19:11:36 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:45746 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754737AbbBUALe (ORCPT ); Fri, 20 Feb 2015 19:11:34 -0500 Date: Fri, 20 Feb 2015 16:11:32 -0800 From: Andrew Morton To: Iulia Manda Cc: geert@linux-m68k.org, paulmck@linux.vnet.ibm.com, josh@joshtriplett.org, peterz@infradead.org, mhocko@suse.cz, linux-kernel@vger.kernel.org, serge.hallyn@canonical.com, dvhart@linux.intel.com, tim.bird@sonymobile.com Subject: Re: [PATCH v4] kernel: Conditionally support non-root users, groups and capabilities Message-Id: <20150220161132.d636e85fd4f9698d889243d2@linux-foundation.org> In-Reply-To: <20150211150336.GA2406@winterfell> References: <20150211150336.GA2406@winterfell> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2058 Lines: 49 On Wed, 11 Feb 2015 17:03:36 +0200 Iulia Manda wrote: > There are a lot of embedded systems that run most or all of their functionality > in init, running as root:root. For these systems, supporting multiple users is > not necessary. > > This patch adds a new symbol, CONFIG_MULTIUSER, that makes support for non-root > users, non-root groups, and capabilities optional. It is enabled under > CONFIG_EXPERT menu. > > When this symbol is not defined, UID and GID are zero in any possible case > and processes always have all capabilities. > > The following syscalls are compiled out: setuid, setregid, setgid, > setreuid, setresuid, getresuid, setresgid, getresgid, setgroups, getgroups, > setfsuid, setfsgid, capget, capset. > > Also, groups.c is compiled out completely. > > In kernel/capability.c, capable function was moved in order to avoid adding two > ifdef blocks. > > This change saves about 25 KB on a defconfig build. > > The kernel was booted in Qemu. All the common functionalities work. Adding > users/groups is not possible, failing with -ENOSYS. > > Bloat-o-meter output: > add/remove: 7/87 grow/shrink: 19/397 up/down: 1675/-26325 (-24650) The objective seems OK to me - in some kernel applications non-root users are never needed and it's better to not force those systems to carry a lump of code they will never use. How significant is the 25k saving? On a realistic kernel build for such a target, what proportion of kernel memory usage are we talking about here? Did you look at moving sys_setregid into groups.c (or elsewhere) to save an ifdef? I assume that more savings can be squeezed out - there will be fields in the task_struct and other places which will never be used. ifdefing those out will get messy. Have you done any investigation here? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/