Re: interview question how does application connects to device

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

 



2011/7/6 Javier Martinez Canillas <martinez.javier@xxxxxxxxx>:
> 2011/7/6 Mandeep Sandhu <mandeepsandhu.chd@xxxxxxxxx>:
>>> How would using sysfs be useful if we were to talk about interacting with, let's say, a file system? ioctl's are quite versatile and rather easy to use when one wants to interact with a given FS.
>>>
>>> For instance, one can manage a Btrfs file system by using an user-level tool, which heavily uses ioctl's. Requiring it to interact with sysfs instead seems like complicating something simple with no apparent purpose.
>>
>
> Something that always has caught my attention is why netlink sockets
> are so popular. I know that ioctl is deprecated and all new kernel
> code that needs full-duplex communication between userspace and
> kernelspace shoud use netlink as its interface.
>
> But one of the arguments against ioctl is that you don't have type
> checking which makes really hard to audit the parameters passed from
> userspace. Also ioctl can be provided by third party as modules (that
> can also be proprietary binary only ones) which even complicates more
> to have a general security mechanism.
>
> My question is, why netlink sockets are better than ioctls? It is not
> yet another interface to use as a wildcard to pass any data you wan't
> between the kernel and userpace with the only difference that you use
> another paradigm? (network sockets with a specific protocol family
> instead file operations over a device).
>
> Sorry if my question is stupid but I just don't get the point.
>
> Regards,
>
> --
> Javier Martínez Canillas
> (+34) 682 39 81 69
> PhD Student in High Performance Computing
> Computer Architecture and Operating System Department (CAOS)
> Universitat Autònoma de Barcelona
> Barcelona, Spain
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@xxxxxxxxxxxxxxxxx
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>

Javier,

I think the main issue with ioctl is that with some architectures, the
userspace and kernel compiler treat 64-bit structure members
differently, so it is very easy to create a structure which can not
easily be passed via a simple pointer in-all-architectures.

With netlink sockets, one is expected to have a well defined byte
order coming across the socket.

Greg

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux