linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Report bug to Linux ext4 file system about inode
@ 2021-09-05 13:29 肖杰韬
  2021-09-05 14:36 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: 肖杰韬 @ 2021-09-05 13:29 UTC (permalink / raw)
  To: tytso, adilger.kernel; +Cc: linux-ext4, security

Hi, our team has found a problem in ext4 system on Linux kernel v5.10, leading to DoS attacks.

The struct inode can be exhausted by normal users by calling syscall such as creat. A normal user can repeatedly make the creat syscalls to creat files and exhaust all struct inode. As a result,although there is still a lot of space in the disk, there are no available inodes and all ext4 files/directories creation of all other users will fail.

In fact, we try this attack inside a deprivileged docker container without any capabilities. The processes in the docker can exhaust all struct inode on the host kernel. We use a machine with 500G SSD disk. We start one process to exhaust all struct inode. In total, around 30498816 number of struct inode are consumed and there are no available struct inode in the kernel. The blkio control group can only limit the IOPS or IO bandwidth, so blkio control group can not help. 


The following code shows a PoC that takes 30498816 number of struct inode, while take all struct inode on host. We evaluate the PoC on intel i5 CPU physical machine + Linux kernel v5.10.0 + Ubuntu 18.04 LTS.
-----------------------------------------------
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<fcntl.h>


int main()
{
    char nameout[64]; 
    int fd; 
    for (int i = 1; ; i++) { 
         sprintf(nameout, "test%d.txt", i); 
         fd = creat(&amp;nameout[0], O_CREAT); 
         close(fd); 
    } 
    getchar();
    return 0;
} 

----------------------------------------------- 
 
Looking forward to your reply! 




--



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-05 14:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-05 13:29 Report bug to Linux ext4 file system about inode 肖杰韬
2021-09-05 14:36 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).