Date: Tue, 28 Feb 2012 09:29:26 +0200 From: Mikolaj Golub <trociny@freebsd.org> To: Julian Elischer <julian@freebsd.org> Cc: src-committers@freebsd.org, Pawel Jakub Dawidek <pjd@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Robert Watson <rwatson@freebsd.org>, Konstantin Belousov <kostikbel@gmail.com> Subject: Re: svn commit: r232181 - in head/sys: kern sys Message-ID: <86zkc3bell.fsf@in138.ua3> In-Reply-To: <4F4C7571.7010407@freebsd.org> (Julian Elischer's message of "Mon, 27 Feb 2012 22:34:25 -0800") References: <201202261425.q1QEPm9g069102@svn.freebsd.org> <20120227082811.GC1363@garage.freebsd.pl> <864nucd5jc.fsf@in138.ua3> <20120227092951.GB55074@deviant.kiev.zoral.com.ua> <4F4C7571.7010407@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 27 Feb 2012 22:34:25 -0800 Julian Elischer wrote: JE> On 2/27/12 1:29 AM, Konstantin Belousov wrote: >> On Mon, Feb 27, 2012 at 10:49:59AM +0200, Mikolaj Golub wrote: >>> On Mon, 27 Feb 2012 09:28:11 +0100 Pawel Jakub Dawidek wrote: >>> >>> PJD> On Sun, Feb 26, 2012 at 02:25:48PM +0000, Mikolaj Golub wrote: >>> >> Author: trociny >>> >> Date: Sun Feb 26 14:25:48 2012 >>> >> New Revision: 232181 >>> >> URL: http://svn.freebsd.org/changeset/base/232181 >>> >> >>> >> Log: >>> >> Add sysctl to retrieve or set umask of another process. >>> >>> PJD> "set umask of another process"? This seems... weird. What's the purpose >>> PJD> of this change? >>> >>> When we were discussing this with Kostik and Robert, and I asked if it could >>> be useful to have the sysctl rw, Kostik described a real situation when he had >>> had to change umask of another process: umask had not been set properly on an >>> aplication start but it could not be restarted until the end of the day. >>> Kostik was able to fix it using gdb but having an easier way looked useful. >> kgdb, not gdb. >> >> It is indeed possible to write a ptrace-based utility that inject a code >> payload that would change umask. Since this is very risky but indeed possible, >> having the straighforward kernel facility is justified. JE> Why not have a sysctl to change a process' uid, cwd, memory limits, JE> etc. etc. We already can change limits. Ability to change cwd and may be uid I think could be useful too. This not necessary should be a sysctl though. JE> I don't think this belongs in the kernel by default. It's not exactl a JE> call for backout but It's teh next thing short of that. a call for "do JE> you REALLY think we need this particular specific case catered for?" The main goal of the patch was to provide ability to get another process umask. It looks like usefulness of this is not questioned here. When ways to do this were discussed with Kostik and Robert options to extend kinfo_proc or add another sysctl were considered. Adding a new sysctl won because it does not break ABI, may be controlled by p_candebug() and actually kinfo_proc did not look like a right place for umask. So when it was decided to make a new sysctl the question arose if it should be RW or RO. Making it RW was just a matter of couple lines, and as there were cases when this could be useful why not? I should mention that Robert was not very happy with having this RW but did not object strongly. Sorry, it was my mistake I did not discuss this in public before committing. Will do the next time. Although I still think it is a useful thing. I don't think it is bad to have debugging tools that provide ability to control another process without tricks with kgdb or code injection. -- Mikolaj Golub
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86zkc3bell.fsf>