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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081125004024.GA4440@x200.localdomain>
Date:	Tue, 25 Nov 2008 03:45:11 +0300
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	Andrey Mirkin <major@...nvz.org>
Cc:	orenl@...columbia.edu, containers@...ts.linux-foundation.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] Add support for in-kernel process creation during
	restart

On Mon, Nov 24, 2008 at 06:39:35PM +0300, Andrey Mirkin wrote:
> +static int cr_rstr_task_struct(struct cr_ctx *ctx, struct cr_hdr_task *ht)
> +{
> +	struct task_struct *t = current;
> +	char *buf;
> +	int ret = -EINVAL;
> +
> +	/* upper limit for task_comm_len to prevent DoS */
> +	if (ht->task_comm_len < 0 || ht->task_comm_len > PAGE_SIZE)
> +		goto out;
> +
> +	buf = kmalloc(ht->task_comm_len, GFP_KERNEL);
> +	if (!buf)
> +		goto out;
> +	ret = cr_read_string(ctx, buf, ht->task_comm_len);
> +	if (!ret) {
> +		/* if t->comm is too long, silently truncate */
> +		memset(t->comm, 0, TASK_COMM_LEN);
> +		memcpy(t->comm, buf, min(ht->task_comm_len, TASK_COMM_LEN));
> +	}
> +	kfree(buf);
> +
> +	/* FIXME: restore remaining relevant task_struct fields */
> +out:
> +	return ret;
> +}

->comm is only 16 bytes wide, you can just use on-stack variable.
--
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