From patchwork Sun Oct 9 13:31:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugene Syromyatnikov X-Patchwork-Id: 9369115 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8AA1560487 for ; Mon, 10 Oct 2016 08:33:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D5A429325 for ; Mon, 10 Oct 2016 08:33:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71FD12933E; Mon, 10 Oct 2016 08:33:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EFEB729325 for ; Mon, 10 Oct 2016 08:33:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u9A8Uk94017136; Mon, 10 Oct 2016 04:30:46 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u99DVLIi017006 for ; Sun, 9 Oct 2016 09:31:21 -0400 Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u99DVLsW005697 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 9 Oct 2016 09:31:21 -0400 Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C047D9974; Sun, 9 Oct 2016 13:31:20 +0000 (UTC) Received: by mail-lf0-f67.google.com with SMTP id x79so2029866lff.2; Sun, 09 Oct 2016 06:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hwgYgUGJJ3raQlvxpHUc91q5Xrm8P6zDI4w2VHSf7iQ=; b=fwkZiZBxoK2s4YS0eLx5LhN1aTCH8r8IeYrH1/IWHJXpjV/ZzK+tmHlDWJO8JU/9gE AiXxoX53GKQe+TNQZ/pASGQmyhLNcsOmEGG6+4W11zQ0rZC7FBtaey5p0LP7jKWIGDgx tGmT3Rtu4eODdnl/ZiXrNaNhiZfsD960hDU4nwQk0o+7hE2sMOJisPSPnDuXxWWjgcdC 2N6ao+PqaQe0unzbps7PkFOqICxrYDIpzeKjikvPcSY6G9CFeK936YZ8bLRZk66/4U7o 4jIVAe+6ZhUUns7XxPk7l0QXMJFzdMxscrYbtFEmEBJUUGd6VSxiaZftrmbRDNC12N51 b/fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hwgYgUGJJ3raQlvxpHUc91q5Xrm8P6zDI4w2VHSf7iQ=; b=YyMPlppnwwNS/Kp7KW2gI4Tn1Mfvs3k+/EG+4AjfsUCL+le3VtJcllpfErUeYnn8qa VpdSQC0KEKW/6xrPzWoEA/S+s21X/vg8PWLz9eA0nXAfBMaCqyIFRW8gdbsohDnq7EWH oUdkJfMt3HnOXR5kgMa8G7FAng6a1JRqy+NVuroByTqlfLCOqx06om7HCwmhfTSWiTp6 rss3llkAKr8IeyVxbp3pxO3AfR/ad0qeN+mLkTD5iF36p56Qs7FDq8nSu+E/grkagShZ Bz4cYxjC7XwQ1o84dJrqAjpwdnmgiY3Yq4abdMn7d1ehRmFZzia1I3BeM8E0OrIUwZgW xppw== X-Gm-Message-State: AA6/9RngL/cfVkfq07nxjauA/CGtIRG2Wk/XttqExA3Nbg1rJWwWVALX3YTj9ZfQU2QYnA== X-Received: by 10.25.157.4 with SMTP id g4mr1465973lfe.103.1476019878421; Sun, 09 Oct 2016 06:31:18 -0700 (PDT) Received: from obsidian (broadband-46-188-15-144.2com.net. [46.188.15.144]) by smtp.gmail.com with ESMTPSA id s83sm3349830lja.35.2016.10.09.06.31.17 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 09 Oct 2016 06:31:17 -0700 (PDT) Date: Sun, 9 Oct 2016 16:31:16 +0300 From: Eugene Syromyatnikov To: strace-devel@lists.sourceforge.net Message-ID: <20161009133116.GA4266@obsidian> References: <20161005.192828.566127461630656590.yamato@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20161005.192828.566127461630656590.yamato@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sun, 09 Oct 2016 13:31:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sun, 09 Oct 2016 13:31:20 +0000 (UTC) for IP:'209.85.215.67' DOMAIN:'mail-lf0-f67.google.com' HELO:'mail-lf0-f67.google.com' FROM:'evgsyr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.17 * (BAYES_50, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.215.67 mail-lf0-f67.google.com 209.85.215.67 mail-lf0-f67.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 10 Oct 2016 04:29:54 -0400 Cc: dm-devel@redhat.com, mpatocka@redhat.com, yamato@redhat.com Subject: [dm-devel] [PATCH 17/21] dm: Add data_size and data_offset fields to output X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP --- dm.c | 4 +++- tests/ioctl_dm.c | 41 ++++++++++++++++++++++++----------------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/dm.c b/dm.c index 5c908c9..caffc55 100644 --- a/dm.c +++ b/dm.c @@ -327,7 +327,6 @@ dm_known_ioctl(struct tcb *tcp, const unsigned int code, long arg) tprintf("%s{version=%d.%d.%d", entering(tcp) ? ", " : " => ", ioc->version[0], ioc->version[1], ioc->version[2]); - /* * if we use a different version of ABI, do not attempt to decode * ioctl fields @@ -337,6 +336,9 @@ dm_known_ioctl(struct tcb *tcp, const unsigned int code, long arg) goto skip; } + tprintf(", data_size=%u, data_start=%u", + ioc->data_size, ioc->data_start); + if (ioc->data_size < (sizeof(*ioc) - sizeof(ioc->data))) { tprints(", /* Incorrect data_size */ ..."); goto skip; diff --git a/tests/ioctl_dm.c b/tests/ioctl_dm.c index 94dbe93..6967ca2 100644 --- a/tests/ioctl_dm.c +++ b/tests/ioctl_dm.c @@ -42,8 +42,9 @@ main(void) s.ioc.data_start = 0; ioctl(-1, DM_VERSION, &s); printf("ioctl(-1, DM_VERSION, " - "{version=4.1.2, dev=makedev(18, 52), name=\"nnn\", " - "uuid=\"uuu\", flags=0}) = -1 EBADF (%m)\n"); + "{version=4.1.2, data_size=%zu, data_start=0, " + "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", flags=0}) = " + "-1 EBADF (%m)\n", sizeof(s.ioc)); init_s(); s.ioc.target_count = 1; @@ -55,10 +56,11 @@ main(void) strcpy(s.u.ts.target_params, "tparams"); ioctl(-1, DM_TABLE_LOAD, &s); printf("ioctl(-1, DM_TABLE_LOAD, " - "{version=4.1.2, dev=makedev(18, 52), name=\"nnn\", " - "uuid=\"uuu\", target_count=1, flags=0, {sector_start=16, " + "{version=4.1.2, data_size=%u, data_start=%u, " + "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", " + "target_count=1, flags=0, {sector_start=16, " "length=32, target_type=\"tgt\", string=\"tparams\"}}) = " - "-1 EBADF (%m)\n"); + "-1 EBADF (%m)\n", s.ioc.data_size, s.ioc.data_start); init_s(); s.u.tm.target_msg.sector = 0x1234; @@ -66,34 +68,39 @@ main(void) "tmsg"); ioctl(-1, DM_TARGET_MSG, &s); printf("ioctl(-1, DM_TARGET_MSG, " - "{version=4.1.2, dev=makedev(18, 52), name=\"nnn\", " - "uuid=\"uuu\", flags=0, {sector=4660, message=\"tmsg\"}}) = " - "-1 EBADF (%m)\n"); + "{version=4.1.2, data_size=%u, data_start=%u, " + "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", flags=0, " + "{sector=4660, message=\"tmsg\"}}) = -1 EBADF (%m)\n", + s.ioc.data_size, s.ioc.data_start); init_s(); strcpy(s.u.string, "10 20 30 40"); ioctl(-1, DM_DEV_SET_GEOMETRY, &s); printf("ioctl(-1, DM_DEV_SET_GEOMETRY, " - "{version=4.1.2, dev=makedev(18, 52), name=\"nnn\", " - "uuid=\"uuu\", flags=0, string=\"10 20 30 40\"}) = " - "-1 EBADF (%m)\n"); + "{version=4.1.2, data_size=%u, data_start=%u, " + "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", flags=0, " + "string=\"10 20 30 40\"}) = -1 EBADF (%m)\n", + s.ioc.data_size, s.ioc.data_start); init_s(); strcpy(s.u.string, "new-name"); ioctl(-1, DM_DEV_RENAME, &s); printf("ioctl(-1, DM_DEV_RENAME, " - "{version=4.1.2, dev=makedev(18, 52), name=\"nnn\", " - "uuid=\"uuu\", event_nr=0, flags=0, string=\"new-name\"}) = " - "-1 EBADF (%m)\n"); + "{version=4.1.2, data_size=%u, data_start=%u, " + "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", event_nr=0, " + "flags=0, string=\"new-name\"}) = -1 EBADF (%m)\n", + s.ioc.data_size, s.ioc.data_start); init_s(); s.ioc.target_count = -1U; ioctl(-1, DM_TABLE_LOAD, &s); printf("ioctl(-1, DM_TABLE_LOAD, " - "{version=4.1.2, dev=makedev(18, 52), name=\"nnn\", " - "uuid=\"uuu\", target_count=4294967295, flags=0, " + "{version=4.1.2, data_size=%u, data_start=%u, " + "dev=makedev(18, 52), name=\"nnn\", uuid=\"uuu\", " + "target_count=4294967295, flags=0, " "{sector_start=0, length=0, target_type=\"\", string=\"\"}, " - "/* misplaced struct dm_target_spec */ ...}) = -1 EBADF (%m)\n"); + "/* misplaced struct dm_target_spec */ ...}) = -1 EBADF (%m)\n", + s.ioc.data_size, s.ioc.data_start); puts("+++ exited with 0 +++"); return 0;