lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120913180148.GB2761@neilslaptop.think-freely.org>
Date:	Thu, 13 Sep 2012 14:01:48 -0400
From:	Neil Horman <nhorman@...driver.com>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Alex Kelly <alex.page.kelly@...il.com>,
	Andi Kleen <andi@...stfloor.org>,
	Cong Wang <amwang@...hat.com>,
	Denys Vlasenko <vda.linux@...glemail.com>,
	Jiri Moskovcak <jmoskovc@...hat.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH -mm] coredump: add support for %d=__get_dumpable() in
 core name

On Thu, Sep 13, 2012 at 07:28:17PM +0200, Oleg Nesterov wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=787135
> 
> Some coredump handlers want to create a core file in a way compatible
> with standard behavior. Standard behavior with fs.suid_dumpable = 2
> is to create core file with uid=gid=0. However, there was no way for
> coredump handler to know that the process being dumped was suid'ed.
> 
> This patch adds the new %d specifier for format_corename() which
> simply reports __get_dumpable(mm->flags), this is compatible with
> /proc/sys/fs/suid_dumpable we already have.
> 
> By-discussion-with: Denys Vlasenko <vda.linux@...glemail.com>
> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
> ---
>  fs/coredump.c |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/coredump.c b/fs/coredump.c
> index 1935b4d..aad8715 100644
> --- a/fs/coredump.c
> +++ b/fs/coredump.c
> @@ -149,7 +149,7 @@ put_exe_file:
>   * name into corename, which must have space for at least
>   * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator.
>   */
> -static int format_corename(struct core_name *cn, long signr)
> +static int format_corename(struct core_name *cn, struct coredump_params *cprm)
>  {
>  	const struct cred *cred = current_cred();
>  	const char *pat_ptr = core_pattern;
> @@ -194,9 +194,13 @@ static int format_corename(struct core_name *cn, long signr)
>  			case 'g':
>  				err = cn_printf(cn, "%d", cred->gid);
>  				break;
> +			case 'd':
> +				err = cn_printf(cn, "%d",
> +					__get_dumpable(cprm->mm_flags));
> +				break;
>  			/* signal that caused the coredump */
>  			case 's':
> -				err = cn_printf(cn, "%ld", signr);
> +				err = cn_printf(cn, "%ld", cprm->signr);
>  				break;
>  			/* UNIX time of coredump */
>  			case 't': {
> @@ -524,7 +528,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
>  	 */
>  	clear_thread_flag(TIF_SIGPENDING);
>  
> -	ispipe = format_corename(&cn, signr);
> +	ispipe = format_corename(&cn, &cprm);
>  
>   	if (ispipe) {
>  		int dump_count;
> -- 
> 1.5.5.1
> 
> 
> 
Looks reasonable
Acked-by: Neil Horman <nhorman@...driver.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ