Re: [PATCH] Convert filldir[64]() from __put_user() to unsafe_put_user()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/6/19 6:17 PM, Linus Torvalds wrote:
On Sun, Oct 6, 2019 at 5:04 PM Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
[ ... ]
And yes, I'll fix that name copy loop in filldir to align the
destination first, *but* if I'm right, it means that something like
this should also likely cause issues:

   #define _GNU_SOURCE
   #include <unistd.h>
   #include <sys/mman.h>

   int main(int argc, char **argv)
   {
         void *mymap;
         uid_t *bad_ptr = (void *) 0x01;

         /* Create unpopulated memory area */
         mymap = mmap(NULL, 16384, PROT_READ | PROT_WRITE, MAP_PRIVATE
| MAP_ANONYMOUS, -1, 0);

         /* Unaligned uidpointer in that memory area */
         bad_ptr = mymap+1;

         /* Make the kernel do put_user() on it */
         return getresuid(bad_ptr, bad_ptr+1, bad_ptr+2);
   }

because that simple user mode program should cause that same "page
fault on unaligned put_user()" behavior as far as I can tell.

Mind humoring me and trying that on your alpha machine (or emulator,
or whatever)?


Here you are. This is with v5.4-rc2 and your previous patch applied
on top.

/ # ./mmtest
Unable to handle kernel paging request at virtual address 0000000000000004
mmtest(75): Oops -1
pc = [<0000000000000004>]  ra = [<fffffc0000311584>]  ps = 0000    Not tainted
pc is at 0x4
ra is at entSys+0xa4/0xc0
v0 = fffffffffffffff2  t0 = 0000000000000000  t1 = 0000000000000000
t2 = 0000000000000000  t3 = 0000000000000000  t4 = 0000000000000000
t5 = 000000000000fffe  t6 = 0000000000000000  t7 = fffffc0007edc000
s0 = 0000000000000000  s1 = 00000001200006f0  s2 = 00000001200df19f
s3 = 00000001200ea0b9  s4 = 0000000120114630  s5 = 00000001201145d8
s6 = 000000011f955c50
a0 = 000002000002c001  a1 = 000002000002c005  a2 = 000002000002c009
a3 = 0000000000000000  a4 = ffffffffffffffff  a5 = 0000000000000000
t8 = 0000000000000000  t9 = fffffc0000000000  t10= 0000000000000000
t11= 000000011f955788  pv = fffffc0000349450  at = 00000000f8db54d3
gp = fffffc0000f2a160  sp = 00000000ab237c72
Disabling lock debugging due to kernel taint
Trace:

Code:
 00000000
 00063301
 000007b6
 00001111
 00003f8d

Segmentation fault

Guenter



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux