lkml.org 
[lkml]   [2019]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: WARNING in notify_change
I was able to reproduce this by setting security.capability xattr on a
blockdev file, then writing to it - when writing to the blockdev we
never lock the inode, so when we clear the capability we hit this
lockdep warning.

Is the issue here that we can set this xattr in the first place so we
have to clear it at all? Or should we really be locking the inode for
blockdevs after all? I'm not too familiar, but my gut says former

this reproducer is able to immediately crash machine running
linux-next-20190415:

#include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <attr/xattr.h>

char *disk = "/dev/loop0";

int main(void) {
int fd = open(disk, 0);
if (fd < 0)
printf("open: %d\n", errno);

system("dd if=/dev/zero of=a_file count=51200");
system("losetup /dev/loop0 a_file");

uint32_t value[5] = {
0x2000000,
7,
0x20d0,
6,
4
};

int res = fsetxattr(fd, "security.capability", &value,
sizeof(value), XATTR_CREATE);
if (res < 0)
printf ("xattr: %d\n", errno);

int fd2 = open(disk, O_RDWR);
write(fd2, "hello", 5);
return 0;
}
[unhandled content-type:application/pkcs7-signature]
\
 
 \ /
  Last update: 2019-04-16 01:21    [W:0.059 / U:0.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site