Strict arguments checking for rd_duplicate_function()

The `duplicate` argument is now required. The function will return error
code (KERN_INVALID_ARGUMENT) if it is NULL.
Add test cases that cover the new rd_duplicate_function() behavior
Merge branch 'develop'