From mboxrd@z Thu Jan 1 00:00:00 1970 From: Serge Hallyn Subject: Re: [RESEND] [PATCH] coredump: Add new %P variable in core_pattern Date: Thu, 15 Aug 2013 08:48:33 -0500 Message-ID: <20130815134833.GA11369@sergelap> References: <20130815125132.GA11139@castiana> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexander Viro , "Eric W. Biederman" , Serge Hallyn , Andy Whitcroft , Andrew Morton To: =?iso-8859-1?Q?St=E9phane?= Graber Return-path: Content-Disposition: inline In-Reply-To: <20130815125132.GA11139@castiana> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Thanks St=E9phane. There were no objections last time this was posted, right? Hopefully it can be applied this time. -serge Quoting St=E9phane Graber (stgraber@ubuntu.com): > This adds a new %P variable to be used in core_pattern. This variable= contains > the global PID (PID in the init namespace) as %p contains the PID in = the > current namespace which isn't always what we want. >=20 > The main use for this is to make it easier to handle crashes that hap= pened > within a container. With that new variables it's possible to have the= crashes > dumped into the container or forwarded to the host with the right PID > (from the host's point of view). >=20 > Reported-by: Hans Feldt > Cc: Alexander Viro > Cc: Eric W. Biederman > Cc: Andy Whitcroft > Acked-by: Serge E. Hallyn > Signed-off-by: St=E9phane Graber >=20 > --- > Documentation/sysctl/kernel.txt | 1 + > fs/coredump.c | 5 +++++ > 2 files changed, 6 insertions(+) >=20 > diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/k= ernel.txt > index ccd4258..833026d 100644 > --- a/Documentation/sysctl/kernel.txt > +++ b/Documentation/sysctl/kernel.txt > @@ -182,6 +182,7 @@ core_pattern is used to specify a core dumpfile p= attern name. > % '%' is dropped > %% output one '%' > %p pid > + %P global pid (init PID namespace) > %u uid > %g gid > %d dump mode, matches PR_SET_DUMPABLE and > diff --git a/fs/coredump.c b/fs/coredump.c > index c647965..528c6fc 100644 > --- a/fs/coredump.c > +++ b/fs/coredump.c > @@ -186,6 +186,11 @@ static int format_corename(struct core_name *cn,= struct coredump_params *cprm) > err =3D cn_printf(cn, "%d", > task_tgid_vnr(current)); > break; > + /* global pid */ > + case 'P': > + err =3D cn_printf(cn, "%d", > + task_tgid_nr(current)); > + break; > /* uid */ > case 'u': > err =3D cn_printf(cn, "%d", cred->uid); > --=20 > 1.8.1.2 >=20