Skip to content
Snippets Groups Projects
  • Raphael S. Carvalho's avatar
    cc8bf695
    bsd: Fix unimplemented copystr() and copyinstr() · cc8bf695
    Raphael S. Carvalho authored
    
    Over the process of creating a zpool, history_str_get() will be eventually
    called by zfs_ioc_pool_create(). history_str_get() will not work as expected as
    it fully relies on the function copyinstr() which is currently unimplemented.
    
    After that, spa_create() will be called with history_str storing trash, thus
    making the spa_history_log filled with completely wrong entries.
    
    Let's fix this problem simply by implementing copyinstr. By the way, copystr
    has basically the same semantics as copyinstr, so let's implement it as well.
    It's not being used anywhere, but who knows? It might be needed in the future
    by some bsd compliant application.
    
    As far as I know, this problem didn't manifest *visibly* anywhere as the spa
    history log wasn't intentionally used by us yet. I found the problem while
    auditing code.
    
    Signed-off-by: default avatarRaphael S. Carvalho <raphaelsc@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
    cc8bf695
    History
    bsd: Fix unimplemented copystr() and copyinstr()
    Raphael S. Carvalho authored
    
    Over the process of creating a zpool, history_str_get() will be eventually
    called by zfs_ioc_pool_create(). history_str_get() will not work as expected as
    it fully relies on the function copyinstr() which is currently unimplemented.
    
    After that, spa_create() will be called with history_str storing trash, thus
    making the spa_history_log filled with completely wrong entries.
    
    Let's fix this problem simply by implementing copyinstr. By the way, copystr
    has basically the same semantics as copyinstr, so let's implement it as well.
    It's not being used anywhere, but who knows? It might be needed in the future
    by some bsd compliant application.
    
    As far as I know, this problem didn't manifest *visibly* anywhere as the spa
    history log wasn't intentionally used by us yet. I found the problem while
    auditing code.
    
    Signed-off-by: default avatarRaphael S. Carvalho <raphaelsc@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>