chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Spiffy & OpenSSL in compiled code


From: Seth Alves
Subject: Re: [Chicken-users] Spiffy & OpenSSL in compiled code
Date: Wed, 19 Sep 2012 11:46:17 -0700

I can duplicate this.  I've straced both runs... it's interesting that
the compiled version doesn't call getsockname or getpeername.

csi:

...
listen(4, 4)                            = 0
open("ssl-cert-snakeoil.pem", O_RDONLY) = 5
fstat(5, {st_mode=S_IFREG|0644, st_size=652, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7ff884873000
read(5, "-----BEGIN CERTIFICATE-----\nMIIB"..., 4096) = 652
read(5, "", 4096)                       = 0
close(5)                                = 0
munmap(0x7ff884873000, 4096)            = 0
open("ssl-cert-snakeoil.key", O_RDONLY) = 5
fstat(5, {st_mode=S_IFREG|0640, st_size=887, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7ff884873000
read(5, "-----BEGIN RSA PRIVATE KEY-----\n"..., 4096) = 887
close(5)                                = 0
munmap(0x7ff884873000, 4096)            = 0
select(5, [4], NULL, NULL, {0, 0})      = 0 (Timeout)
select(1024, [4], [], NULL, NULL)       = 1 (in [4])
select(5, [4], NULL, NULL, {0, 0})      = 1 (in [4], left {0, 0})
accept(4, 0, NULL)                      = 5
fcntl(5, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(5, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
getsockname(5, {sa_family=AF_INET, sin_port=htons(8080),
sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
getpeername(5, {sa_family=AF_INET, sin_port=htons(43842),
sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
ioctl(2, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffb447eeb0) = -1 ENOTTY
(Inappropriate ioctl for device)
write(2, "primordial: Incoming request fro"..., 43primordial: Incoming
request from 127.0.0.1) = 43
write(2, "\n", 1


compiled:
...
listen(3, 4)                            = 0
open("ssl-cert-snakeoil.pem", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=652, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7f2f560f7000
read(4, "-----BEGIN CERTIFICATE-----\nMIIB"..., 4096) = 652
read(4, "", 4096)                       = 0
close(4)                                = 0
munmap(0x7f2f560f7000, 4096)            = 0
open("ssl-cert-snakeoil.key", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0640, st_size=887, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x7f2f560f7000
read(4, "-----BEGIN RSA PRIVATE KEY-----\n"..., 4096) = 887
close(4)                                = 0
munmap(0x7f2f560f7000, 4096)            = 0
select(4, [3], NULL, NULL, {0, 0})      = 0 (Timeout)
select(1024, [3], [], NULL, NULL)       = 1 (in [3])
select(4, [3], NULL, NULL, {0, 0})      = 1 (in [3], left {0, 0})
accept(3, 0, NULL)                      = 4
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
ioctl(2, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff6d35ca30) = -1 ENOTTY
(Inappropriate ioctl for device)
write(2, "primordial: Connection handshake"..., 74primordial:
Connection handshake error: "bad argument type - not a fixnum") = 74
write(2, "\n", 1
)                       = 1
select(4, [3], NULL, NULL, {0, 0})      = 0 (Timeout)
select(1024, [3], [], NULL, NULL <unfinished ...>



On Wed, Sep 19, 2012 at 10:44 AM, Andy Bennett <address@hidden> wrote:
> Hi,
>
> I have the following repro-case:
>
> -----
> (use spiffy openssl)
>
> (define port 8080)
>
> (define stderr (current-error-port))
> (debug-log stderr)
> (error-log stderr)
>
> (let ((listener (ssl-listen port)))
>   (ssl-load-certificate-chain! listener "ssl-cert-snakeoil.pem")
>   (ssl-load-private-key! listener "ssl-cert-snakeoil.key")
>   (accept-loop listener ssl-accept))
> -----
>
> This works if invoked as 'csi -s ./tmp.scm' but not when compiled and
> invoked thusly: 'csc tmp.scm && ./tmp'
>
>
> In the compiled case, the binary runs but the following is produced on
> stderr when a connection is attempted:
>
> -----
> primordial: Connection handshake error: "bad argument type - not a fixnum"
> -----
>
>
>
> I note that, with the interpreted version, this happens when a
> connection occurs that causes the browser (Firefox 10.0.7) to display a
> certificate warning:
>
> -----
> $ csi -s ./tmp.scm
> primordial: Incoming request from 127.0.0.1
> thread73: Uncaught exception: "SSL socket already closed" (SHOULD NOT
> HAPPEN!)
> -----
>
>
> I am on chicken-4.7.0 and I just tried it with the latest openssl from
> chicken-install.
>
>
>
>
> Regards,
> @ndy
>
> --
> address@hidden
> http://www.ashurst.eu.org/
> 0x7EBA75FF
>
>
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/chicken-users



reply via email to

[Prev in Thread] Current Thread [Next in Thread]