Skip to contentSkip to conversation

TAKE 956783 - xfs_dm_getall_dmattr() doesn't check if the user buffer is at valid address

DISCUSSION Vlad Apostolov 2 participants 4 messages Nov 21, 2006 – Nov 29, 2006

lore
Share & tools
lore
#0 lore raw

No EFAULT error when dm_getall_dmattr() called with an invalid user buffer address.

Date:  Tue Nov 21 17:14:34 AEDT 2006
Workarea:  soarer.melbourne.sgi.com:/home/vapo/isms/linux-xfs-dmapi
Inspected by:  donaldd
Author:  vapo

The following file(s) were checked into:
longdrop.melbourne.sgi.com:/isms/linux/2.6.x-xfs-melb

Modid: xfs-linux-melb:xfs-kern:27510a fs/xfs/dmapi/xfs_dm.c - 1.28 - changed
http://oss.sgi.com/cgi-bin/cvsweb.cgi/xfs-linux/dmapi/xfs_dm.c.diff?r1=text&tr1=1.28&r2=text&tr2=1.27&f=h
- pv 956783, rv donaldd - Check user buffer address in
dm_getall_dmattr() for EFAULT error

#1 lore raw
Quoted 2 lines · Vlad Apostolov

No EFAULT error when dm_getall_dmattr() called with an invalid user buffer address.

This fix is broken. access_ok is not enough to verify the buffer, it just does very few static check (basically the address space limit)

You need to use copy_{from,to}_user to access user pointers. I had an untested patch to fix this at my good old SGI time, but Dean wanted to review and test it a lot more. I'll try to dig up that patch if you care.

#2 lore raw
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · Vlad Apostolov

No EFAULT error when dm_getall_dmattr() called with an invalid user buffer address.

Quoted 7 lines

This fix is broken. access_ok is not enough to verify the buffer, it just does very few static check (basically the address space limit)

You need to use copy_{from,to}_user to access user pointers. I had an untested patch to fix this at my good old SGI time, but Dean wanted to review and test it a lot more. I'll try to dig up that patch if you care.

The fix is actually fine as it gives an early indication (even not complete)
that the user pointer is bad. There is another problem you are pointing at and it is the userspace pointer dereference later on without using copy_to_user(). If you have any patch fixing this problem it would be great.

Thanks and regards,
Vlad

#3 lore raw
Quoted 4 lines · Vlad Apostolov

The fix is actually fine as it gives an early indication (even not complete) that the user pointer is bad. There is another problem you are pointing at and it is the userspace pointer dereference later on without using copy_to_user(). If you have any patch fixing this problem it would be great.

Unfortunately I haven't found my patch, I'm sorry. I have on the other hand found various old trivial XFS patches of mine that I'll submit.