#
310380 |
|
21-Dec-2016 |
brooks |
MFC r310088, r310090, r310095
r310088: Put the undocumented df feature of mounting filesystems from device nodes under an ifdef. Leave enabled.
Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513
r310090: Mount filesystems without executable permissions since they should never be used.
Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513
r310095: Use nmount(2) rather than the obsolete mount(2).
Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8513
|
#
287790 |
|
14-Sep-2015 |
delphij |
MFC r287236:
Use exit() instead of return in main(). The difference in practice is subtle: C standard requires the language runtime to make return of int from main() behave like calling exit(), and in FreeBSD we do:
exit(main(argc, argv, env))
In lib/csu/${ARCH}/crt1.c, so the real difference is using exit() explicitly would use an additional stack frame.
Note however, if there is a on stack pointer is the last reference of an allocated memory block, returning from the function would, technically, result in a memory leak because we lost the last reference to the memory block, and calling exit() from C runtime could potentionally overwrite that stack frame that used to belong to the main() function.
In practice, this is normally Okay because eventually the kernel would tear down the whole address space that belongs to the process in the _exit(2) system call, but the difference could confuse compilers (which may want to do stack overflow checks) and static analyzers.
Replacing return with exit() in main() allows compilers/static analyzers to correctly omit or generate the right warnings when they do not treat main() specifically. With the current version of clang on FreeBSD/amd64, use of exit() would result in slightly smaller code being generated and eliminated a false positive warning of memory leak.
|
#
287790 |
|
14-Sep-2015 |
delphij |
MFC r287236:
Use exit() instead of return in main(). The difference in practice is subtle: C standard requires the language runtime to make return of int from main() behave like calling exit(), and in FreeBSD we do:
exit(main(argc, argv, env))
In lib/csu/${ARCH}/crt1.c, so the real difference is using exit() explicitly would use an additional stack frame.
Note however, if there is a on stack pointer is the last reference of an allocated memory block, returning from the function would, technically, result in a memory leak because we lost the last reference to the memory block, and calling exit() from C runtime could potentionally overwrite that stack frame that used to belong to the main() function.
In practice, this is normally Okay because eventually the kernel would tear down the whole address space that belongs to the process in the _exit(2) system call, but the difference could confuse compilers (which may want to do stack overflow checks) and static analyzers.
Replacing return with exit() in main() allows compilers/static analyzers to correctly omit or generate the right warnings when they do not treat main() specifically. With the current version of clang on FreeBSD/amd64, use of exit() would result in slightly smaller code being generated and eliminated a false positive warning of memory leak.
|