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

Remove check for scsi_transport_iscsi version, as it breaks on Slackware #1

Closed
wants to merge 1 commit into from

Conversation

grevian
Copy link

@grevian grevian commented Dec 11, 2011

This probably isn't the best way to handle this, but for now this is a quick-fix to let open-iscsi work on Slackware 13.37 and probably other versions.

The basic issue is that on Slackware with the default 2.6.37.6 kernel, there is no version parameter available through /sys/module/scsi_transport_iscsi/. I'm not sure why this is, the support is compiled into the default kernel and with this change applied iscsid and friends seem to work with no issues.

@mikechristie
Copy link
Collaborator

On 12/11/2011 04:37 PM, Josh Hayes-Sheen wrote:

This probably isn't the best way to handle this, but for now this is a quick-fix to let open-iscsi work on Slackware 13.37 and probably other versions.

The basic issue is that on Slackware with the default 2.6.37.6 kernel, there is no version parameter available through /sys/module/scsi_transport_iscsi/. I'm not sure why this is, the support is compiled into the default kernel and with this change applied iscsid and friends seem to work with no issues.

This is a known problem. We are supposed to modify the module code so
that when built into the kernel it exports this info similar to how if
you build a module into the kernel you can still pass modparams to it.

Are you the iscsi maintainer for slackware?

@mikechristie
Copy link
Collaborator

On 12/12/2011 01:04 PM, Mike Christie wrote:

On 12/11/2011 04:37 PM, Josh Hayes-Sheen wrote:

This probably isn't the best way to handle this, but for now this is a quick-fix to let open-iscsi work on Slackware 13.37 and probably other versions.

The basic issue is that on Slackware with the default 2.6.37.6 kernel, there is no version parameter available through /sys/module/scsi_transport_iscsi/. I'm not sure why this is, the support is compiled into the default kernel and with this change applied iscsid and friends seem to work with no issues.

This is a known problem. We are supposed to modify the module code so
that when built into the kernel it exports this info similar to how if
you build a module into the kernel you can still pass modparams to it.

Oh yeah, the check is there because if you try to use the newer
open-iscsi tools with older kernels then you will get weird
oopses/behavior due to differences in the kernel and/or iscsi modules.

@grevian
Copy link
Author

grevian commented Dec 12, 2011

Are you the iscsi maintainer for slackware?

heh, I'm no maintainer of anything, Just encountered the problem while working on a project for school, fixed it with some help from an old forum post, and figured since I was in my programming/github groove I'd push the change your way, to publish it in case it's useful to someone else.

This is a known problem. We are supposed to modify the module code so that when built into the kernel it exports this info similar to how if you build a module into the kernel you can still pass modparams to it.

This shouldn't technically be a slackware specific problem then right? It's just that Slackware by default builds in scsi_transport_iscsi while many other distros just leave it as a module?

I wouldn't even know where to start in terms of fixing it in the module, and while maybe I'd come back to it someday, it might be worth mailing the lkml if you need assistance in terms of the actual kernel/module interface code?

Oh yeah, the check is there because if you try to use the newer open-iscsi tools with older kernels then you will get weird oopses/behavior due to differences in the kernel and/or iscsi modules

Oh I know my "fix" is nasty duct-tape, but it helped me, and I wanted to make it available to others, I honestly don't expect you to actually apply it to your code-base :P

@mikechristie
Copy link
Collaborator

On 12/12/2011 04:29 PM, Josh Hayes-Sheen wrote:

Are you the iscsi maintainer for slackware?

heh, I'm no maintainer of anything, Just encountered the problem while working on a project for school, fixed it with some help from an old forum post, and figured since I was in my programming/github groove I'd push the change your way, to publish it in case it's useful to someone else.

Ah, crap. Sorry that this slowed you down. I hate when that happens.

This is a known problem. We are supposed to modify the module code so that when built into the kernel it exports this info similar to how if you build a module into the kernel you can still pass modparams to it.

This shouldn't technically be a slackware specific problem then right? It's just that Slackware by default builds in scsi_transport_iscsi while many other distros just leave it as a module?

Yeah, it is not a problem specific to slackware. It is a problem for any
distro/user that builds the module into the kernel.

I wouldn't even know where to start in terms of fixing it in the module, and while maybe I'd come back to it someday, it might be worth mailing the lkml if you need assistance in terms of the actual kernel/module interface code?

Yeah, it is kinda nasty. That is why it has not got fixed (you probably
saw a thread that was several years old).

Oh yeah, the check is there because if you try to use the newer open-iscsi tools with older kernels then you will get weird oopses/behavior due to differences in the kernel and/or iscsi modules

Oh I know my "fix" is nasty duct-tape, but it helped me, and I wanted to make it available to others, I honestly don't expect you to actually apply it to your code-base :P

:)

@mikechristie
Copy link
Collaborator

I removed the check. We have not been using it. Instead we have been checking on a per feature basis, so it was not needed.

gonzoleeman added a commit that referenced this pull request Apr 22, 2017
Update to latest upstream
gonzoleeman pushed a commit that referenced this pull request Apr 21, 2020
log:modify iSCSI shared memory permissions for logs
@baimushan baimushan mentioned this pull request Apr 15, 2021
windfine pushed a commit to windfine/open-iscsi that referenced this pull request Aug 1, 2022
I got a kernel NULL pointer derference report as below:

    BUG: kernel NULL pointer dereference, address: 0000000000000038
    #PF: supervisor read access in kernel mode
    #PF: error_code(0x0000) - not-present page
    PGD 0 P4D 0
    Oops: 0000 [open-iscsi#1] PREEMPT SMP NOPTI
    CPU: 4 PID: 1050 Comm: cat Not tainted 5.19.0 open-iscsi#38
    RIP: 0010:kernel_getpeername+0xf/0x30
    Call Trace:
     <TASK>
     ? iscsi_sw_tcp_conn_get_param+0x11f/0x17f
     show_conn_ep_param_ISCSI_PARAM_CONN_ADDRESS+0x90/0xb0
     dev_attr_show+0x1d/0x50
     sysfs_kf_seq_show+0xad/0x120
     kernfs_seq_show+0x2c/0x40
     seq_read_iter+0x12e/0x4d0
     ? aa_file_perm+0x177/0x590
     kernfs_fop_read_iter+0x183/0x210
     new_sync_read+0xfe/0x180
     ? 0xffffffff81000000
     vfs_read+0x14d/0x1a0
     ksys_read+0x6d/0xf0
     __x64_sys_read+0x1a/0x20
     do_syscall_64+0x3b/0x90
     entry_SYSCALL_64_after_hwframe+0x63/0xcd

The life cycle of socket is:
login:  ep_connect(create sock)   ---> bind_conn(bind sock to conn)
logout: ep_disconnect(close sock) ---> stop_conn(unbind sock from conn)
The calling order is wrong on logout, will cause this issue in the
following scenarios:

             iscsi logout               get sock param by sysfs
    --------------------------------  ---------------------------
        User Space | Kernel Space             Kernel Space
    --------------------------------  ---------------------------
    session_conn_shutdown
      ep_disconnect
        close(conn->socket_fd)
                     sock_close
                       __sock_release
                         sock->ops = NULL

                                     iscsi_sw_tcp_conn_get_param
                                       sock = tcp_sw_conn->sock;
                                         kernel_getsockname
                                           sock->ops->getname
                                           ^^^^^^^^^
                                           NULL pointer dereference

     ipc->stop_conn
       __kipc_call
                    iscsi_sw_tcp_conn_stop
                      iscsi_sw_tcp_release_conn
                        sock = NULL

So change the calling order of ep_disconnect() and stop_conn() to
fix this issue.

Signed-off-by: Li Jinlin <lijinlin3@huawei.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants