Setting security XATTR on ubifs

Artem Bityutskiy dedekind1 at gmail.com
Mon May 30 05:12:24 EDT 2011


On Fri, 2011-05-27 at 06:08 -0700, Subodh Nijsure wrote:
> Yup I did run UBIFS with debug & extra checks and discovered few issues.
> Found that setxattr/getxattr require that we should have already taken
> host->i_mutex. So I have updated my ubifs_init_security() accordingly.

Great!

> One of the problem turned out to be in change_xattr function, ui->data_len
> was updated at wrong place, and hence when after unmount, mount the
> length of the XATTR was wrong. I test
> 
> Diff below fixes that immediate issue. I tested this with
> As I mentioned, will post entire patch that allows ubifs to work with
> SELinux by end of this week.
> 
> diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c
> index 3299f46..a413278 100644
> --- a/fs/ubifs/xattr.c
> +++ b/fs/ubifs/xattr.c
> @@ -211,11 +211,11 @@ static int change_xattr(struct ubifs_info *c,
> struct inode *host,
>         }
>         memcpy(ui->data, value, size);
>         inode->i_size = ui->ui_size = size;
> -       ui->data_len = size;
> 
>         mutex_lock(&host_ui->ui_mutex);
>         host->i_ctime = ubifs_current_time(host);
>         host_ui->xattr_size -= CALC_XATTR_BYTES(ui->data_len);
> +       ui->data_len = size;
>         host_ui->xattr_size += CALC_XATTR_BYTES(size);

Could you please submit a separate patch for this with

Cc: stable at kernel.org

> Now I am looking at much bigger issue where, if I create char device
> and assign it XATTR, on umount the file system is getting marked
> corrupted. This is with testing on NANDSIM, it happens on actual HW
> too. It appears that node_scan doesn't seem to be reading XATTR data
> and accounting for it when computing checksum.

If you send me a test program I might look at this, but no promises.
Thanks!

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)




More information about the linux-mtd mailing list