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
smb1 + android error/crashes. #334
Comments
Checking, Thanks for your report! |
@BrainSlayer Sebastian, Have you ever check smb1 working on big endian target ? dd-wrt seems to have the same issue. And it's hard to verify although I tried to find missing endian conversion on smb1 because I don't have a big endian target, can you help me improve? I applied current endian changes to ksmbd-next. |
You can use qemu-system-mips, which is big endian. You can even try qemu-system-mipsel (little endian) to test a endianness-only issue. I shared owrt script that can download and run an OpenWrt machine. However, openwrt is currently only building big endian (malta/be) machines, which is enough for your tests. I'll stop (ab)using OpenWrt PR. It's better to deal directly here. I'm following ksmb(-tools)?-next now, building each 6h. This is my fresh results (it is getting much better): It looks like android clients (all of them but vlc) are failing to chdir with "Invalid handler". I can see share directory content but when I enter "dirxyz", it shows an empty dir with a "dirxyz". I can keep entering this "dirxyz" forever. It also fails to read a file: android-fail-to-read.pcapng.gz vlc does not generate the "Invalid handler" and it browser nicely: vlc-reading-ok.pcapng.gz From dmesg, I see some error messages (not sure when they happen):
|
Note: Hyunchul lee will check smb1 endian issue on next week. Please wait for him to fix it. |
i need todo more excessive tests on my big endian systems. with the
current revision i dont see much problems.
the last issue i had was the cifs client message
Bad SMB: : dump of 48 bytes of data at 0x87366740
40000000 424d53fe 00020040 00000000 . . . @ S M B @ . . . . . . .
00020010 00000001 00000000 00000009 . . . . . . . . . . . . . . . .
00000000 00000644 00000000 00000050 . . . . D . . . . . . . P . . .
the problem is just that the server was little endian x64 here and it
was using smb 3
i will setup some test server to check if smb1 is working with mips be
Am 17.02.2020 um 22:20 schrieb Namjae Jeon:
…
@BrainSlayer <https://github.com/BrainSlayer> Sebastian, Have you ever
check smb1 working on big endian target ? dd-wrt seems to have the
same issue. And it's hard to verify although I tried to find missing
endian conversion on smb1 because I don't have a big endian target,
can you help me improve? I applied current endian changes to ksmbd-next.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#334>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB2WNE4C34IA5TMLSUPUIKDRDL5STANCNFSM4KUOIITQ>.
|
I will check this problem in the next week. |
Hello @luizluca , I analyzed your dump files. Cause of the "Invalid handle" failure is that Android clients try to close a directory that is already closed. A server closes the directory automatically if the end of the directory is reached. So vlc does not try to close the directory.
Sorry, I cannot understand what problem is about "dirxyz" exaclty. Could you explain it by example?
There are no read requests issued by a client in the dump file. Everything is okay. |
If I have this directory structure:
It lists at share root (as expected):
But when I enter folder1, it shows again and only folder1 as a subfolder of folder1, not folder1.1 or file[12]. My client acts as if it was: //Server/share/folder1/folder1/folder1/folder1/... It works with samba3. |
@hclee regarding to invalid handle error when closing directory, we need to try to reproduce it again on ksmbd-next. I fixed a lot of endian issues on ksmbd-next. maybe, we should try to reproduce it after installing apps in smartphone. |
@luizluca Is this issue reproducible with ksmbd-next ? I am wondering if your test result was reported on old ksmbd-next. I fixed a lot of conversion issue on ksmbd-next. the last patch of smb1 conversion is this one (ad17779). Could please check your test image contained this change ? |
@luizluca Could you capture SMB packets sent between a little endian ksmbd and an android client. I cannot test it because of vacation. the search pattern for looking up directory entries in client's SMB request is strange. |
I just tested it with a built from 20 minutes ago. It's just the same. I was not able to take a good look at it but only ksmbd shows "." and "..". So, it askes for "." content. After that, instead of asking for "dir/*" (as it does with samba) , it askes for "dir/". This will give me the endless subdir behavior. I'll try to capture more data still today and also do a little endian version test. |
I'm doing a side-by-side debug and found some interesting things:
My guess is that the extra filename size adds an extra \0 at the end of the filename. If the client is not cautious, it might simply do:
And the pattern that should be '\mydir\' will be '\mydir\0\' or, when considering a null terminate string, only ''\mydir' (which is what I see the client asking). With that in mind, I checked the bytestream:
This is quite certain that the issue is simply filename size which is off by one in ksmbd, manifested with a poor implemented client (it looks like it is using JCIFS). There is still the "Invalid handler" when the client tries to close a find result. It also happened with little endian (armvirt). Maybe something in ksmbd does not expect search_id/file_id == 0. Because of the off-by-one bug in filename, I could no test it further. However, I could not spot a single step where little/big endian systems are different. I'm now building each 6 hours ksmbd for openwrt 19.07.1 for both ath79/generic (mips big endian) and armvirt/32 (ARM little endian). I'm not testing them everyday but it might be easier to test with a pre-built package. |
Thank you for the detailed explanation ;)
I also found this problem. As you said, the cause of keeping entering a directory forever is '\0' in the search pattern. What I am confused is why this problem is not reproducible in little endian. We have the bug to count the length of a filename including '\0' character. I will send the patch to fix it.
I think this issue is not related with search id == 0. If there is nothing left in a directory, ksmbd closes the handle of the directory (search id) automatically, and let a client know the end of a search. vlc and cifs filesystem does not try to close the search id in this case. But the android apps tries. Does not this issue come up for Samba? |
We have the bug. we must close the directory if the "Close on EOS" flag is set. I will send the patch to fix it. Thank you! |
@luizluca Push Hyunchul's patches into ksmbd-next now. |
@namjaejeon and @hclee , finally I can use all my Android apps! Thank you. I would still take a look on the random creation time field. |
|
@BrainSlayer Very stranged. Could you please fully turn on debug message of cifs client ? |
@luizluca Any news ? Could you explain more about symptom ? I fixed the issue that creation time is not set for dot and dotdot file on #ksmbd-next. not sure it is the same issue that you are facing. |
@namjaejeon , I just tested it (2020-03-17) and I do not see that random creation time anymore. Thanks. I guess this fixes all issues I saw with android clients. @Andy2244 , @namjaejeon , this issue is ready to close. |
@Andy2244 Release ksmbd 3.1.6 version and ksmbd-tools 3.2.3 version now. |
ok thanks for the info, will try make a new release this week. |
@Andy2244 , please consider that whenever you touch a kmod package, openwrt buildbot remove older kmods while the new one is compiled only for openwrt-19.07-snapshot only. If its kernel version differ from the release one, you'll have your kmod in a broken state until next release. OpenWrt does have a spot to place multiple kmod versions for each kernel release but it looks like it's not used for openwrt-packages out off the kernel modules, only for kmods from the kernel source. I sent an email to ML asking about compiling kmods for each stable release but I got no answer. |
I am lost, it is cifsd or ksmbd? |
cifsd is directory and project name. ksmbd is thread(task) name. cifsd == ksmbd. |
@namjaejeon: You have not changed the name of the project and the soft recently? And any news to move the repositories:
The goal is to have the perfect code in cifsd-team. For example, Microsoft has not main projects in user accounts. |
@Andy2244 Can I close this ISSUE if release is done ? |
sure |
I just updated our latest version and now i build with smb1 included, so older devices and Android can work, yet now i have a report with massive problems?
So can you take a log at the debug/errors, see comments on this PR.
openwrt/packages#11290
The text was updated successfully, but these errors were encountered: