[PATCH] decode mtd/ubi ioctls

Dmitry V. Levin ldv at altlinux.org
Thu May 2 23:03:30 UTC 2013


On Wed, May 01, 2013 at 11:35:30PM -0400, Mike Frysinger wrote:
> Been playing with UBI of late and it'd help if I could see what it was
> doing.  Not entirely sure about the decoding of UBI_IOCVOLUP -- it takes
> a pointer to a 64bit value, not a strict.

Thanks, I've applied the patch.

[...]
> +int ubi_ioctl(struct tcb *tcp, long code, long arg)
> +{
> +	struct ubi_mkvol_req mkvol;
> +	struct ubi_rsvol_req rsvol;
> +	struct ubi_rnvol_req rnvol;
> +	struct ubi_attach_req attach;
> +	struct ubi_map_req map;
> +	struct ubi_set_vol_prop_req prop;
> +	/* 4*(n-1) + 3 for quotes and NUL */
> +	char vol_name[(UBI_MAX_VOLUME_NAME + 1) * 4];
> +
> +	if (entering(tcp))
> +		return 0;
> +
> +	switch (code) {
> +	case UBI_IOCMKVOL:
> +		if (!verbose(tcp) || umove(tcp, arg, &mkvol) < 0)
> +			return 0;

In this and many other similar cases, it looks like failed ioctl syscall
shouldn't be decoded in detail.  Please have a look whether my guess is
correct in case of mtd.c; if it is correct, then the code could be changed to

	if (entering(tcp) || syserror(tcp) || !verbose(tcp))
		return 0;

	switch (code) {
	case UBI_IOCMKVOL:
		if (umove(tcp, arg, &mkvol) < 0)
			return 0;

-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20130503/7e682964/attachment.bin>


More information about the Strace-devel mailing list