lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 2 Nov 2021 15:22:19 -0700
From:   Tadeusz Struk <tadeusz.struk@...aro.org>
To:     dgilbert@...erlog.com, Bart Van Assche <bvanassche@....org>,
        linux-scsi@...r.kernel.org
Cc:     Christoph Hellwig <hch@....de>,
        "James E . J . Bottomley" <jejb@...ux.ibm.com>,
        "Martin K . Petersen" <martin.petersen@...cle.com>,
        linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        syzbot+5516b30f5401d4dcbcae@...kaller.appspotmail.com
Subject: Re: [PATCH] scsi: core: initialize cmd->cmnd before it is used

On 11/2/21 14:33, Douglas Gilbert wrote:
>> Thanks for having taken a look. I found the above check in sg_new_write(). To 
>> me that function seems to come from a code path that is unrelated to sg_io(), 
>> the function shown in the call stack in the email at the start of this thread. 
>> Maybe I overlooked something but I haven't found a minimum size check for 
>> hdr->cmd_len in sg_io() before the blk_execute_rq() call. Should such a check 
>> perhaps be added?
> 
> I guess it came from ioctl(<non_sg_fd>, SG_IO, ) and I found no lower bound
> check when I looked in lk 5.15.0 . No-one has complained to me about the
>     hp->cmd_len < 6
> 
> check in the sg driver ***. So I think such a check may be useful in the 
> scsi_fill_sghdr_rq() function in drivers/scsi/scsi_ioctl.c . And a return
> of -EMSGSIZE seems to be tailor made for this situation.
> 
> Doug Gilbert
> 
> 
> *** It is possible a vendor specific command could be between 1 and 5 bytes
> long, but that would probably be an unwise choice.

Bart,
Do you want me to send a patch with the check in scsi_fill_sghdr_rq()?
I want to close the mentioned syzbot issue in 5.10. I can also do the
back-porting if anything will be required.

-- 
Thanks,
Tadeusz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ