Should I specify the mount type every time? What are the recommendations...?

Julio Faracco jcfaracco at gmail.com
Thu Jun 28 12:22:00 EDT 2018


Hi guys,

I want your opinion about a syscall: mount().

Today, a problem brought back this doubt.
I see a lots of code that calls/uses mount() syscall.
But, recently, running Valgrind, it showed an error saying that you
cannot specify NULL as the 'type' argument of mount function.

An example from kernel code:
ret = mount("/dev/pts/ptmx", "/dev/ptmx", NULL, MS_BIND, NULL);

Valgrind was complaining about the first NULL parameter which refers
to the mount type:
==18012== Syscall param mount(type) points to unaddressable byte(s)

After replacing NULL to type "none" the error disappeared.
I read a documentation about it, saying that is better to use "none"
for BIND and MOVE options. But, I'm not right about that.

Do you have any documentation or a best practice to use this syscall?

Thanks!

--
Julio Cesar Faracco



More information about the Kernelnewbies mailing list