Re: [PATCH v8 2/3] mm: add a field to store names for private anonymous memory

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

 



On Fri, Aug 27, 2021 at 12:18:57PM -0700, Suren Baghdasaryan wrote:
> +		anon_name = vma_anon_name(vma);
> +		if (anon_name) {
> +			seq_pad(m, ' ');
> +			seq_puts(m, "[anon:");
> +			seq_write(m, anon_name, strlen(anon_name));
> +			seq_putc(m, ']');
> +		}

...

> +	case PR_SET_VMA_ANON_NAME:
> +		name = strndup_user((const char __user *)arg,
> +				    ANON_VMA_NAME_MAX_LEN);
> +
> +		if (IS_ERR(name))
> +			return PTR_ERR(name);
> +
> +		for (pch = name; *pch != '\0'; pch++) {
> +			if (!isprint(*pch)) {
> +				kfree(name);
> +				return -EINVAL;

I think isprint() is too weak a check.  For example, I would suggest
forbidding the following characters: ':', ']', '[', ' '.  Perhaps
isalnum() would be better?  (permit a-zA-Z0-9)  I wouldn't necessarily
be opposed to some punctuation characters, but let's avoid creating
confusion.  Do you happen to know which characters are actually in use
today?




[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