Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linux-6.12 support #268

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/driver/linux_onload/onload_kernel_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,33 @@ static inline struct fown_struct* efrm_file_f_owner(struct file *file)
#endif
}


static inline int
oo_copy_file_owner(struct file *file_to, struct file *file_from)
{
#ifndef EFRM_F_OWNER_IS_VAL
/* linux 6.12 */
int rc;

if( efrm_file_f_owner(file_from) == NULL )
return 0;

rc = file_f_owner_allocate(file_to);
if( rc != 0 )
return rc;
#endif

if(efrm_file_f_owner(file_from)->pid != 0) {
rcu_read_lock();
__f_setown(file_to, efrm_file_f_owner(file_from)->pid,
efrm_file_f_owner(file_from)->pid_type, 1);
rcu_read_unlock();
}
efrm_file_f_owner(file_to)->signum = efrm_file_f_owner(file_from)->signum;

return 0;
}

#ifdef EFRM_CLOEXEC_FILES_STRUCT
/* linux 6.12+ */
#define efrm_close_on_exec close_on_exec
Expand Down
13 changes: 4 additions & 9 deletions src/driver/linux_onload/ossock_calls.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,16 +655,11 @@ int efab_tcp_helper_create_os_sock(ci_private_t *priv)
sock = get_linux_socket(ep);

/* Copy F_SETOWN_EX, F_SETSIG to the new file */
#ifdef F_SETOWN_EX
if(efrm_file_f_owner(priv->_filp)->pid != 0) {
rcu_read_lock();
__f_setown(sock->file, efrm_file_f_owner(priv->_filp)->pid,
efrm_file_f_owner(priv->_filp)->pid_type, 1);
rcu_read_unlock();
rc = oo_copy_file_owner(sock->file, priv->_filp);
if( rc != 0 ) {
efab_tcp_helper_destroy_os_sock(priv);
return rc;
}
#endif
efrm_file_f_owner(sock->file)->signum =
efrm_file_f_owner(priv->_filp)->signum;

rc = ci_tcp_sync_sockopts_to_os_sock(ni, ep->id, sock);
put_linux_socket(sock);
Expand Down
12 changes: 4 additions & 8 deletions src/lib/efthrm/tcp_helper_endpoint_move.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,14 +416,10 @@ int efab_file_move_to_alien_stack(ci_private_t *priv, ci_netif *alien_ni,
new_ep->file_ptr = priv->_filp;

/* Copy F_SETOWN_EX, F_SETSIG to the new file */
#ifdef F_SETOWN_EX
rcu_read_lock();
__f_setown(old_ep->alien_ref->_filp, efrm_file_f_owner(priv->_filp)->pid,
efrm_file_f_owner(priv->_filp)->pid_type, 1);
rcu_read_unlock();
#endif
efrm_file_f_owner(old_ep->alien_ref->_filp)->signum =
efrm_file_f_owner(priv->_filp)->signum;
rc = oo_copy_file_owner(old_ep->alien_ref->_filp, priv->_filp);
if( rc != 0 )
goto fail4;

old_ep->alien_ref->_filp->f_flags |= priv->_filp->f_flags & O_NONBLOCK;

/********* Point of no return **********/
Expand Down