Re: WARNING in notify_change

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

 



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;
}

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux