RE: [PATCH v1 1/1] usbip: deletion of incorrect socket descriptor checking

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

 



From: Nobuo Iwata
> Sent: 30 September 2016 06:44
> This patch removes checking of socket descriptor value in daemons.
> 
> It was checked to be less than FD_SETSIZE(1024 usually) but it's not
> correct.
> 
> To be exact, the maximum value of descriptor comes from
> rlimit(RLIMIT_NOFILE).
> 
> Following kernel code determines the value :
>     get_unused_fd_flags() : fs/files.c
>     __alloc_fd() : fs/files.c
>     expand_files() : fs/files.c
> 
> The defalut (soft limit) is defines as INR_OPEN_CUR(1024) in
> include/linux/fs.h which is referenced form INIT_RLIMS in
> include/asm-generic/resource.h. The value may be modified with ulimt,
> sysctl, security configuration and etc.
> 
> With the kernel code above, when socket() system call returns positive
> value, the value must be within rlimit(RLIMIT_NOFILE). No extra
> checking is needed when socket() returns positive.

I'm guessing that the problem is that the code wants to use select()
on the socket.
The value of RLIMIT_NOFILE isn't really relevant.
If fd >= FD_SETSIZE then you can't use select.

In reality any program that has anywhere near that number of open fd
would be better off using something other than select().

	David

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux