Patchwork [1/1] UBUNTU: SAUCE: (no-up) elide some ioctl warnings which are known benign

login
register
mail settings
Submitter Andy Whitcroft
Date April 3, 2012, 10:42 a.m.
Message ID <1333449761-9685-2-git-send-email-apw@canonical.com>
Download mbox | patch
Permalink /patch/150378/
State New
Headers show

Comments

Andy Whitcroft - April 3, 2012, 10:42 a.m.
We have been seeing increasing reports of scarey ioctl messages in
dmesg, such as the below often in bulk:

    mdadm: sending ioctl 1261 to a partition!
    mdadm: sending ioctl 800c0910 to a partition!

Looking at the upstream discussions these are all benign and can be safely
suppressed.  This patch is based on some discussions at the link below,
on some work SUSE did in this area.  This is not suitable for upstreaming
as we need some refactoring to fix the 32bit compat ioctl mess.

Link: http://www.spinics.net/lists/raid/msg37770.html
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 block/scsi_ioctl.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
Tim Gardner - April 3, 2012, 12:05 p.m.
I added a bug link since we can use this same justification for at least
Oneiric which I think emits the same warnings.

BugLink: http://bugs.launchpad.net/bugs/972355

rtg
Andy Whitcroft - April 3, 2012, 12:43 p.m.
On Tue, Apr 03, 2012 at 06:05:32AM -0600, Tim Gardner wrote:
> I added a bug link since we can use this same justification for at least
> Oneiric which I think emits the same warnings.
> 
> BugLink: http://bugs.launchpad.net/bugs/972355

It is likely this is exposed all the way back to 2.6.32 as I think these
underlying patches are applied as part of the CVE work.

-apw
Andy Whitcroft - April 3, 2012, 3:06 p.m.
On Tue, Apr 03, 2012 at 01:43:29PM +0100, Andy Whitcroft wrote:
> On Tue, Apr 03, 2012 at 06:05:32AM -0600, Tim Gardner wrote:
> > I added a bug link since we can use this same justification for at least
> > Oneiric which I think emits the same warnings.
> > 
> > BugLink: http://bugs.launchpad.net/bugs/972355
> 
> It is likely this is exposed all the way back to 2.6.32 as I think these
> underlying patches are applied as part of the CVE work.

Actually the CVE is not yet across all those releases.  I'll handle them
together.

-apw

Patch

diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 688be8a..3d062ad 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -27,6 +27,9 @@ 
 #include <linux/ratelimit.h>
 #include <linux/slab.h>
 #include <linux/times.h>
+#include <linux/fd.h>
+#include <linux/raid/md_u.h>
+#include <linux/mtio.h>
 #include <asm/uaccess.h>
 
 #include <scsi/scsi.h>
@@ -710,8 +713,17 @@  int scsi_verify_blk_ioctl(struct block_device *bd, unsigned int cmd)
 	case SG_GET_RESERVED_SIZE:
 	case SG_SET_RESERVED_SIZE:
 	case SG_EMULATED_HOST:
+	case BLKFLSBUF:
+	case BLKROSET:
 		return 0;
 	case CDROM_GET_CAPABILITY:
+	case CDROM_DRIVE_STATUS:
+	case FDGETPRM:
+	case RAID_VERSION:
+	case MTIOCGET:
+#ifdef CONFIG_COMPAT
+	case 0x801c6d02:        /* MTIOCGET32 */
+#endif
 		/* Keep this until we remove the printk below.  udev sends it
 		 * and we do not want to spam dmesg about it.   CD-ROMs do
 		 * not have partitions, so we get here only for disks.