All of lore.kernel.org
 help / color / mirror / Atom feed
From: Federico Sauter <fsauter-LVkJPw3T+odGBRGhe+f61g@public.gmane.org>
To: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Flush issue with overwritten FID
Date: Thu, 11 Jun 2015 18:06:15 +0200	[thread overview]
Message-ID: <5579B1F7.4010606@innominate.com> (raw)
In-Reply-To: <556748C2.40202-LVkJPw3T+odGBRGhe+f61g@public.gmane.org>

Hello,


I am using two shares. In order to connect to each share I use a 
different user, but it is the same Windows host. In the abovementioned 
scenario something strange happens while mounting the shares, namely 
that the session setup commands both return the same user ID for two 
different users. Conversely, the tree connect command then also returns 
the same tree ID for each one of the (different) shares.

I think that is the root cause of the problem, leading to the 
duplication of a file ID later in the process.

My question is whether this is a Windows issue that we cannot fix, or 
whether there is a possibility to tackle this problem from Linux.

I should probably mention that both shares are mounted in parallel.

Also: the only client-controlled field that I have been able to identify 
as being the same in the bad scenario is the multiplexer ID. For both 
session setup command the MID is the same, but the process ID (and the 
user ID) is different. In the working case both the process ID and the 
MID are different.

Any hints are welcomed! ;-)


Kind regards,


Federico Sauter
Senior Firmware Programmer
-- 
Innominate Security Technologies AG
Rudower Chaussee 13 | 12489 Berlin | Germany
tel: +49 30 921028-210 | fax: +49 30 921028-020
www.innominate.com | www.twitter.com/mGuardcom

Register Court: AG Charlottenburg, HR B 81603
Management Board: Dirk Seewald | Chairman of the Supervisory Board: 
Christoph Leifer


On 05/28/2015 06:56 PM, Federico Sauter wrote:
> Greetings,
>
>
> I am using a Linux device with kernel 3.10.40. The Windows host is using
> XP PRO (32-bit,) but the problem has laso been observed with Windows 7
> 64-bit.
>
> When I directly connect the Linux device to the Windows host, a very
> strange problem arises. First of all: by "directly connect" I mean
> connecting the network cable from the device's NIC directly to the
> host's NIC, without any switch in between.
>
> The device then mounts two shares on the host: a RO share, as well as a
> RW share.
>
> The device opens a file (integrity-check-idx.tmp) for writing on the RW
> share. Then (without closing it) it scans the contents of the RO share.
> Afterwards, it writes some result on that file and flushes it before
> closing it. Straightforward enough.
>
> In the described case where the NICs are directly connected *and* that
> the Windows host finishes booting before the Linux device does,
> something strange happens. The file opened for writing is opened on FID
> 0x4002, then, when opening another file on the RO share, the same FID
> seems to be reused. That file is closed and FID 0x4002 is then invalid.
> In the end, when FID 0x4002 is flushed, an error is returned.
>
> Attached you will find an abridged version of the Wireshark capture.
> Here is the summary:
>
> SMB_COM_NT_CREATE_ANDX integrity-check-idx.tmp on FID 0x4002
> SMB_COM_READ_ANDX  FID 0x4002
> (...browse share...)
> SMB_COM_NT_CREATE_ANDX append.exe on FID 0x4002
> SMB_COM_READ_ANDX  FID 0x4002
> SMB_COM_CLOSE  FID 0x4002
> (...)
> SMB_COM_FLUSH  FID 0x4002
> Response: NT Status: STATUS_INVALID_HANDLE (0xc0000008)
>
> In the case where there is a switch between both NICs, this problem does
> not happen. In that case, FID 0x4002 is used only once for the file
> opened for writing (which was created first) and then other FIDs are
> used for each file that is opened afterwards. Thus, all operations
> succeed (which is the behavior that I would expect.)
>
> Do you have any idea on how to solve this?
>
> I am taking a deeper look at the kernel code, but so far it seems to me
> like this was a Windows problem and not a problem in our implementation,
> given that the FID is assigned by the Windows host. Could you please
> confirm that this is correct so as to provide a workaround?
>
> Thank you in advance for your kind support!
>
>
> Federico Sauter
> Senior Firmware Programmer

      parent reply	other threads:[~2015-06-11 16:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-28 16:56 Flush issue with overwritten FID Federico Sauter
     [not found] ` <556748C2.40202-LVkJPw3T+odGBRGhe+f61g@public.gmane.org>
2015-06-11 16:06   ` Federico Sauter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5579B1F7.4010606@innominate.com \
    --to=fsauter-lvkjpw3t+odgbrghe+f61g@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.