Re: [PATCH v2] sanitize task->comm to avoid leaking escape codes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > This patch sanitizes task->comm to only contain printable characters
> > when it is set.  Additionally, it redefines get_task_comm so that it is
> > more obvious when misused by callers (presently nothing was incorrectly
> > calling get_task_comm's unsafe use of strncpy).
> 
> This is a regression for tools that correctly handle unmutilated data.
> 
> > +	/* sanitize non-printable characters */
> > +	for (i = 0; buf[i] && i < (sizeof(tsk->comm) - 1); i++) {
> > +		if (!isprint(buf[i]))
> > +			tsk->comm[i] = '?';
> 
> The kernel "isprint" isn't adequate for this. comm is set by the shell
> based on argv[0] usually which means that in normal situations it is a
> UTF-8 string.

Ah, I recall one use case. In past, some IBM folks talked about they
want to map Java thread name to prctl(PR_SET_NAME). In such case, 
utf-8 name is very common.

So, I agree with you.

Thanks.



--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux