I am attempting to scp a file onto a Synology NAS (into the /tmp directory). Doing this from the command line of my Ubuntu machine works as intended. Running the PHP code works as intended against a regular Linux distro (as in every distro I've tried - Ubuntu, Debian, Centos, Redhat, Suse, Arch). Even against other *nix it's fine (MacOS, AIX, etc). I don't think it's a PHPSecLib issue as such, but that's what we're using. Ubuntu 18.04 to Synology DS3615xs running DSM 6.1.7-15284. The credentials are correct. The user has write permission on /tmp. I have posted the full log (it's a test Synology that is unused). Any assistance would be most appreciated.
If I run the scp from the shell of my Ubuntu machine, I get the below logs and it works as intended.
debug1: Authentication succeeded (password).
Authenticated to 192.168.1.22 ([192.168.1.22]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions#openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00#openssh.com want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = en_AU.UTF-8
debug1: Sending command: scp -v -t /tmp/
Sending file modes: C0775 117453 audit_linux.sh
Sink: C0775 117453 audit_linux.sh
audit_linux.sh 100% 115KB 26.7MB/s 00:00
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Transferred: sent 121156, received 2696 bytes, in 0.1 seconds
Bytes per second: sent 1608483.9, received 35792.5
debug1: Exit status 0
The full PHPSecLib logs are below.
<-
00000000 53:53:48:2d:32:2e:30:2d:4f:70:65:6e:53:53:48:5f SSH-2.0-OpenSSH_
00000010 36:2e:38:70:31:2d:68:70:6e:31:34:76:36:0d:0a 6.8p1-hpn14v6..
->
00000000 53:53:48:2d:32:2e:30:2d:70:68:70:73:65:63:6c:69 SSH-2.0-phpsecli
00000010 62:5f:31:2e:30:20:28:6f:70:65:6e:73:73:6c:29:0d b_1.0 (openssl).
00000020 0a .
<- NET_SSH2_MSG_KEXINIT (since last: 0.0338, network: 0.0008s)
00000000 54:40:f5:21:15:4b:dc:60:c7:81:0c:87:a3:0b:2e:c8 T#.!.K.`........
00000010 00:00:00:96:63:75:72:76:65:32:35:35:31:39:2d:73 ....curve25519-s
00000020 68:61:32:35:36:40:6c:69:62:73:73:68:2e:6f:72:67 ha256#libssh.org
00000030 2c:65:63:64:68:2d:73:68:61:32:2d:6e:69:73:74:70 ,ecdh-sha2-nistp
00000040 32:35:36:2c:65:63:64:68:2d:73:68:61:32:2d:6e:69 256,ecdh-sha2-ni
00000050 73:74:70:33:38:34:2c:65:63:64:68:2d:73:68:61:32 stp384,ecdh-sha2
00000060 2d:6e:69:73:74:70:35:32:31:2c:64:69:66:66:69:65 -nistp521,diffie
00000070 2d:68:65:6c:6c:6d:61:6e:2d:67:72:6f:75:70:2d:65 -hellman-group-e
00000080 78:63:68:61:6e:67:65:2d:73:68:61:32:35:36:2c:64 xchange-sha256,d
00000090 69:66:66:69:65:2d:68:65:6c:6c:6d:61:6e:2d:67:72 iffie-hellman-gr
000000a0 6f:75:70:31:34:2d:73:68:61:31:00:00:00:2f:73:73 oup14-sha1.../ss
000000b0 68:2d:72:73:61:2c:73:73:68:2d:64:73:73:2c:65:63 h-rsa,ssh-dss,ec
000000c0 64:73:61:2d:73:68:61:32:2d:6e:69:73:74:70:32:35 dsa-sha2-nistp25
000000d0 36:2c:73:73:68:2d:65:64:32:35:35:31:39:00:00:00 6,ssh-ed25519...
000000e0 6c:61:65:73:31:32:38:2d:63:74:72:2c:61:65:73:31 laes128-ctr,aes1
000000f0 39:32:2d:63:74:72:2c:61:65:73:32:35:36:2d:63:74 92-ctr,aes256-ct
00000100 72:2c:61:65:73:31:32:38:2d:67:63:6d:40:6f:70:65 r,aes128-gcm#ope
00000110 6e:73:73:68:2e:63:6f:6d:2c:61:65:73:32:35:36:2d nssh.com,aes256-
00000120 67:63:6d:40:6f:70:65:6e:73:73:68:2e:63:6f:6d:2c gcm#openssh.com,
00000130 63:68:61:63:68:61:32:30:2d:70:6f:6c:79:31:33:30 chacha20-poly130
00000140 35:40:6f:70:65:6e:73:73:68:2e:63:6f:6d:00:00:00 5#openssh.com...
00000150 6c:61:65:73:31:32:38:2d:63:74:72:2c:61:65:73:31 laes128-ctr,aes1
00000160 39:32:2d:63:74:72:2c:61:65:73:32:35:36:2d:63:74 92-ctr,aes256-ct
00000170 72:2c:61:65:73:31:32:38:2d:67:63:6d:40:6f:70:65 r,aes128-gcm#ope
00000180 6e:73:73:68:2e:63:6f:6d:2c:61:65:73:32:35:36:2d nssh.com,aes256-
00000190 67:63:6d:40:6f:70:65:6e:73:73:68:2e:63:6f:6d:2c gcm#openssh.com,
000001a0 63:68:61:63:68:61:32:30:2d:70:6f:6c:79:31:33:30 chacha20-poly130
000001b0 35:40:6f:70:65:6e:73:73:68:2e:63:6f:6d:00:00:00 5#openssh.com...
000001c0 d5:75:6d:61:63:2d:36:34:2d:65:74:6d:40:6f:70:65 .umac-64-etm#ope
000001d0 6e:73:73:68:2e:63:6f:6d:2c:75:6d:61:63:2d:31:32 nssh.com,umac-12
000001e0 38:2d:65:74:6d:40:6f:70:65:6e:73:73:68:2e:63:6f 8-etm#openssh.co
000001f0 6d:2c:68:6d:61:63:2d:73:68:61:32:2d:32:35:36:2d m,hmac-sha2-256-
00000200 65:74:6d:40:6f:70:65:6e:73:73:68:2e:63:6f:6d:2c etm#openssh.com,
00000210 68:6d:61:63:2d:73:68:61:32:2d:35:31:32:2d:65:74 hmac-sha2-512-et
00000220 6d:40:6f:70:65:6e:73:73:68:2e:63:6f:6d:2c:68:6d m#openssh.com,hm
00000230 61:63:2d:73:68:61:31:2d:65:74:6d:40:6f:70:65:6e ac-sha1-etm#open
00000240 73:73:68:2e:63:6f:6d:2c:75:6d:61:63:2d:36:34:40 ssh.com,umac-64#
00000250 6f:70:65:6e:73:73:68:2e:63:6f:6d:2c:75:6d:61:63 openssh.com,umac
00000260 2d:31:32:38:40:6f:70:65:6e:73:73:68:2e:63:6f:6d -128#openssh.com
00000270 2c:68:6d:61:63:2d:73:68:61:32:2d:32:35:36:2c:68 ,hmac-sha2-256,h
00000280 6d:61:63:2d:73:68:61:32:2d:35:31:32:2c:68:6d:61 mac-sha2-512,hma
00000290 63:2d:73:68:61:31:00:00:00:d5:75:6d:61:63:2d:36 c-sha1....umac-6
000002a0 34:2d:65:74:6d:40:6f:70:65:6e:73:73:68:2e:63:6f 4-etm#openssh.co
000002b0 6d:2c:75:6d:61:63:2d:31:32:38:2d:65:74:6d:40:6f m,umac-128-etm#o
000002c0 70:65:6e:73:73:68:2e:63:6f:6d:2c:68:6d:61:63:2d penssh.com,hmac-
000002d0 73:68:61:32:2d:32:35:36:2d:65:74:6d:40:6f:70:65 sha2-256-etm#ope
000002e0 6e:73:73:68:2e:63:6f:6d:2c:68:6d:61:63:2d:73:68 nssh.com,hmac-sh
000002f0 61:32:2d:35:31:32:2d:65:74:6d:40:6f:70:65:6e:73 a2-512-etm#opens
00000300 73:68:2e:63:6f:6d:2c:68:6d:61:63:2d:73:68:61:31 sh.com,hmac-sha1
00000310 2d:65:74:6d:40:6f:70:65:6e:73:73:68:2e:63:6f:6d -etm#openssh.com
00000320 2c:75:6d:61:63:2d:36:34:40:6f:70:65:6e:73:73:68 ,umac-64#openssh
00000330 2e:63:6f:6d:2c:75:6d:61:63:2d:31:32:38:40:6f:70 .com,umac-128#op
00000340 65:6e:73:73:68:2e:63:6f:6d:2c:68:6d:61:63:2d:73 enssh.com,hmac-s
00000350 68:61:32:2d:32:35:36:2c:68:6d:61:63:2d:73:68:61 ha2-256,hmac-sha
00000360 32:2d:35:31:32:2c:68:6d:61:63:2d:73:68:61:31:00 2-512,hmac-sha1.
00000370 00:00:15:6e:6f:6e:65:2c:7a:6c:69:62:40:6f:70:65 ...none,zlib#ope
00000380 6e:73:73:68:2e:63:6f:6d:00:00:00:15:6e:6f:6e:65 nssh.com....none
00000390 2c:7a:6c:69:62:40:6f:70:65:6e:73:73:68:2e:63:6f ,zlib#openssh.co
000003a0 6d:00:00:00:00:00:00:00:00:00:00:00:00:00 m.............
-> NET_SSH2_MSG_KEXINIT (since last: 0.0001, network: 0s)
00000000 a6:3e:b5:ac:c5:0a:b6:44:3a:11:34:4a:99:be:1b:a1 .>.....D:.4J....
00000010 00:00:00:7e:64:69:66:66:69:65:2d:68:65:6c:6c:6d ...~diffie-hellm
00000020 61:6e:2d:67:72:6f:75:70:31:2d:73:68:61:31:2c:64 an-group1-sha1,d
00000030 69:66:66:69:65:2d:68:65:6c:6c:6d:61:6e:2d:67:72 iffie-hellman-gr
00000040 6f:75:70:31:34:2d:73:68:61:31:2c:64:69:66:66:69 oup14-sha1,diffi
00000050 65:2d:68:65:6c:6c:6d:61:6e:2d:67:72:6f:75:70:2d e-hellman-group-
00000060 65:78:63:68:61:6e:67:65:2d:73:68:61:31:2c:64:69 exchange-sha1,di
00000070 66:66:69:65:2d:68:65:6c:6c:6d:61:6e:2d:67:72:6f ffie-hellman-gro
00000080 75:70:2d:65:78:63:68:61:6e:67:65:2d:73:68:61:32 up-exchange-sha2
00000090 35:36:00:00:00:0f:73:73:68:2d:72:73:61:2c:73:73 56....ssh-rsa,ss
000000a0 68:2d:64:73:73:00:00:00:d3:61:65:73:31:32:38:2d h-dss....aes128-
000000b0 63:74:72:2c:61:65:73:31:39:32:2d:63:74:72:2c:61 ctr,aes192-ctr,a
000000c0 65:73:32:35:36:2d:63:74:72:2c:74:77:6f:66:69:73 es256-ctr,twofis
000000d0 68:31:32:38:2d:63:74:72:2c:74:77:6f:66:69:73:68 h128-ctr,twofish
000000e0 31:39:32:2d:63:74:72:2c:74:77:6f:66:69:73:68:32 192-ctr,twofish2
000000f0 35:36:2d:63:74:72:2c:61:65:73:31:32:38:2d:63:62 56-ctr,aes128-cb
00000100 63:2c:61:65:73:31:39:32:2d:63:62:63:2c:61:65:73 c,aes192-cbc,aes
00000110 32:35:36:2d:63:62:63:2c:74:77:6f:66:69:73:68:31 256-cbc,twofish1
00000120 32:38:2d:63:62:63:2c:74:77:6f:66:69:73:68:31:39 28-cbc,twofish19
00000130 32:2d:63:62:63:2c:74:77:6f:66:69:73:68:32:35:36 2-cbc,twofish256
00000140 2d:63:62:63:2c:74:77:6f:66:69:73:68:2d:63:62:63 -cbc,twofish-cbc
00000150 2c:62:6c:6f:77:66:69:73:68:2d:63:74:72:2c:62:6c ,blowfish-ctr,bl
00000160 6f:77:66:69:73:68:2d:63:62:63:2c:33:64:65:73:2d owfish-cbc,3des-
00000170 63:74:72:2c:33:64:65:73:2d:63:62:63:00:00:00:d3 ctr,3des-cbc....
00000180 61:65:73:31:32:38:2d:63:74:72:2c:61:65:73:31:39 aes128-ctr,aes19
00000190 32:2d:63:74:72:2c:61:65:73:32:35:36:2d:63:74:72 2-ctr,aes256-ctr
000001a0 2c:74:77:6f:66:69:73:68:31:32:38:2d:63:74:72:2c ,twofish128-ctr,
000001b0 74:77:6f:66:69:73:68:31:39:32:2d:63:74:72:2c:74 twofish192-ctr,t
000001c0 77:6f:66:69:73:68:32:35:36:2d:63:74:72:2c:61:65 wofish256-ctr,ae
000001d0 73:31:32:38:2d:63:62:63:2c:61:65:73:31:39:32:2d s128-cbc,aes192-
000001e0 63:62:63:2c:61:65:73:32:35:36:2d:63:62:63:2c:74 cbc,aes256-cbc,t
000001f0 77:6f:66:69:73:68:31:32:38:2d:63:62:63:2c:74:77 wofish128-cbc,tw
00000200 6f:66:69:73:68:31:39:32:2d:63:62:63:2c:74:77:6f ofish192-cbc,two
00000210 66:69:73:68:32:35:36:2d:63:62:63:2c:74:77:6f:66 fish256-cbc,twof
00000220 69:73:68:2d:63:62:63:2c:62:6c:6f:77:66:69:73:68 ish-cbc,blowfish
00000230 2d:63:74:72:2c:62:6c:6f:77:66:69:73:68:2d:63:62 -ctr,blowfish-cb
00000240 63:2c:33:64:65:73:2d:63:74:72:2c:33:64:65:73:2d c,3des-ctr,3des-
00000250 63:62:63:00:00:00:39:68:6d:61:63:2d:73:68:61:32 cbc...9hmac-sha2
00000260 2d:32:35:36:2c:68:6d:61:63:2d:73:68:61:31:2d:39 -256,hmac-sha1-9
00000270 36:2c:68:6d:61:63:2d:73:68:61:31:2c:68:6d:61:63 6,hmac-sha1,hmac
00000280 2d:6d:64:35:2d:39:36:2c:68:6d:61:63:2d:6d:64:35 -md5-96,hmac-md5
00000290 00:00:00:39:68:6d:61:63:2d:73:68:61:32:2d:32:35 ...9hmac-sha2-25
000002a0 36:2c:68:6d:61:63:2d:73:68:61:31:2d:39:36:2c:68 6,hmac-sha1-96,h
000002b0 6d:61:63:2d:73:68:61:31:2c:68:6d:61:63:2d:6d:64 mac-sha1,hmac-md
000002c0 35:2d:39:36:2c:68:6d:61:63:2d:6d:64:35:00:00:00 5-96,hmac-md5...
000002d0 04:6e:6f:6e:65:00:00:00:04:6e:6f:6e:65:00:00:00 .none....none...
000002e0 00:00:00:00:00:00:00:00:00:00 ..........
-> NET_SSH2_MSG_KEXDH_INIT (since last: 0.0329, network: 0s)
00000000 00:00:01:00:3a:81:ea:6d:6a:ca:ec:5f:8d:7d:7f:7d ....:..mj.._.}.}
00000010 18:82:47:7f:60:bc:f9:0a:9a:2a:d8:4f:09:62:5f:82 ..G.`....*.O.b_.
00000020 79:ef:a3:5e:2a:b2:d7:91:42:ba:3a:88:a8:82:6e:7a y..^*...B.:...nz
00000030 19:53:e5:80:09:a9:61:fd:14:7e:b8:ef:3e:c5:c1:35 .S....a..~..>..5
00000040 8a:de:b6:75:58:d9:cb:d9:c9:8b:ce:b8:f2:05:42:5a ...uX.........BZ
00000050 7d:9c:01:1b:e2:c9:bc:d3:f5:a5:55:6a:c4:4a:03:40 }.........Uj.J.#
00000060 ae:53:01:ef:30:e0:41:6b:4d:54:1d:72:a8:47:bb:70 .S..0.AkMT.r.G.p
00000070 47:95:73:0c:1c:16:3e:a9:6a:e0:f7:6d:04:d4:e1:b6 G.s...>.j..m....
00000080 22:97:c8:07:5a:04:2c:85:af:ca:3e:dc:e2:77:62:6b "...Z.,...>..wbk
00000090 6c:8c:1a:57:49:9e:d3:0d:13:e3:b6:cc:18:4e:69:28 l..WI........Ni(
000000a0 be:6c:bf:63:2c:5e:b6:23:6f:fc:50:03:b2:53:da:e6 .l.c,^.#o.P..S..
000000b0 d0:64:db:41:35:08:50:8c:41:ce:f6:e9:97:66:9f:04 .d.A5.P.A....f..
000000c0 79:2f:60:b1:28:7d:4d:15:a6:a4:5e:fd:c7:11:41:a6 y/`.(}M...^...A.
000000d0 bd:89:8c:15:a3:e0:b1:4f:a3:dc:e5:45:06:e6:f0:40 .......O...E...#
000000e0 2e:61:6e:7f:0a:e8:67:0f:b9:04:8d:e8:42:78:f5:c6 .an...g.....Bx..
000000f0 e5:a5:99:7a:58:6d:0e:9c:8e:af:d7:98:bc:e6:6c:cf ...zXm........l.
00000100 e8:1b:f3:e9 ....
<- NET_SSH2_MSG_KEXDH_REPLY (since last: 0.0087, network: 0.0087s)
00000000 00:00:01:17:00:00:00:07:73:73:68:2d:72:73:61:00 ........ssh-rsa.
00000010 00:00:03:01:00:01:00:00:01:01:00:d5:fe:2b:bc:8a .............+..
00000020 f6:16:8f:16:bd:9e:a8:f4:56:bf:5d:88:8b:34:c6:63 ........V.]..4.c
00000030 cf:6d:f3:01:a1:41:f8:b9:20:2c:5f:7e:61:36:9f:10 .m...A.. ,_~a6..
00000040 ff:d3:4b:cf:b9:f1:83:73:6e:36:8a:db:56:f1:20:de ..K....sn6..V. .
00000050 12:a8:88:26:33:07:2a:98:c7:14:dd:81:ce:a2:27:7f ...&3.*.......'.
00000060 b9:2d:27:3e:a6:12:61:1c:9a:ab:d9:cd:59:e6:0c:ba .-'>..a.....Y...
00000070 67:b6:27:ba:d1:c8:00:34:36:1d:d7:60:f5:09:57:ba g.'....46..`..W.
00000080 97:27:a0:8c:7b:4d:36:07:42:c5:4c:9e:c7:22:43:04 .'..{M6.B.L.."C.
00000090 ef:26:82:40:70:55:0f:a1:4a:7e:9e:f7:1b:fa:3d:9a .&.#pU..J~....=.
000000a0 52:da:d0:13:66:d6:f4:0c:bf:2f:35:d5:05:64:22:d0 R...f..../5..d".
000000b0 dc:a9:0d:d7:e0:b9:0a:5c:3e:b0:aa:7d:ca:a8:3a:18 .......\>..}..:.
000000c0 55:17:af:3e:63:42:73:94:49:c8:65:34:a2:0d:a8:5b U..>cBs.I.e4...[
000000d0 49:d7:54:76:06:6c:46:b4:6e:46:ed:68:ae:d1:fe:b8 I.Tv.lF.nF.h....
000000e0 c4:30:b5:ad:c9:47:86:16:93:08:ab:d0:4c:67:7f:d9 .0...G......Lg..
000000f0 12:32:c9:ef:3f:b5:f6:40:1e:a6:89:c8:46:8c:0c:4a .2..?..#....F..J
00000100 45:b1:6b:69:7a:b7:4e:21:2f:d4:4f:30:07:32:72:b0 E.kiz.N!/.O0.2r.
00000110 00:15:e1:c6:d6:98:db:72:ba:54:87:00:00:01:01:00 .......r.T......
00000120 8d:da:a5:75:d2:92:15:17:8c:f5:07:6a:0f:b3:b4:47 ...u.......j...G
00000130 fe:22:bd:95:c4:b6:1c:81:86:bb:6f:e0:17:48:b7:c6 ."........o..H..
00000140 0d:9c:0c:2e:1c:25:a6:13:d9:5e:62:ea:10:79:20:43 .....%...^b..y C
00000150 07:4c:81:92:2d:f9:f9:a9:90:09:49:9e:c9:0d:fb:7e .L..-.....I....~
00000160 fe:73:8f:e3:73:86:cb:ef:71:17:ec:1e:d3:2c:15:b6 .s..s...q....,..
00000170 e0:b1:25:29:45:e4:8b:ea:94:fc:ab:77:87:39:85:09 ..%)E......w.9..
00000180 63:19:0f:88:24:f6:52:51:a2:d1:11:6f:45:53:67:f3 c...$.RQ...oESg.
00000190 73:86:b6:f1:a2:8b:f8:86:cb:36:58:f4:1b:f4:11:ce s........6X.....
000001a0 c1:dc:1d:b0:9f:36:ca:77:1b:63:36:b1:67:36:e7:e6 .....6.w.c6.g6..
000001b0 1f:a9:2d:9d:ed:ae:80:47:5b:ea:21:ef:45:b7:83:41 ..-....G[.!.E..A
000001c0 59:75:86:ef:4e:02:ee:4e:e2:15:a9:82:dc:5b:ab:b0 Yu..N..N.....[..
000001d0 8d:24:0b:95:91:d6:81:10:e2:74:29:ee:b9:8b:36:de .$.......t)...6.
000001e0 89:bc:ee:38:e0:f7:3b:25:f2:f0:84:f9:53:24:f6:c0 ...8..;%....S$..
000001f0 4a:ac:ce:81:5d:05:56:7c:80:cd:d3:4a:df:07:80:74 J...].V|...J...t
00000200 12:b5:d4:3f:11:8f:ec:de:07:0a:f4:6e:34:b8:12:b1 ...?.......n4...
00000210 67:b8:0a:11:4b:e5:7a:47:86:f3:00:e5:6b:73:11:2d g...K.zG....ks.-
00000220 00:00:01:0f:00:00:00:07:73:73:68:2d:72:73:61:00 ........ssh-rsa.
00000230 00:01:00:63:0c:41:98:b6:08:8b:40:4b:c4:1a:52:3c ...c.A....#K..R.
00000240 cc:f9:b9:5d:d7:d3:5e:50:cd:ee:68:2a:06:55:26:0a ...]..^P..h*.U&.
00000250 8e:62:6a:3e:7e:1a:05:45:ca:a4:22:f3:24:8a:63:46 .bj>~..E..".$.cF
00000260 51:6a:82:9a:e2:5f:70:96:a0:04:10:c6:41:20:8f:d0 Qj..._p.....A ..
00000270 bd:12:c2:ce:28:bd:e2:ee:09:e2:2b:2b:69:0b:83:e9 ....(.....++i...
00000280 75:e0:7e:95:0e:b9:67:02:79:c2:1b:59:f4:07:20:03 u.~...g.y..Y.. .
00000290 8a:08:b0:6b:e2:b3:1e:9a:75:3c:dd:c6:20:09:5d:41 ...k....u... .]A
000002a0 2b:cb:2e:16:5a:3a:81:36:04:fa:f7:13:fc:81:3d:4c +...Z:.6......=L
000002b0 2f:69:b9:0e:5e:86:ce:19:a7:16:3f:3b:85:78:c5:63 /i..^.....?;.x.c
000002c0 65:6a:67:f6:9a:b9:1a:b7:48:cd:81:e0:12:7c:12:41 ejg.....H....|.A
000002d0 1a:fe:4a:b8:c9:cb:05:c0:7b:22:bf:b1:b5:8a:d4:36 ..J.....{".....6
000002e0 1a:dd:95:46:56:08:a5:86:71:d6:71:24:9a:4a:94:4e ...FV...q.q$.J.N
000002f0 18:1f:63:4f:7d:86:c1:5e:22:da:6a:67:0a:ff:85:51 ..cO}..^".jg...Q
00000300 09:5e:50:fc:de:60:bc:c9:18:80:49:95:ab:e4:29:35 .^P..`....I...)5
00000310 24:48:df:c1:de:4a:8a:1f:37:6a:d3:39:73:40:70:1e $H...J..7j.9s#p.
00000320 e8:8c:0a:a7:9e:3e:0d:02:d9:10:4e:ff:f2:c2:b9:59 .....>....N....Y
00000330 12:be:00 ...
-> NET_SSH2_MSG_NEWKEYS (since last: 0.0354, network: 0s)
<- NET_SSH2_MSG_NEWKEYS (since last: 0, network: 0s)
-> NET_SSH2_MSG_SERVICE_REQUEST (since last: 0.0003, network: 0s)
00000000 00:00:00:0c:73:73:68:2d:75:73:65:72:61:75:74:68 ....ssh-userauth
<- NET_SSH2_MSG_SERVICE_ACCEPT (since last: 0.0393, network: 0.0393s)
00000000 00:00:00:0c:73:73:68:2d:75:73:65:72:61:75:74:68 ....ssh-userauth
-> NET_SSH2_MSG_USERAUTH_REQUEST (since last: 0.0001, network: 0s)
00000000 00:00:00:08:75:73:65:72:6e:61:6d:65:00:00:00:0e ....username....
00000010 73:73:68:2d:63:6f:6e:6e:65:63:74:69:6f:6e:00:00 ssh-connection..
00000020 00:08:70:61:73:73:77:6f:72:64:00:00:00:00:08:70 ..password.....p
00000030 61:73:73:77:6f:72:64 assword
<- NET_SSH2_MSG_USERAUTH_SUCCESS (since last: 0.028, network: 0.028s)
-> NET_SSH2_MSG_CHANNEL_OPEN (since last: 0.0001, network: 0s)
00000000 00:00:00:07:73:65:73:73:69:6f:6e:00:00:01:00:7f ....session.....
00000010 ff:ff:ff:00:00:40:00 .....#.
<- NET_SSH2_MSG_GLOBAL_REQUEST (since last: 0.001, network: 0s)
00000000 00:00:00:17:68:6f:73:74:6b:65:79:73:2d:30:30:40 ....hostkeys-00#
00000010 6f:70:65:6e:73:73:68:2e:63:6f:6d:00:00:00:01:17 openssh.com.....
00000020 00:00:00:07:73:73:68:2d:72:73:61:00:00:00:03:01 ....ssh-rsa.....
00000030 00:01:00:00:01:01:00:d5:fe:2b:bc:8a:f6:16:8f:16 .........+......
00000040 bd:9e:a8:f4:56:bf:5d:88:8b:34:c6:63:cf:6d:f3:01 ....V.]..4.c.m..
00000050 a1:41:f8:b9:20:2c:5f:7e:61:36:9f:10:ff:d3:4b:cf .A.. ,_~a6....K.
00000060 b9:f1:83:73:6e:36:8a:db:56:f1:20:de:12:a8:88:26 ...sn6..V. ....&
00000070 33:07:2a:98:c7:14:dd:81:ce:a2:27:7f:b9:2d:27:3e 3.*.......'..-'>
00000080 a6:12:61:1c:9a:ab:d9:cd:59:e6:0c:ba:67:b6:27:ba ..a.....Y...g.'.
00000090 d1:c8:00:34:36:1d:d7:60:f5:09:57:ba:97:27:a0:8c ...46..`..W..'..
000000a0 7b:4d:36:07:42:c5:4c:9e:c7:22:43:04:ef:26:82:40 {M6.B.L.."C..&.#
000000b0 70:55:0f:a1:4a:7e:9e:f7:1b:fa:3d:9a:52:da:d0:13 pU..J~....=.R...
000000c0 66:d6:f4:0c:bf:2f:35:d5:05:64:22:d0:dc:a9:0d:d7 f..../5..d".....
000000d0 e0:b9:0a:5c:3e:b0:aa:7d:ca:a8:3a:18:55:17:af:3e ...\>..}..:.U..>
000000e0 63:42:73:94:49:c8:65:34:a2:0d:a8:5b:49:d7:54:76 cBs.I.e4...[I.Tv
000000f0 06:6c:46:b4:6e:46:ed:68:ae:d1:fe:b8:c4:30:b5:ad .lF.nF.h.....0..
00000100 c9:47:86:16:93:08:ab:d0:4c:67:7f:d9:12:32:c9:ef .G......Lg...2..
00000110 3f:b5:f6:40:1e:a6:89:c8:46:8c:0c:4a:45:b1:6b:69 ?..#....F..JE.ki
00000120 7a:b7:4e:21:2f:d4:4f:30:07:32:72:b0:00:15:e1:c6 z.N!/.O0.2r.....
00000130 d6:98:db:72:ba:54:87:00:00:01:b1:00:00:00:07:73 ...r.T.........s
00000140 73:68:2d:64:73:73:00:00:00:81:00:b4:96:06:e1:66 sh-dss.........f
00000150 0e:7b:c8:41:44:ed:0f:57:12:38:72:a2:e0:9c:29:b9 .{.AD..W.8r...).
00000160 b2:a6:8a:e2:de:32:a7:4e:55:7b:88:16:1d:b4:76:2f .....2.NU{....v/
00000170 ac:02:cc:c2:91:8f:b7:a2:e2:d0:0c:be:2e:ef:14:fe ................
00000180 83:c7:8f:25:5c:c3:39:3c:bc:cd:4c:22:9b:1a:f3:61 ...%\.9...L"...a
00000190 ab:17:e8:62:98:31:9c:9c:40:e8:72:46:ea:84:97:c7 ...b.1..#.rF....
000001a0 af:cb:3b:ee:97:3d:6b:4e:f3:2a:d5:95:07:91:9f:a6 ..;..=kN.*......
000001b0 07:6f:a8:46:37:5f:52:c6:f1:be:51:4d:11:eb:c0:d7 .o.F7_R...QM....
000001c0 90:af:32:43:b8:a8:d6:6e:6d:ef:91:00:00:00:15:00 ..2C...nm.......
000001d0 f8:44:03:10:69:61:88:e7:93:61:eb:b3:a4:63:d8:a0 .D..ia...a...c..
000001e0 5d:ef:ff:2d:00:00:00:80:75:64:d2:f0:e9:fe:f0:a0 ]..-....ud......
000001f0 2d:50:43:c9:e8:8a:03:2b:ee:6a:db:c1:b6:66:a6:7d -PC....+.j...f.}
00000200 7f:20:a8:1a:52:ca:67:25:43:c2:43:bc:2f:e0:36:09 . ..R.g%C.C./.6.
00000210 c2:9b:ad:e9:05:34:5c:42:51:f8:a1:62:ae:35:65:0c .....4\BQ..b.5e.
00000220 b7:26:84:e0:6a:01:e9:ec:b7:6c:70:8d:4b:0f:84:1b .&..j....lp.K...
00000230 bd:da:ec:75:e9:9e:53:64:bb:4b:8f:38:e7:91:98:45 ...u..Sd.K.8...E
00000240 49:1c:dc:4d:1f:39:0c:c2:81:1a:da:45:89:d3:a6:aa I..M.9.....E....
00000250 0f:a6:cf:94:69:44:b5:19:fa:48:ac:aa:27:b8:b3:d4 ....iD...H..'...
00000260 81:96:e0:3a:49:bf:e6:1e:00:00:00:80:70:49:d3:95 ...:I.......pI..
00000270 c9:28:dd:ea:7b:f4:56:1f:a9:7e:75:91:61:e1:29:16 .(..{.V..~u.a.).
00000280 94:00:eb:22:b9:17:01:84:64:ae:f2:ce:8f:14:c9:82 ..."....d.......
00000290 0e:54:62:85:dd:d8:7e:65:61:6d:3a:ac:e6:1f:66:19 .Tb...~eam:...f.
000002a0 ba:91:68:bf:93:0d:b7:28:ba:3c:fa:1a:53:39:5b:3a ..h....(....S9[:
000002b0 0f:29:31:b2:82:af:17:27:f5:ea:b0:ff:3d:ff:1a:00 .)1....'....=...
000002c0 a0:29:2b:92:bd:11:ac:7b:48:8b:ce:12:3a:8d:cc:65 .)+....{H...:..e
000002d0 ea:48:74:8a:aa:3a:6f:2a:ea:59:c7:e0:6c:93:f0:91 .Ht..:o*.Y..l...
000002e0 1e:97:0a:0e:5f:c0:51:95:9c:ec:06:6d:00:00:00:68 ...._.Q....m...h
000002f0 00:00:00:13:65:63:64:73:61:2d:73:68:61:32:2d:6e ....ecdsa-sha2-n
00000300 69:73:74:70:32:35:36:00:00:00:08:6e:69:73:74:70 istp256....nistp
00000310 32:35:36:00:00:00:41:04:2b:76:7c:f8:4b:a0:01:71 256...A.+v|.K..q
00000320 2f:a3:7a:2f:99:a3:2f:80:8c:27:c3:ea:78:19:a9:63 /.z/../..'..x..c
00000330 8a:97:ca:93:4a:23:75:75:39:07:70:39:d1:13:15:3c ....J#uu9.p9....
00000340 f6:ac:ca:bc:7a:34:ac:ca:a4:5f:53:4d:a8:f5:e1:a6 ....z4..._SM....
00000350 83:f1:33:8b:bc:94:ec:2a:00:00:00:33:00:00:00:0b ..3....*...3....
00000360 73:73:68:2d:65:64:32:35:35:31:39:00:00:00:20:60 ssh-ed25519... `
00000370 d5:4f:a4:06:4b:1f:ce:c1:47:33:07:6e:7c:1a:c5:ef .O..K...G3.n|...
00000380 db:ed:0d:c5:4b:1b:f1:89:c6:21:f1:52:5e:8d:45 ....K....!.R^.E
-> NET_SSH2_MSG_REQUEST_FAILURE (since last: 0.0001, network: 0s)
<- NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION (since last: 0.0002, network: 0.0002s)
00000000 00:00:01:00:00:00:00:00:00:00:00:00:00:00:80:00 ................
-> NET_SSH2_MSG_CHANNEL_REQUEST (since last: 0.0001, network: 0s)
00000000 00:00:00:00:00:00:00:09:73:75:62:73:79:73:74:65 ........subsyste
00000010 6d:01:00:00:00:04:73:66:74:70 m.....sftp
<- NET_SSH2_MSG_CHANNEL_WINDOW_ADJUST (since last: 0.0032, network: 0s)
00000000 00:00:01:00:00:01:55:54 ......UT
<- NET_SSH2_MSG_CHANNEL_SUCCESS (since last: 0, network: 0s)
00000000 00:00:01:00 ....
-> NET_SSH2_MSG_CHANNEL_DATA (since last: 0.0001, network: 0s)
00000000 00:00:00:00:00:00:00:09:00:00:00:05:01:00:00:00 ................
00000010 03 .
<- NET_SSH2_MSG_CHANNEL_DATA (since last: 0.0159, network: 0.0158s)
00000000 00:00:01:00:00:00:00:9a:00:00:00:96:02:00:00:00 ................
00000010 03:00:00:00:18:70:6f:73:69:78:2d:72:65:6e:61:6d .....posix-renam
00000020 65:40:6f:70:65:6e:73:73:68:2e:63:6f:6d:00:00:00 e#openssh.com...
00000030 01:31:00:00:00:13:73:74:61:74:76:66:73:40:6f:70 .1....statvfs#op
00000040 65:6e:73:73:68:2e:63:6f:6d:00:00:00:01:32:00:00 enssh.com....2..
00000050 00:14:66:73:74:61:74:76:66:73:40:6f:70:65:6e:73 ..fstatvfs#opens
00000060 73:68:2e:63:6f:6d:00:00:00:01:32:00:00:00:14:68 sh.com....2....h
00000070 61:72:64:6c:69:6e:6b:40:6f:70:65:6e:73:73:68:2e ardlink#openssh.
00000080 63:6f:6d:00:00:00:01:31:00:00:00:11:66:73:79:6e com....1....fsyn
00000090 63:40:6f:70:65:6e:73:73:68:2e:63:6f:6d:00:00:00 c#openssh.com...
000000a0 01:31 .1
-> NET_SSH2_MSG_CHANNEL_DATA (since last: 0.0001, network: 0s)
00000000 00:00:00:00:00:00:00:0e:00:00:00:0a:10:00:00:00 ................
00000010 01:00:00:00:01:2e ......
<- NET_SSH2_MSG_CHANNEL_DATA (since last: 0.0003, network: 0.0003s)
00000000 00:00:01:00:00:00:00:1b:00:00:00:17:68:00:00:00 ............h...
00000010 01:00:00:00:01:00:00:00:01:2f:00:00:00:01:2f:00 ........./..../.
00000020 00:00:00 ...
-> NET_SSH2_MSG_CHANNEL_DATA (since last: 0.0059, network: 0s)
00000000 00:00:00:00:00:00:00:28:00:00:00:24:03:00:00:00 .......(...$....
00000010 01:00:00:00:13:2f:74:6d:70:2f:61:75:64:69:74:5f ...../tmp/audit_
00000020 6c:69:6e:75:78:2e:73:68:00:00:00:1a:00:00:00:00 linux.sh........
<- NET_SSH2_MSG_CHANNEL_DATA (since last: 0.0005, network: 0.0005s)
00000000 00:00:01:00:00:00:00:21:00:00:00:1d:65:00:00:00 .......!....e...
00000010 01:00:00:00:02:00:00:00:0c:4e:6f:20:73:75:63:68 .........No such
00000020 20:66:69:6c:65:00:00:00:00 file....
It seems DiskStation does put you in a chroot. As per https://forum.restic.net/t/new-user-sftp-issues/165
And sftp also puts you in your home directory, but in a chroot environment where that directory is at the root and you can’t leave.
mark#desktop:/$ sftp mark#192.168.1.22
mark#192.168.1.22's password:
Connected to 192.168.1.22.
sftp> cd /tmp
Couldn't stat remote file: No such file or directory
sftp> pwd
Remote working directory: /
sftp>
Related
friends!
I have a problem with compiling modules for prebuilt kernel.
The problem is - compiled modules fails with Oops near "fill_super" function.
compile modules - OK
insmod modules - OK
Try to mount filesystem (ntfs/ext2/ext3/ext4) - got Oops :(
Sample trace here
Unable to handle kernel NULL pointer dereference at virtual address 00000008
pgd = c39e8000
[00000008] *pgd=83a72831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#2]
Modules linked in: ntfs ext3 jbd crc16 scsi_wait_scan hi3520D_adec(P) hi3520D_aenc(P) hi3520D_ao(P) hi3520D_ai(P) hi3520D_sio(P) hiwdt hi_ir hi_rtc fvideo gpioi2c hi3520D_hdmi(P) hi3520D_vfmw(P) hi3520D_vdec(P) hifb(P) vcmp(P) hi3520D_region(P) hi3520D_vpss(P) hi3520D_vou(P) hi3520D_viu(P) hi3520D_rc(P) hi3520D_h264e(P) hi3520D_chnl(P) hi3520D_group(P) hi3520D_venc(P) hi3520D_dsu(P) hi3520D_tde(P) hi3520D_sys(P) hi3520D_base(P) hiuser mmz
CPU: 0 Tainted: P D (3.0.8 #6)
PC is at __find_get_block_slow+0x10/0x13c
LR is at __find_get_block+0xec/0x500
pc : [<c00bb3a8>] lr : [<c00bb934>] psr: 68000013
sp : c39b5ca4 ip : c39b5cd4 fp : c39b5cd0
r10: 00000100 r9 : c39d3000 r8 : c39d3000
r7 : 00000000 r6 : 00000400 r5 : c03d2830 r4 : c53acb00
r3 : 00000100 r2 : 00000400 r1 : 00000000 r0 : 00000000
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Control: 10c53c7d Table: 839e8059 DAC: 00000015
PC: 0xc00bb328:
b328 e1a0c00d e92dd800 e24cb004 e5903000 e3130a02 13a00001 189da800 e30a0f14
b348 e34c0030 ebfde5bb e2700001 33a00000 e89da800 e1a0c00d e92dd810 e24cb004
b368 e24dd024 e1a04000 e24b1034 e5900020 eb009372 e1c421d0 e1a01000 e30309a8
b388 e34c0038 eb0924df e24bd010 e89da810 e1a0c00d e92ddbf0 e24cb004 e24dd008
b3a8 e5905008 e1a09003 e1a08002 e595e064 e59500b0 e26e400c e2641020 e1a0c432
b3c8 e18c2113 e2543020 41a01002 51a01339 ebfec239 e2504000 01a06004 0a000018
b3e8 e5940000 e3100b02 0a000012 e5946000 e3160b02 0a000030 e594700c e3a01001
b408 e1a06007 e5963000 e2132020 01a01002 0a000003 e1c621d0 e1530009 01520008
LR: 0xc00bb8b4:
b8b4 0a0000ae e5951014 e3510000 0a000002 e591c020 e150000c 0a0000b2 e5951018
b8d4 e3510000 0a000002 e591c020 e150000c 0a0000b6 e595101c e3510000 0a000002
b8f4 e591c020 e150000c 0a0000ba e5951020 e3510000 0a000002 e591c020 e150000c
b914 0a00008c e5951024 e3510000 0a000002 e5914020 e1500004 0a0000b8 ebfffe98
b934 e2504000 0a000076 e10f2000 e3120080 1a0000fa e5951008 e3023830 e34c303d
b954 e1540001 0a00006c e284e038 e19ecf9f e28cc001 e18e1f9c e3310000 1afffffa
b974 e593c008 e50b403c e154000c 150bc038 13a06002 0a0000da e595300c e1540003
b994 0a0000d4 e24b001c e0802106 e2866001 e5023020 e5953010 e1540003 0a0000dc
SP: 0xc39b5c24:
5c24 c39b5c40 c39b5c34 c00485ec c39b5cb8 c39b4000 ffffffff c39b5c8c 00000400
5c44 00000000 c39b5cd0 c39b5c58 c0024d8c c0024250 00000000 00000000 00000400
5c64 00000100 c53acb00 c03d2830 00000400 00000000 c39d3000 c39d3000 00000100
5c84 c39b5cd0 c39b5cd4 c39b5ca4 c00bb934 c00bb3a8 68000013 ffffffff 00000002
5ca4 c39b5e47 0000000a c53acb00 c03d2830 00000400 00000000 c39d3000 c39d3000
5cc4 c39b5d10 c39b5cd4 c00bb934 c00bb3a4 0000000a 0000ffff c39b5e64 0000ffff
5ce4 c39b5d90 c39b5cf4 c01909c0 c01903ac c53acb00 00000000 00000400 00000000
5d04 c39b5d78 c39b5d14 c00bbd70 c00bb854 00000000 00000000 c5c03c40 c39ed000
IP: 0xc39b5c54:
5c54 c0024250 00000000 00000000 00000400 00000100 c53acb00 c03d2830 00000400
5c74 00000000 c39d3000 c39d3000 00000100 c39b5cd0 c39b5cd4 c39b5ca4 c00bb934
5c94 c00bb3a8 68000013 ffffffff 00000002 c39b5e47 0000000a c53acb00 c03d2830
5cb4 00000400 00000000 c39d3000 c39d3000 c39b5d10 c39b5cd4 c00bb934 c00bb3a4
5cd4 0000000a 0000ffff c39b5e64 0000ffff c39b5d90 c39b5cf4 c01909c0 c01903ac
5cf4 c53acb00 00000000 00000400 00000000 c39b5d78 c39b5d14 c00bbd70 c00bb854
5d14 00000000 00000000 c5c03c40 c39ed000 00000400 00000000 c00c3264 c006d8d8
5d34 c39b5d50 c39b5d44 0000000a c5c03c40 c39b5d70 c39b5d54 c00c3f9c c53acb00
FP: 0xc39b5c50:
5c50 c0024d8c c0024250 00000000 00000000 00000400 00000100 c53acb00 c03d2830
5c70 00000400 00000000 c39d3000 c39d3000 00000100 c39b5cd0 c39b5cd4 c39b5ca4
5c90 c00bb934 c00bb3a8 68000013 ffffffff 00000002 c39b5e47 0000000a c53acb00
5cb0 c03d2830 00000400 00000000 c39d3000 c39d3000 c39b5d10 c39b5cd4 c00bb934
5cd0 c00bb3a4 0000000a 0000ffff c39b5e64 0000ffff c39b5d90 c39b5cf4 c01909c0
5cf0 c01903ac c53acb00 00000000 00000400 00000000 c39b5d78 c39b5d14 c00bbd70
5d10 c00bb854 00000000 00000000 c5c03c40 c39ed000 00000400 00000000 c00c3264
5d30 c006d8d8 c39b5d50 c39b5d44 0000000a c5c03c40 c39b5d70 c39b5d54 c00c3f9c
R4: 0xc53aca80:
ca80 c04b0b60 c04b0b80 c04b0ba0 c04b0bc0 c04b0be0 c04b0c00 c04b0c20 c04b0c40
caa0 c04b0c60 c04b0c80 c04b0ca0 c04b0cc0 c04b0ce0 c04b0d00 c04b0d20 c04b0d40
cac0 c04b0d60 c04b0d80 c04b0da0 c04b0dc0 00000000 00000000 00000000 00000000
cae0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
cb00 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
cb20 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
cb40 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000
cb60 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
R5: 0xc03d27b0:
27b0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
27d0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
27f0 00000000 00000000 00000000 00000000 00000001 00000000 00000001 c03a31a8
2810 00000023 00000032 00000012 00000000 c6180780 c5c02280 c6180780 c5c02280
2830 000013b9 000006fa 00000000 00000000 00000000 00000000 00000000 00000000
2850 00000000 00000000 00000001 c03d285c c03d285c 00000200 c03d2868 c03d2868
2870 c00c0978 c5cad214 c5c03214 c0383894 00000000 c00c2fd0 c00972c0 00000000
2890 c03d2a88 c6003490 c6003490 c03d289c c03d289c c612ff80 c612ff80 c00c905c
R8: 0xc39d2f80:
2f80 746f6e2e 6e672e65 75622e75 2d646c69 ff006469 ffffffff ffffffff ffffffff
2fa0 6d79732e 00626174 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
2fc0 7274732e 00626174 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
2fe0 74636573 736e6f69 ffffff00 ffffffff ffffffff ffffffff ffffffff ffffffff
3000 00000000 00000000 00000000 00000061 0000e0a5 00000003 00c1c540 00c1d540
3020 00c1c540 00c1c540 00c1c540 00c1c540 000b0850 00c1c4e4 0004f8b8 0004f8b0
3040 0004f884 0004f87c 00000000 00000000 00000000 00000000 00000002 00000000
3060 00000000 00000000 00000000 00001009 65646f6e 79730976 0a736673 65646f6e
R9: 0xc39d2f80:
2f80 746f6e2e 6e672e65 75622e75 2d646c69 ff006469 ffffffff ffffffff ffffffff
2fa0 6d79732e 00626174 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
2fc0 7274732e 00626174 ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff
2fe0 74636573 736e6f69 ffffff00 ffffffff ffffffff ffffffff ffffffff ffffffff
3000 00000000 00000000 00000000 00000061 0000e0a5 00000003 00c1c540 00c1d540
3020 00c1c540 00c1c540 00c1c540 00c1c540 000b0850 00c1c4e4 0004f8b8 0004f8b0
3040 0004f884 0004f87c 00000000 00000000 00000000 00000000 00000002 00000000
3060 00000000 00000000 00000000 00001009 65646f6e 79730976 0a736673 65646f6e
Process mount (pid: 790, stack limit = 0xc39b4268)
Stack: (0xc39b5ca4 to 0xc39b6000)
5ca0: c39b5e47 0000000a c53acb00 c03d2830 00000400 00000000 c39d3000
5cc0: c39d3000 c39b5d10 c39b5cd4 c00bb934 c00bb3a4 0000000a 0000ffff c39b5e64
5ce0: 0000ffff c39b5d90 c39b5cf4 c01909c0 c01903ac c53acb00 00000000 00000400
5d00: 00000000 c39b5d78 c39b5d14 c00bbd70 c00bb854 00000000 00000000 c5c03c40
5d20: c39ed000 00000400 00000000 c00c3264 c006d8d8 c39b5d50 c39b5d44 0000000a
5d40: c5c03c40 c39b5d70 c39b5d54 c00c3f9c c53acb00 c39ed000 00000400 00000000
5d60: c39d3000 c39d3000 00000001 c39b5d98 c39b5d7c c00bfd60 c00bbd54 00000000
5d80: c39b5d8c c00c403c c53acb00 c39b5e40 c39b5d9c bf3ee6c8 c00bfd50 00000000
5da0: c39b5db4 bf3f5a10 00000001 c0318714 c39b5e44 ff0a0210 ffffffff c39b5e20
5dc0: c39b5e44 00000002 c534cc00 c534cc0c c39ed000 c39d3000 c39d3000 c39b5e00
5de0: c39b5dec c019322c 00000001 c0096838 c39b5e08 c39b5e30 c39b5e0c c00e0120
5e00: c0193218 c03853cc c39ed14c c39d3000 00000000 00000000 c5c03c40 00000083
5e20: c5c03ca4 00008000 c39ed000 c39d3000 c39d3000 c39b5e88 c39b5e44 c0097a80
5e40: bf3ee5e8 32616473 c39b5e00 c0091ccc c39cd250 00000000 c39b5e84 c39b5e68
5e60: c0092a78 c39cd1e0 bf3f5a10 bf3f5a10 00008000 c39d3000 c39b5f38 c39b5e9c
5e80: c39b5e8c bf3eca7c c009792c bf3ee5dc c39b5ecc c39b5ea0 c0096888 bf3eca68
5ea0: c00aea60 c007cde0 bf3f5a10 c39cd1e0 bf3f5a10 c39ff9e0 c39d3000 c39d3000
5ec0: c39b5ef4 c39b5ed0 c00b02f8 c0096878 c39d3000 bf3f5a10 c39ffaa0 c39d3000
5ee0: c39ff9e0 00008000 c39b5f1c c39b5ef8 c00b038c c00b02ac c39d3000 00000000
5f00: c39ff9e0 00000020 c39ffaa0 00008000 c39b5f6c c39b5f20 c00b057c c00b035c
5f20: c39b4000 00008000 c39b5f44 c39b5f38 c0074058 c00739d0 c6180780 c5cbf800
5f40: c00af2c8 c56bf000 befd6f59 00000000 00008000 c0025324 c39b4000 00000000
5f60: c39b5fa4 c39b5f70 c00b0b98 c00b0430 c39d3000 00000000 fe300100 c39d3000
5f80: c39ff9e0 c39ffaa0 00c1c4d0 00c1c4d0 befd6f59 00000015 00000000 c39b5fa8
5fa0: c00251a0 c00b0b18 00c1c4d0 00c1c4d0 befd6f59 befd6f63 00c1d750 00008000
5fc0: 00c1c4d0 00c1c4d0 befd6f59 00000015 befd6f63 00c1c4e0 00c1d750 0006bcc8
5fe0: 00c1c498 befd6af4 00020618 000425e0 60000010 befd6f59 00000000 00000000
Backtrace:
[<c00bb398>] (__find_get_block_slow+0x0/0x13c) from [<c00bb934>] (__find_get_block+0xec/0x500)
r9:c39d3000 r8:c39d3000 r7:00000000 r6:00000400 r5:c03d2830
r4:c53acb00
[<c00bb848>] (__find_get_block+0x0/0x500) from [<c00bbd70>] (__getblk+0x28/0x2fc)
r7:00000000 r6:00000400 r5:00000000 r4:c53acb00
[<c00bbd48>] (__getblk+0x0/0x2fc) from [<c00bfd60>] (__bread+0x1c/0xdc)
[<c00bfd44>] (__bread+0x0/0xdc) from [<bf3ee6c8>] (ext3_fill_super+0xec/0x1734 [ext3])
r4:c53acb00
[<bf3ee5dc>] (ext3_fill_super+0x0/0x1734 [ext3]) from [<c0097a80>] (mount_bdev+0x160/0x18c)
[<c0097920>] (mount_bdev+0x0/0x18c) from [<bf3eca7c>] (ext3_mount+0x20/0x24 [ext3])
[<bf3eca5c>] (ext3_mount+0x0/0x24 [ext3]) from [<c0096888>] (mount_fs+0x1c/0xe0)
[<c009686c>] (mount_fs+0x0/0xe0) from [<c00b02f8>] (vfs_kern_mount+0x58/0x90)
r9:c39d3000 r8:c39d3000 r6:c39ff9e0 r5:bf3f5a10 r4:c39cd1e0
[<c00b02a0>] (vfs_kern_mount+0x0/0x90) from [<c00b038c>] (do_kern_mount+0x3c/0xd4)
r8:00008000 r7:c39ff9e0 r6:c39d3000 r5:c39ffaa0 r4:bf3f5a10
r3:c39d3000
[<c00b0350>] (do_kern_mount+0x0/0xd4) from [<c00b057c>] (do_mount+0x158/0x6e8)
r8:00008000 r7:c39ffaa0 r6:00000020 r5:c39ff9e0 r4:00000000
r3:c39d3000
[<c00b0424>] (do_mount+0x0/0x6e8) from [<c00b0b98>] (sys_mount+0x8c/0xcc)
[<c00b0b0c>] (sys_mount+0x0/0xcc) from [<c00251a0>] (ret_fast_syscall+0x0/0x30)
r7:00000015 r6:befd6f59 r5:00c1c4d0 r4:00c1c4d0
Code: e1a0c00d e92ddbf0 e24cb004 e24dd008 (e5905008)
---[ end trace b62a4323b2714208 ]---
Any ideas?
I'm very confused here. I have been running this particular code for over a year and today it suddenly stopped working. I upload .zip files to a server on a periodic basis using the SFTP functionality in phpseclib and I'm suddenly getting the error NET_SSH2_MSG_USERAUTH_FAILURE.
Code is as follows:
$sftp = new Net_SFTP($sftpURI);
if (!$sftp->login($user, $password)) {
echo "<pre>" . $sftp->getLog() . "</pre>";
echo "<pre>" . $sftp->getSFTPLog() . "</pre>";
exit;
}
$sftp->chdir($inventoryPathName);
$sftp->put("inventory-". $dateStamp . ".zip", $zipPath . "ns_inventory-". $dateStamp . ".zip", NET_SFTP_LOCAL_FILE);
Log output:
<-
00000000 53:53:48:2d:32:2e:30:2d:45:78:61:6d:70:6c:65:53 SSH-2.0-ExampleS
00000010 53:48:44:5f:31:2e:32:2e:33:5f:43:6f:6d:6d:65:6e SHD_1.2.3_Commen
00000020 74:73:0d:0a ts..
->
00000000 53:53:48:2d:32:2e:30:2d:70:68:70:73:65:63:6c:69 SSH-2.0-phpsecli
00000010 62:5f:30:2e:33:20:28:6d:63:72:79:70:74:2c:20:67 b_0.3 (mcrypt, g
00000020 6d:70:29:0d:0a mp)..
<- NET_SSH2_MSG_KEXINIT (0.0522s)
00000000 90:f8:f9:4d:2f:05:2c:3f:e2:32:2a:88:ea:47:f8:46 ...M/.,?.2*..G.F
00000010 00:00:00:7e:64:69:66:66:69:65:2d:68:65:6c:6c:6d ...~diffie-hellm
00000020 61:6e:2d:67:72:6f:75:70:31:2d:73:68:61:31:2c:64 an-group1-sha1,d
00000030 69:66:66:69:65:2d:68:65:6c:6c:6d:61:6e:2d:67:72 iffie-hellman-gr
00000040 6f:75:70:31:34:2d:73:68:61:31:2c:64:69:66:66:69 oup14-sha1,diffi
00000050 65:2d:68:65:6c:6c:6d:61:6e:2d:67:72:6f:75:70:2d e-hellman-group-
00000060 65:78:63:68:61:6e:67:65:2d:73:68:61:31:2c:64:69 exchange-sha1,di
00000070 66:66:69:65:2d:68:65:6c:6c:6d:61:6e:2d:67:72:6f ffie-hellman-gro
00000080 75:70:2d:65:78:63:68:61:6e:67:65:2d:73:68:61:32 up-exchange-sha2
00000090 35:36:00:00:00:0f:73:73:68:2d:64:73:73:2c:73:73 56....ssh-dss,ss
000000a0 68:2d:72:73:61:00:00:00:7e:61:65:73:31:32:38:2d h-rsa...~aes128-
000000b0 63:62:63:2c:33:64:65:73:2d:63:74:72:2c:61:65:73 cbc,3des-ctr,aes
000000c0 31:32:38:2d:63:74:72:2c:61:65:73:31:39:32:2d:63 128-ctr,aes192-c
000000d0 74:72:2c:61:65:73:32:35:36:2d:63:74:72:2c:33:64 tr,aes256-ctr,3d
000000e0 65:73:2d:63:62:63:2c:62:6c:6f:77:66:69:73:68:2d es-cbc,blowfish-
000000f0 63:62:63:2c:61:65:73:31:39:32:2d:63:62:63:2c:61 cbc,aes192-cbc,a
00000100 65:73:32:35:36:2d:63:62:63:2c:61:72:63:66:6f:75 es256-cbc,arcfou
00000110 72:2c:61:72:63:66:6f:75:72:31:32:38:2c:61:72:63 r,arcfour128,arc
00000120 66:6f:75:72:32:35:36:00:00:00:7e:61:65:73:31:32 four256...~aes12
00000130 38:2d:63:62:63:2c:33:64:65:73:2d:63:74:72:2c:61 8-cbc,3des-ctr,a
00000140 65:73:31:32:38:2d:63:74:72:2c:61:65:73:31:39:32 es128-ctr,aes192
00000150 2d:63:74:72:2c:61:65:73:32:35:36:2d:63:74:72:2c -ctr,aes256-ctr,
00000160 33:64:65:73:2d:63:62:63:2c:62:6c:6f:77:66:69:73 3des-cbc,blowfis
00000170 68:2d:63:62:63:2c:61:65:73:31:39:32:2d:63:62:63 h-cbc,aes192-cbc
00000180 2c:61:65:73:32:35:36:2d:63:62:63:2c:61:72:63:66 ,aes256-cbc,arcf
00000190 6f:75:72:2c:61:72:63:66:6f:75:72:31:32:38:2c:61 our,arcfour128,a
000001a0 72:63:66:6f:75:72:32:35:36:00:00:00:4b:68:6d:61 rcfour256...Khma
000001b0 63:2d:6d:64:35:2c:68:6d:61:63:2d:73:68:61:31:2c c-md5,hmac-sha1,
000001c0 68:6d:61:63:2d:6d:64:35:2d:39:36:2c:68:6d:61:63 hmac-md5-96,hmac
000001d0 2d:73:68:61:31:2d:39:36:2c:68:6d:61:63:2d:73:68 -sha1-96,hmac-sh
000001e0 61:32:35:36:2c:68:6d:61:63:2d:73:68:61:32:35:36 a256,hmac-sha256
000001f0 40:73:73:68:2e:63:6f:6d:00:00:00:4b:68:6d:61:63 #ssh.com...Khmac
00000200 2d:6d:64:35:2c:68:6d:61:63:2d:73:68:61:31:2c:68 -md5,hmac-sha1,h
00000210 6d:61:63:2d:6d:64:35:2d:39:36:2c:68:6d:61:63:2d mac-md5-96,hmac-
0000-md5-96,hmac-
00000220 73:68:61:31:2d:39:36:2c:68:6d:61:63:2d:73:68:61 sha1-96,hmac-sha
00000230 32:35:36:2c:68:6d:61:63:2d:73:68:61:32:35:36:40 256,hmac-sha256#
00000240 73:73:68:2e:63:6f:6d:00:00:00:09:6e:6f:6e:65:2c ssh.com....none,
00000250 7a:6c:69:62:00:00:00:09:6e:6f:6e:65:2c:7a:6c:69 zlib....none,zli
00000260 62:00:00:00:00:00:00:00:00:00:00:00:00:00 b.............
-> NET_SSH2_MSG_KEXINIT (0s)
00000000 66:7a:67:34:41:bb:a0:08:8a:1b:31:0e:a3:c5:9c:7b fzg4A.....1....{
00000010 00:00:00:36:64:69:66:66:69:65:2d:68:65:6c:6c:6d ...6diffie-hellm
00000020 61:6e:2d:67:72:6f:75:70:31:2d:73:68:61:31:2c:64 an-group1-sha1,d
00000030 69:66:66:69:65:2d:68:65:6c:6c:6d:61:6e:2d:67:72 iffie-hellman-gr
00000040 6f:75:70:31:34:2d:73:68:61:31:00:00:00:0f:73:73 oup14-sha1....ss
00000050 68:2d:72:73:61:2c:73:73:68:2d:64:73:73:00:00:00 h-rsa,ssh-dss...
00000060 76:61:72:63:66:6f:75:72:32:35:36:2c:61:72:63:66 varcfour256,arcf
00000070 6f:75:72:31:32:38:2c:61:72:63:66:6f:75:72:2c:61 our128,arcfour,a
00000080 65:73:31:32:38:2d:63:62:63:2c:61:65:73:31:39:32 es128-cbc,aes192
00000090 2d:63:62:63:2c:61:65:73:32:35:36:2d:63:62:63:2c -cbc,aes256-cbc,
000000a0 61:65:73:31:32:38:2d:63:74:72:2c:61:65:73:31:39 aes128-ctr,aes19
000000b0 32:2d:63:74:72:2c:61:65:73:32:35:36:2d:63:74:72 2-ctr,aes256-ctr
000000c0 2c:33:64:65:73:2d:63:74:72:2c:33:64:65:73:2d:63 ,3des-ctr,3des-c
000000d0 62:63:2c:6e:6f:6e:65:00:00:00:76:61:72:63:66:6f bc,none...varcfo
000000e0 75:72:32:35:36:2c:61:72:63:66:6f:75:72:31:32:38 ur256,arcfour128
000000f0 2c:61:72:63:66:6f:75:72:2c:61:65:73:31:32:38:2d ,arcfour,aes128-
00000100 63:62:63:2c:61:65:73:31:39:32:2d:63:62:63:2c:61 cbc,aes192-cbc,a
00000110 65:73:32:35:36:2d:63:62:63:2c:61:65:73:31:32:38 es256-cbc,aes128
00000120 2d:63:74:72:2c:61:65:73:31:39:32:2d:63:74:72:2c -ctr,aes192-ctr,
00000130 61:65:73:32:35:36:2d:63:74:72:2c:33:64:65:73:2d aes256-ctr,3des-
00000140 63:74:72:2c:33:64:65:73:2d:63:62:63:2c:6e:6f:6e ctr,3des-cbc,non
00000150 65:00:00:00:30:68:6d:61:63:2d:73:68:61:31:2d:39 e...0hmac-sha1-9
00000160 36:2c:68:6d:61:63:2d:73:68:61:31:2c:68:6d:61:63 6,hmac-sha1,hmac
00000170 2d:6d:64:35:2d:39:36:2c:68:6d:61:63:2d:6d:64:35 -md5-96,hmac-md5
00000180 2c:6e:6f:6e:65:00:00:00:30:68:6d:61:63:2d:73:68 ,none...0hmac-sh
00000190 61:31:2d:39:36:2c:68:6d:61:63:2d:73:68:61:31:2c a1-96,hmac-sha1,
000001a0 68:6d:61:63:2d:6d:64:35:2d:39:36:2c:68:6d:61:63 hmac-md5-96,hmac
000001b0 2d:6d:64:35:2c:6e:6f:6e:65:00:00:00:04:6e:6f:6e -md5,none....non
000001c0 65:00:00:00:04:6e:6f:6e:65:00:00:00:00:00:00:00 e....none.......
000001d0 00:00:00:00:00:00 ......
-> NET_SSH2_MSG_KEXDH_INIT (0s)
00000000 00:00:00:81:00:fe:b3:2a:f3:ad:79:2d:12:8e:f2:57 .......*..y-...W
00000010 69:f9:65:c3:b7:08:37:a9:30:83:16:2f:cb:5e:3b:e0 i.e...7.0../.^;.
00000020 60:73:c3:b0:3e:d5:0a:85:16:28:70:67:37:8a:a4:b3 `s..>....(pg7...
00000030 07:1d:bb:42:5b:ac:ca:eb:2a:fc:fc:ea:72:ed:c5:14 ...B[...*...r...
00000040 fe:89:89:c3:72:54:5f:1c:7e:42:12:0c:50:66:0d:2c ....rT_.~B..Pf.,
00000050 5d:3d:32:7e:64:87:7c:8f:54:8a:d5:cd:64:e1:1a:58 ]=2~d.|.T...d..X
00000060 c5:ac:10:9e:89:9b:b2:20:e7:6f:23:cd:8c:80:b1:b0 ....... .o#.....
00000070 a1:3d:1a:6d:23:38:9c:df:bc:c0:a3:54:fa:59:57:0f .=.m#8.....T.YW.
00000080 08:5a:7c:4d:70 .Z|Mp
<- NET_SSH2_MSG_KEXDH_REPLY (0.1044s)
00000000 00:00:00:97:00:00:00:07:73:73:68:2d:72:73:61:00 ........ssh-rsa.
00000010 00:00:03:01:00:01:00:00:00:81:00:ad:46:7f:46:ed ............F.F.
00000020 59:95:74:15:57:f6:15:9b:06:7b:02:a0:21:a3:52:eb Y.t.W....{..!.R.
00000030 b9:f6:cf:eb:cc:9a:e2:b4:75:04:a1:3d:5a:af:a6:50 ........u..=Z..P
00000040 a5:f1:b7:88:d5:1b:c2:de:ea:33:86:78:c8:09:5e:66 .........3.x..^f
00000050 22:e0:b2:35:e2:c0:b9:ef:74:ab:7a:c0:6f:22:474:ab:7a:c0:6f:22:47:00 "..5....t.z.o"G.
00000060 eb:8b:fb:62:24:f1:01:80:72:ae:ff:22:2f:ed:02:26 ...b$...r.."/..&
00000070 34:ac:8b:0f:cd:be:db:54:a6:87:f9:59:db:3.Y.5..
00000080 b1:46:20:7e:63:ef:3d:0f:a8:09:e4:cc:ef:cc:a3:0b .F ~c.=.........
00000090 35:66:a9:59:71:d0:a0:9e:e2:15:75:00:00:00:81:00 5f.Yq.....u.....
000000a0 de:14:bc:cc:e9:71:29:54:65:ce:e1:c7:70:b7:d3:e4 .....q)Te...p...
000000b0 43:12:43:1a:47:89:bb:04:5d:0b:1d:a4:ff:2b:88:2a C.C.G...]....+.*
000000c0 e6:9a:18:2d:fc:be:0d:0b:9c:9f:aa:0a:32:18:dc:08 ...-........2...
000000d0 4e:00:60:bc:c2:bd:93:3d:fd:4a:f9:fe:9b:a2:de:e9 N.`....=.J......
000000e0 e3:16:81:58:e5:93:0f:c5:3b:4a:88:dd:1b:43:d8:85 ...X....;J...C..
000000f0 d3:48:57:6f:09:ca:e7:f8:29:d9:42:df:7c:bd:c0:ce .HWo....).B.|...
00000100 6c:e7:39:32:2b:35:97:86:e5:ec:51:70:c5:f5:64:65 l.92+5....Qp..de
00000110 df:f9:a8:fd:22:8e:64:ec:99:6d:61:97:19:b5:0f:8e ....".d..ma.....
00000120 00:00:00:8f:00:00:00:07:73:73:68:2d:72:73:61:00 ........ssh-rsa.
00000130 00:00:80:09:c5:60:f7:8e:03:e6:31:35:9e:1e:49:19 .....`....15..I.
00000140 2f:a1:ef:4a:44:96:08:50:f2:15:e9:db:9a:35:c6:cc /..JD..P.....5..
00000150 af:4f:a5:a8:61:a2:c9:6f:62:39:0c:0c:fc:e2:c3:2d .O..a..ob9.....-
00000160 30:63:ce:e9:e1:b2:2c:f3:e5:4e:01:7a:f4:5c:71:f0 0c....,..N.z.\q.
00000170 94:2f:36:a7:68:1c:8e:87:2a:da:cd:95:ad:75:6e:3b ./6.h...*....un;
00000180 ab:bc:04:59:81:ac:0b:3e:88:bb:be:51:e0:56:d7:07 ...Y...>...Q.V..
00000190 b5:e1:86:47:d3:38:a3:86:63:dd:69:77:f3:01:eb:70 ...G.8..c.iw...p
000001a0 84:51:49:ef:05:e9:20:1f:36:03:5e:70:b4:17:f2:98 .QI... .6.^p....
000001b0 a8:5c:7f .\.
-> NET_SSH2_MSG_NEWKEYS (0.0001s)
<- NET_SSH2_MSG_NEWKEYS (0s)
-> NET_SSH2_MSG_SERVICE_REQUEST (0.0001s)
00000000 00:00:00:0c:73:73:68:2d:75:73:65:72:61:75:74:68 ....ssh-userauth
<- NET_SSH2_MSG_SERVICE_ACCEPT (0.1004s)
00000000 00:00:00:0c:73:73:68:2d:75:73:65:72:61:75:74:68 ....ssh-userauth
-> NET_SSH2_MSG_USERAUTH_REQUEST (0.0001s)
00000000 32:00:00:00:08:75:73:65:72:6e:61:6d:65:00:00:00 2....username...
00000010 0e:73:73:68:2d:63:6f:6e:6e:65:63:74:69:6f:6e:00 .ssh-connection.
00000020 00:00:08:70:61:73:73:77:6f:72:64:00:00:00:00:08 ...password.....
00000030 70:61:73:73:77:6f:72:64 password
<- NET_SSH2_MSG_USERAUTH_FAILURE (0.1549s)
00000000 00:00:00:27:70:61:73:73:77:6f:72:64:2c:70:75:62 ...'password,pub
00000010 6c:69:63:6b:65:79:2c:6b:65:79:62:6f:61:72:64:2d lickey,keyboard-
00000020 69:6e:74:65:72:61:63:74:69:76:65:00 interactive.
-> NET_SSH2_MSG_USERAUTH_REQUEST (0.0001s)
00000000 00:00:00:0c:67:65:6f:72:67:65:73:6d:75:73:69:63 ....georgesmusic
00000010 00:00:00:0e:73:73:68:2d:63:6f:6e:6e:65:63:74:69 ....ssh-connecti
00000020 6f:6e:00:00:00:14:6b:65:79:62:6f:61:72:64:2d:69 on....keyboard-i
00000030 6e:74:65:72:61:63:74:69:76:65:00:00:00:00:00:00 nteractive......
00000040 00:00 ..
<- NET_SSH2_MSG_USERAUTH_INFO_REQUEST (60) (0.0521s)
00000000 00:00:00:08:70:61:73:73:77:6f:72:64:00:00:00:1f ....password....
00000010 45:6e:74:65:72:20:70:61:73:73:77:6f:72:64:20:66 Enter password f
00000020 6f:72:20:67:65:6f:72:67:65:73:6d:75:73:69:63:00 or georgesmusic.
00000030 00:00:00:00:00:00:01:00:00:00:09:50:61:73:73:77 ...........Passw
00000040 6f:72:64:3a:00 ord:.
-> NET_SSH2_MSG_USERAUTH_INFO_RESPONSE (61) (0.0009s)
00000000 3d:00:00:00:01:00:00:00:0c:64:75:6d:6d:79:2d:61 =........dummy-a
00000010 6e:73:77:65:72 nswer
<- NET_SSH2_MSG_USERAUTH_FAILURE (0.0704s)
00000000 00:00:00:27:70:61:73:73:77:6f:72:64:2c:70:75:62 ...'password,pub
00000010 6c:69:63:6b:65:79:2c:6b:65:79:62:6f:61:72:64:2d lickey,keyboard-
00000020 69:6e:74:65:72:61:63:74:69:76:65:00 interactive.
My intention is to use phpseclib to create a script that connects to a ssh2 enabled switch.
I have discovered that this switch only allows 3DES encryption and I dont know how to use Crypt_TripleDES() class together with NET_SSH2.
I couldnt find answer on the Internet and I would apreciate your help.
Thanks you!
Here is my code without 3Des and below you can see logs.
set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib');
include('./ssl/Crypt/TripleDES.php');
include('./ssl/Net/SSH2.php');
define('NET_SSH2_LOGGING', 3);
//$des = new Crypt_TripleDES();
//$des->setKey('');
//$des->encrypt('');
$ssh = new Net_SSH2('172.16.1.1');
if (!$ssh->login('admin','admin')) {
print_r($ssh->getLog());
exit('Login Failed');
}
Here are the logs:
->
00000000 53:53:48:2d:32:2e:30:2d:70:68:70:73:65:63:6c:69 SSH-2.0-phpsecli
00000010 62:5f:30:2e:33:20:28:6d:63:72:79:70:74:2c:20:62 b_0.3 (mcrypt, b
00000020 63:6d:61:74:68:29:0d:0a cmath)..
<- NET_SSH2_MSG_KEXINIT (since last: 0.0687, network: 0.0124s)
00000000 ea:54:14:67:67:97:ab:2d:34:85:07:67:76:57:51:c1 .T.gg..-4..gvWQ.
00000010 00:00:00:1a:64:69:66:66:69:65:2d:68:65:6c:6c:6d ....diffie-hellm
00000020 61:6e:2d:67:72:6f:75:70:31:2d:73:68:61:31:00:00 an-group1-sha1..
00000030 00:07:73:73:68:2d:72:73:61:00:00:00:08:33:64:65 ..ssh-rsa....3de
00000040 73:2d:63:62:63:00:00:00:08:33:64:65:73:2d:63:62 s-cbc....3des-cb
00000050 63:00:00:00:09:68:6d:61:63:2d:73:68:61:31:00:00 c....hmac-sha1..
00000060 00:09:68:6d:61:63:2d:73:68:61:31:00:00:00:04:6e ..hmac-sha1....n
00000070 6f:6e:65:00:00:00:04:6e:6f:6e:65:00:00:00:00:00 one....none.....
00000080 00:00:00:00:00:00:00:00 ........
-> NET_SSH2_MSG_KEXINIT (since last: 0.0021, network: 0.0001s)
00000000 de:fa:51:fc:c3:63:3f:2e:3c:44:1a:03:7d:07:cb:b3 ..Q..c?..D..}...
00000010 00:00:00:36:64:69:66:66:69:65:2d:68:65:6c:6c:6d ...6diffie-hellm
00000020 61:6e:2d:67:72:6f:75:70:31:2d:73:68:61:31:2c:64 an-group1-sha1,d
00000030 69:66:66:69:65:2d:68:65:6c:6c:6d:61:6e:2d:67:72 iffie-hellman-gr
00000040 6f:75:70:31:34:2d:73:68:61:31:00:00:00:0f:73:73 oup14-sha1....ss
00000050 68:2d:72:73:61:2c:73:73:68:2d:64:73:73:00:00:00 h-rsa,ssh-dss...
00000060 dc:61:72:63:66:6f:75:72:32:35:36:2c:61:72:63:66 .arcfour256,arcf
00000070 6f:75:72:31:32:38:2c:61:72:63:66:6f:75:72:2c:61 our128,arcfour,a
00000080 65:73:31:32:38:2d:63:74:72:2c:61:65:73:31:39:32 es128-ctr,aes192
00000090 2d:63:74:72:2c:61:65:73:32:35:36:2d:63:74:72:2c -ctr,aes256-ctr,
000000a0 74:77:6f:66:69:73:68:31:32:38:2d:63:74:72:2c:74 twofish128-ctr,t
000000b0 77:6f:66:69:73:68:31:39:32:2d:63:74:72:2c:74:77 wofish192-ctr,tw
000000c0 6f:66:69:73:68:32:35:36:2d:63:74:72:2c:61:65:73 ofish256-ctr,aes
000000d0 31:32:38:2d:63:62:63:2c:61:65:73:31:39:32:2d:63 128-cbc,aes192-c
000000e0 62:63:2c:61:65:73:32:35:36:2d:63:62:63:2c:74:77 bc,aes256-cbc,tw
000000f0 6f:66:69:73:68:31:32:38:2d:63:62:63:2c:74:77:6f ofish128-cbc,two
00000100 66:69:73:68:31:39:32:2d:63:62:63:2c:74:77:6f:66 fish192-cbc,twof
00000110 69:73:68:32:35:36:2d:63:62:63:2c:74:77:6f:66:69 ish256-cbc,twofi
00000120 73:68:2d:63:62:63:2c:33:64:65:73:2d:63:74:72:2c sh-cbc,3des-ctr,
00000130 33:64:65:73:2d:63:62:63:2c:6e:6f:6e:65:00:00:00 3des-cbc,none...
00000140 dc:61:72:63:66:6f:75:72:32:35:36:2c:61:72:63:66 .arcfour256,arcf
00000150 6f:75:72:31:32:38:2c:61:72:63:66:6f:75:72:2c:61 our128,arcfour,a
00000160 65:73:31:32:38:2d:63:74:72:2c:61:65:73:31:39:32 es128-ctr,aes192
00000170 2d:63:74:72:2c:61:65:73:32:35:36:2d:63:74:72:2c -ctr,aes256-ctr,
00000180 74:77:6f:66:69:73:68:31:32:38:2d:63:74:72:2c:74 twofish128-ctr,t
00000190 77:6f:66:69:73:68:31:39:32:2d:63:74:72:2c:74:77 wofish192-ctr,tw
000001a0 6f:66:69:73:68:32:35:36:2d:63:74:72:2c:61:65:73 ofish256-ctr,aes
000001b0 31:32:38:2d:63:62:63:2c:61:65:73:31:39:32:2d:63 128-cbc,aes192-c
000001c0 62:63:2c:61:65:73:32:35:36:2d:63:62:63:2c:74:77 bc,aes256-cbc,tw
000001d0 6f:66:69:73:68:31:32:38:2d:63:62:63:2c:74:77:6f ofish128-cbc,two
000001e0 66:69:73:68:31:39:32:2d:63:62:63:2c:74:77:6f:66 fish192-cbc,twof
000001f0 69:73:68:32:35:36:2d:63:62:63:2c:74:77:6f:66:69 ish256-cbc,twofi
00000200 73:68:2d:63:62:63:2c:33:64:65:73:2d:63:74:72:2c sh-cbc,3des-ctr,
00000210 33:64:65:73:2d:63:62:63:2c:6e:6f:6e:65:00:00:00 3des-cbc,none...
00000220 30:68:6d:61:63:2d:73:68:61:31:2d:39:36:2c:68:6d 0hmac-sha1-96,hm
00000230 61:63:2d:73:68:61:31:2c:68:6d:61:63:2d:6d:64:35 ac-sha1,hmac-md5
00000240 2d:39:36:2c:68:6d:61:63:2d:6d:64:35:2c:6e:6f:6e -96,hmac-md5,non
00000250 65:00:00:00:30:68:6d:61:63:2d:73:68:61:31:2d:39 e...0hmac-sha1-9
00000260 36:2c:68:6d:61:63:2d:73:68:61:31:2c:68:6d:61:63 6,hmac-sha1,hmac
00000270 2d:6d:64:35:2d:39:36:2c:68:6d:61:63:2d:6d:64:35 -md5-96,hmac-md5
00000280 2c:6e:6f:6e:65:00:00:00:04:6e:6f:6e:65:00:00:00 ,none....none...
00000290 04:6e:6f:6e:65:00:00:00:00:00:00:00:00:00:00:00 .none...........
000002a0 00:00 ..
-> NET_SSH2_MSG_KEXDH_INIT (since last: 0.0225, network: 0s)
00000000 00:00:00:81:00:b4:0c:f4:1e:a8:31:3c:35:2a:c0:c1 ..........1.5*..
00000010 ca:51:51:9a:6c:9a:b4:b2:f0:63:80:ee:0f:6a:f8:3b .QQ.l....c...j.;
00000020 b0:9d:ce:b7:35:50:1c:09:11:88:c7:fc:96:47:1f:21 ....5P.......G.!
00000030 e5:36:da:7d:b7:be:06:11:c6:ac:ee:b1:2e:64:50:d2 .6.}.........dP.
00000040 65:b6:78:64:84:2d:b8:7f:62:87:29:eb:75:ab:ee:71 e.xd.-..b.).u..q
00000050 d5:db:53:31:0c:27:e2:51:b9:e0:55:98:22:1c:c3:38 ..S1.'.Q..U."..8
00000060 46:36:5d:d1:e9:b6:5d:f6:a3:ce:95:2a:fe:30:27:5a F6]...]....*.0'Z
00000070 95:9b:e7:f2:34:ce:04:1b:4a:ce:37:5a:80:f8:ac:b3 ....4...J.7Z....
00000080 18:c1:7f:0f:c0 .....
<- NET_SSH2_MSG_KEXDH_REPLY (since last: 3.6055, network: 3.6038s)
00000000 00:00:00:55:00:00:00:07:73:73:68:2d:72:73:61:00 ...U....ssh-rsa.
00000010 00:00:01:23:00:00:00:41:00:e5:01:cd:e0:ac:c9:17 ...#...A........
00000020 a8:ed:8b:c8:a8:3c:1c:0b:ae:b5:a2:f4:35:60:51:fe ............5`Q.
00000030 46:01:1c:45:65:77:7a:df:86:58:a7:60:2b:6f:53:de F..Eewz..X.`+oS.
00000040 e6:02:1a:06:91:1a:08:50:52:df:ed:b3:42:de:5d:1d .......PR...B.].
00000050 84:44:cf:95:d5:ac:ea:35:e7:00:00:00:81:00:a2:30 .D.....5.......0
00000060 11:61:c6:c6:c5:ac:77:18:d6:bc:57:30:da:91:df:e1 .a....w...W0....
00000070 14:19:d8:07:1b:6a:ac:dd:b3:23:eb:0a:17:44:b8:43 .....j...#...D.C
00000080 65:b5:cc:8b:24:dd:be:07:c5:48:15:f6:3d:7f:7d:c3 e...$....H..=.}.
00000090 7e:b1:6a:e3:ee:1b:b3:23:f6:b2:64:21:b6:c6:f2:e3 ~.j....#..d!....
000000a0 ce:a6:79:b4:a7:ce:50:6e:a4:a3:2d:15:69:9e:e3:69 ..y...Pn..-.i..i
000000b0 68:45:43:7f:e0:c5:21:e8:b2:cb:83:c0:1e:64:16:58 hEC...!......d.X
000000c0 d9:06:fa:01:64:e3:28:c4:2d:84:86:34:94:25:df:68 ....d.(.-..4.%.h
000000d0 1a:fa:53:7a:31:5c:e4:bd:23:30:45:2b:fb:2c:00:00 ..Sz1\..#0E+.,..
000000e0 00:4f:00:00:00:07:73:73:68:2d:72:73:61:00:00:00 .O....ssh-rsa...
000000f0 40:6a:36:35:0a:1d:a7:30:48:1d:56:ce:4d:1c:af:40 #j65...0H.V.M..#
00000100 96:24:44:f7:83:bd:96:7f:bd:99:3b:a1:df:0c:43:42 .$D.......;...CB
00000110 4b:cc:a9:3a:70:c2:cc:19:e8:7b:0e:fe:b9:f6:55:1d K..:p....{....U.
00000120 af:df:fc:c4:b4:9b:6e:cd:8f:8c:7f:ac:5e:d8:b6:5d ......n.....^..]
00000130 65 e
-> NET_SSH2_MSG_NEWKEYS (since last: 0.0217, network: 0.0001s)
<- NET_SSH2_MSG_NEWKEYS (since last: 0.0131, network: 0.0125s)
-> NET_SSH2_MSG_SERVICE_REQUEST (since last: 0.0018, network: 0.0001s)
00000000 00:00:00:0c:73:73:68:2d:75:73:65:72:61:75:74:68 ....ssh-userauth
<- NET_SSH2_MSG_SERVICE_ACCEPT (since last: 0.0109, network: 0.0104s)
00000000 00:00:00:0c:73:73:68:2d:75:73:65:72:61:75:74:68 ....ssh-userauth
-> NET_SSH2_MSG_USERAUTH_REQUEST (since last: 0.0012, network: 0.0001s)
00000000 00:00:00:08:75:73:65:72:6e:61:6d:65:00:00:00:0e ....username....
00000010 73:73:68:2d:63:6f:6e:6e:65:63:74:69:6f:6e:00:00 ssh-connection..
00000020 00:08:70:61:73:73:77:6f:72:64:00:00:00:00:08:70 ..password.....p
00000030 61:73:73:77:6f:72:64 assword
<- NET_SSH2_MSG_USERAUTH_FAILURE (since last: 0.0164, network: 0.0155s)
00000000 00:00:00:12:70:61:73:73:77:6f:72:64:2c:70:75:62 ....password,pub
00000010 6c:69:63:6b:65:79:00 lickey.
Login Failed<pre>-> NET_SSH2_MSG_DISCONNECT (since last: 0.0012, network: 0.0001s)
00000000 00:00:00:0b:00:00:00:00:00:00:00:00 ............
3des-cbc is being used already. The inbound <- NET_SSH2_MSG_KEXINIT packet is how phpseclib knows that 3des-cbc has to be used and you know it's using it because the inbound <- NET_SSH2_MSG_NEWKEYS is both received and successfully decrypted.
The problem with your code isn't that 3des-cbc isn't being used - it's that the password is bad, per this:
-> NET_SSH2_MSG_USERAUTH_REQUEST (since last: 0.0012, network: 0.0001s)
00000000 00:00:00:08:75:73:65:72:6e:61:6d:65:00:00:00:0e ....username....
00000010 73:73:68:2d:63:6f:6e:6e:65:63:74:69:6f:6e:00:00 ssh-connection..
00000020 00:08:70:61:73:73:77:6f:72:64:00:00:00:00:08:70 ..password.....p
00000030 61:73:73:77:6f:72:64 assword
<- NET_SSH2_MSG_USERAUTH_FAILURE (since last: 0.0164, network: 0.0155s)
00000000 00:00:00:12:70:61:73:73:77:6f:72:64:2c:70:75:62 ....password,pub
00000010 6c:69:63:6b:65:79:00 lickey.
When developing program under windows 8, our team found that if using too many layers of control in an UI program can cause windows Blue Screen Of Death, with error number 0x7f(0x00000008, xxx, 0x00000000, 0x00000000).
After referring this artical and this artical, we confirmed that we were having an kernel stack overflow issue. And method win32k!xxxDCEWindowHitTest/2 consume 75% of the kernel stack.
We are sure that this will only happen under windows 8.
Any idea is welcomed. Thanks.
Spy++ result is like this:
The kernel stack is like this:
0: kd> !analyze -v
*******************************************************************************
* *
* Bugcheck Analysis *
* *
*******************************************************************************
UNEXPECTED_KERNEL_MODE_TRAP (7f)
This means a trap occurred in kernel mode, and it's a trap of a kind
that the kernel isn't allowed to have/catch (bound trap) or that
is always instant death (double fault). The first number in the
bugcheck params is the number of the trap (8 = double fault, etc)
Consult an Intel x86 family manual to learn more about what these
traps are. Here is a *portion* of those codes:
If kv shows a taskGate
use .tss on the part before the colon, then kv.
Else if kv shows a trapframe
use .trap on that value
Else
.trap on the appropriate frame will show where the trap was taken
(on x86, this will be the ebp that goes with the procedure KiTrap)
Endif
kb will then show the corrected stack.
Arguments:
Arg1: 00000008, EXCEPTION_DOUBLE_FAULT
Arg2: 803f6000
Arg3: 00000000
Arg4: 00000000
Debugging Details:
------------------
BUGCHECK_STR: 0x7f_8
TSS: 00000028 -- (.tss 0x28)
.tss 0x28
eax=c635fd8e ebx=825f1120 ecx=b241e0a0 edx=ffd014b8 esi=00000000 edi=b241e144
eip=80e1e16a esp=b241e000 ebp=b241e08c iopl=0 nv up ei ng nz na pe nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00010286
hal!HalpInterruptSendIpi+0x1c:
80e1e16a 56 push esi
.trap
Resetting default scope
DEFAULT_BUCKET_ID: WIN8_DRIVER_FAULT
PROCESS_NAME: GCPHost.exe
CURRENT_IRQL: 2
MANAGED_STACK: !dumpstack -EE
!dumpstack -EE
No export dumpstack found
LAST_CONTROL_TRANSFER: from 80e1dcaa to 80e1e16a
STACK_TEXT:
b241e08c 80e1dcaa 000000e1 810781c8 00000000 hal!HalpInterruptSendIpi+0x1c
b241e0ac 80e1dbdb 00000000 b241e144 000000e1 hal!HalRequestIpiSpecifyVector+0x78
b241e0c0 80f189d9 00000000 b241e144 81066120 hal!HalRequestIpi+0x15
b241e0d4 80fe9e0e 81066120 86d4f138 00000000 nt!KiIpiSend+0x31
b241e154 80ec35fb 83f7cb88 b241e224 00000000 nt!KiDeferredReadyThread+0x336
b241e1a8 81009a19 00fb3660 00000000 86d4f040 nt!KeReleaseSemaphoreEx+0x309
b241e244 810170ff 83f7cb88 840f54c0 93f8a2a6 nt!ExpReleaseResourceForThreadLite+0x6dd
b241e250 93f8a2a6 df695373 00000000 00000084 nt!ExReleaseResourceAndLeavePriorityRegion+0xd
b241e2c8 93f8a0bf 00000000 00000000 00000000 win32k!SfnDWORD+0x111
b241e31c 93f7c2f7 a746bef8 00000084 00000000 win32k!xxxSendMessageToClient+0xb4
b241e3c8 93f7c7c2 a746bef8 00000084 00000000 win32k!xxxSendMessageTimeout+0x115
b241e3f0 93f71226 a746bef8 00000084 00000000 win32k!xxxSendMessage+0x2c
b241e494 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x287
b241e4d0 93f711bd a746bef8 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241e584 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241e5c0 93f711bd a746a0c8 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241e674 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241e6b0 93f711bd a74662b8 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241e764 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241e7a0 93f711bd a74631d8 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241e854 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241e890 93f711bd a7463100 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241e944 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241e980 93f711bd a7463030 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241ea34 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241ea70 93f711bd a7462f60 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241eb24 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241eb60 93f711bd a742cc90 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241ec14 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241ec50 93f711bd a7462e90 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241ed04 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241ed40 93f711bd a7462dc0 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241edf4 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241ee30 93f711bd a746bba8 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241eee4 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241ef20 93f711bd a746bad8 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241efd4 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241f010 93f711bd a7414db8 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241f0c4 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241f100 93f711bd a746ba08 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241f1b4 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241f1f0 93f711bd a746b500 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241f2a4 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241f2e0 93f711bd a746a4c8 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241f394 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241f3d0 93f711bd a7414f58 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241f484 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241f4c0 93f711bd a7414e88 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241f574 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241f5b0 93f711bd a7465f18 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241f664 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241f6a0 93f711bd a7465e48 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241f754 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241f790 93f711bd a74643c8 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241f844 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241f880 93f711bd a74642d8 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241f934 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241f970 93f711bd a7464208 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241fa24 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241fa60 93f711bd a7462b98 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241fb14 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241fb50 93f711bd a745f9d8 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241fc04 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241fc40 93f711bd a74660e8 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241fcf4 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241fd30 93f711bd a745f838 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241fde4 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241fe20 93f711bd a745ee60 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241fed4 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b241ff10 93f711bd a744c0b0 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b241ffc4 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b2420000 93f711bd a74193b8 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b24200b4 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
b24200f0 93f711bd a7417520 00000200 00000000 win32k!xxxDCEWindowHitTest+0x6b
b24201a4 93f449bd 00000200 00000000 00e20253 win32k!xxxDCEWindowHitTest2+0x21e
STACK_COMMAND: .tss 0x28 ; kb
FOLLOWUP_IP:
win32k!SfnDWORD+111
93f8a2a6 8b350c801194 mov esi,dword ptr [win32k!_imp__PsGetCurrentThreadWin32Thread (9411800c)]
SYMBOL_STACK_INDEX: 8
SYMBOL_NAME: win32k!SfnDWORD+111
FOLLOWUP_NAME: MachineOwner
MODULE_NAME: win32k
IMAGE_NAME: win32k.sys
DEBUG_FLR_IMAGE_TIMESTAMP: 50f77916
BUCKET_ID_FUNC_OFFSET: 111
FAILURE_BUCKET_ID: 0x7f_8_win32k!SfnDWORD
BUCKET_ID: 0x7f_8_win32k!SfnDWORD
Followup: MachineOwner
---------
I am trying to write a small library for highly optimised x86-64 bit operation code and am fiddling with inline asm.
While testing this particular case has caught my attention:
unsigned long test = 0;
unsigned long bsr;
// bit test and set 39th bit
__asm__ ("btsq\t%1, %0 " : "+rm" (test) : "rJ" (39) );
// bit scan reverse (get most significant bit id)
__asm__ ("bsrq\t%1, %0" : "=r" (bsr) : "rm" (test) );
printf("test = %lu, bsr = %d\n", test, bsr);
compiles and runs fine in both gcc and icc, but when I inspect the assembly I get differences
gcc -S -fverbose-asm -std=gnu99 -O3
movq $0, -8(%rbp)
## InlineAsm Start
btsq $39, -8(%rbp)
## InlineAsm End
movq -8(%rbp), %rax
movq %rax, -16(%rbp)
## InlineAsm Start
bsrq -16(%rbp), %rdx
## InlineAsm End
movq -8(%rbp), %rsi
leaq L_.str(%rip), %rdi
xorb %al, %al
callq _printf
I am wondering why so complicated? I am writing high performance code in which the number of instructions is critical. I am especially wondering why gcc makes a copy of my variable test before passing it to the second inline asm?
Same code compiled with icc gives far better results:
xorl %esi, %esi # test = 0
movl $.L_2__STRING.0, %edi # has something to do with printf
orl $32832, (%rsp) # part of function initiation
xorl %eax, %eax # has something to do with printf
ldmxcsr (%rsp) # part of function initiation
btsq $39, %rsi #106.0
bsrq %rsi, %rdx #109.0
call printf #111.2
despite the fact that gcc decides to keep my variables on the stack rather then in registers, what I do not understand is why make a copy of test before passing it to the second asm?
If I put test in as an input/output variable in the second asm
__asm__ ("bsrq\t%1, %0" : "=r" (bsr) , "+rm" (test) );
then those lines disappear.
movq $0, -8(%rbp)
## InlineAsm Start
btsq $39, -8(%rbp)
## InlineAsm End
## InlineAsm Start
bsrq -8(%rbp), %rdx
## InlineAsm End
movq -8(%rbp), %rsi
leaq L_.str(%rip), %rdi
xorb %al, %al
callq _printf
Is this gcc screwed up optimisation or am I missing some vital compiler switches? I do have icc for my production system, but if I decide to distribute the source code at some point then it will have to be able to compile with gcc too.
compilers used:
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)
icc Version 12.0.2
I've tried your example on Linux like this (making it "evil" by forcing a stack ref/loc for test through using &test in the printf:):#include <stdio.h>
int main(int argc, char **argv)
{
unsigned long test = 0;
unsigned long bsr;
// bit test and set 39th bit
asm ("btsq\t%1, %0 " : "+rm" (test) : "rJ" (39) );
// bit scan reverse (get most significant bit id)
asm ("bsrq\t%1, %0" : "=r" (bsr) : "rm" (test) );
printf("test = %lu, bsr = %d, &test = %p\n", test, bsr, &test);
return 0;
}
and compiled it with various versions of gcc -O3 ... to the following results:
code generated gcc version
================================================================================
400630: 48 83 ec 18 sub $0x18,%rsp 4.7.2,
400634: 31 c0 xor %eax,%eax 4.6.2,
400636: bf 50 07 40 00 mov $0x400750,%edi 4.4.6
40063b: 48 8d 4c 24 08 lea 0x8(%rsp),%rcx
400640: 48 0f ba e8 27 bts $0x27,%rax
400645: 48 89 44 24 08 mov %rax,0x8(%rsp)
40064a: 48 89 c6 mov %rax,%rsi
40064d: 48 0f bd d0 bsr %rax,%rdx
400651: 31 c0 xor %eax,%eax
400653: e8 68 fe ff ff callq 4004c0
[ ... ]
---------------------------------------------------------------------------------
4004f0: 48 83 ec 18 sub $0x18,%rsp 4.1
4004f4: 31 c0 xor %eax,%eax
4004f6: bf 28 06 40 00 mov $0x400628,%edi
4004fb: 48 8d 4c 24 10 lea 0x10(%rsp),%rcx
400500: 48 c7 44 24 10 00 00 00 00 movq $0x0,0x10(%rsp)
400509: 48 0f ba e8 27 bts $0x27,%rax
40050e: 48 89 44 24 10 mov %rax,0x10(%rsp)
400513: 48 89 c6 mov %rax,%rsi
400516: 48 0f bd d0 bsr %rax,%rdx
40051a: 31 c0 xor %eax,%eax
40051c: e8 c7 fe ff ff callq 4003e8
[ ... ]
---------------------------------------------------------------------------------
400500: 48 83 ec 08 sub $0x8,%rsp 3.4.5
400504: bf 30 06 40 00 mov $0x400630,%edi
400509: 31 c0 xor %eax,%eax
40050b: 48 c7 04 24 00 00 00 00 movq $0x0,(%rsp)
400513: 48 89 e1 mov %rsp,%rcx
400516: 48 0f ba 2c 24 27 btsq $0x27,(%rsp)
40051c: 48 8b 34 24 mov (%rsp),%rsi
400520: 48 0f bd 14 24 bsr (%rsp),%rdx
400525: e8 fe fe ff ff callq 400428
[ ... ]
---------------------------------------------------------------------------------
4004e0: 48 83 ec 08 sub $0x8,%rsp 3.2.3
4004e4: bf 10 06 40 00 mov $0x400610,%edi
4004e9: 31 c0 xor %eax,%eax
4004eb: 48 c7 04 24 00 00 00 00 movq $0x0,(%rsp)
4004f3: 48 0f ba 2c 24 27 btsq $0x27,(%rsp)
4004f9: 48 8b 34 24 mov (%rsp),%rsi
4004fd: 48 89 e1 mov %rsp,%rcx
400500: 48 0f bd 14 24 bsr (%rsp),%rdx
400505: e8 ee fe ff ff callq 4003f8
[ ... ]
and while there's a significant difference in the created code (including whether the bsr acceesses test as register or memory), none of the tested revs recreate the assembly that you've shown. I'd suspect a bug in the 4.2.x version you used on MacOSX, but then I don't have either your testcase nor that specific compiler version available.
Edit: The code above is obviously different in the sense that it forces test into the stack; if that is not done, then all "plain" gcc versions I've tested do a direct pair bts $39, %rsi / bsr %rsi, %rdx.
I have found, though, that clang creates different code there: 140: 50 push %rax
141: 48 c7 04 24 00 00 00 00 movq $0x0,(%rsp)
149: 31 f6 xor %esi,%esi
14b: 48 0f ba ee 27 bts $0x27,%rsi
150: 48 89 34 24 mov %rsi,(%rsp)
154: 48 0f bd d6 bsr %rsi,%rdx
158: bf 00 00 00 00 mov $0x0,%edi
15d: 30 c0 xor %al,%al
15f: e8 00 00 00 00 callq printf#plt>so the difference seems to be indeed between the code generators of clang/llvm and "gcc proper".