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]
Message-ID: <YlGOOJ9SwkD7WVmX@rowland.harvard.edu>
Date:   Sat, 9 Apr 2022 09:46:32 -0400
From:   Alan Stern <stern@...land.harvard.edu>
To:     Maxim Devaev <mdevaev@...il.com>
Cc:     linux-usb@...r.kernel.org, Felipe Balbi <balbi@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Cai Huoqing <caihuoqing@...du.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] usb: gadget: f_mass_storage: break IO operations via
 configfs

On Sat, Apr 09, 2022 at 11:57:56AM +0300, Maxim Devaev wrote:
> В Fri, 8 Apr 2022 10:59:45 -0400
> Alan Stern <stern@...land.harvard.edu> wrote:
> > > At least there is one situation where the behavior of f_mass_storage differs
> > > from the behavior of a real drive. What happens when you click on the physical
> > > "eject" button?  
> > 
> > If the host has prevented ejection, nothing happens.  Otherwise the disc 
> > gets ejected.
> > 
> > > Yes, the OS can block this, but the problem is that we don't have
> > > an "eject" here.  
> > 
> > What do you mean?  Writing an empty string to the sysfs "file" attribute 
> > is the virtual analog of pressing the eject button.
> 
> But I can't eject the disc event it's not mounted on Linux host. It seems to me
> it differs from the real drive behavior.

It sounds like either there's a bug or else you're not doing the right 
thing.  Tell me exactly what you do when this fails.

> > ...
> 
> I have reflected on the rest of your arguments and changed my mind.
> I think that "forced_eject" for a specific lun without interrupting operations would
> really be the best solution. I wrote a simple patch and tested it, everything seems
> to work. What do you think about something like this?
> 
> 
> static ssize_t fsg_lun_opts_forced_eject_store(struct config_item *item,
>                                                const char *page, size_t len)
> {
>         struct fsg_lun_opts *opts = to_fsg_lun_opts(item);
>         struct fsg_opts *fsg_opts = to_fsg_opts(opts->group.cg_item.ci_parent);
>         int ret;
> 
>         opts->lun->prevent_medium_removal = 0;
>         ret = fsg_store_file(opts->lun, &fsg_opts->common->filesem, "", 0);
>         return ret < 0 ? ret : len;
> }
> 
> CONFIGFS_ATTR_WO(fsg_lun_opts_, forced_eject);

The basic idea is right.  But this should not be a CONFIGFS option; it 
should be an ordinary LUN attribute.  For an example, see the definition of 
file_store() in f_mass_storage.c; your routine should look very similar.

> If you find this acceptable, I will test this patch on my users to make sure
> that its behavior meets our expectations.

Okay.

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ