Segfault on port operation

Raimo Niskanen <>
Fri Feb 28 12:07:29 CET 2003


Thank you, it will be fixed in R9C.

The fault is in erl_bif_port.c:port_call_3() that does not check that 
drv->call is non-NULL before using it.

/ Raimo Niskanen, Erlang/OTP, Ericsson AB.



Luke Gorrie wrote:
> Ahoy,
> 
> I found a way to segfault the emulator on R9B-0:
> 
>   $ /usr/local/erlang/r9b-0/bin/erl
>   Erlang (BEAM) emulator version 5.2 [source] [hipe]
> 
>   Eshell V5.2  (abort with ^G)
>   1> P = open_port({spawn, "/bin/cat"}, []).
>   #Port<0.26>
>   2> erlang:port_call(P, hello).
>   Segmentation fault
> 
> That aside, can someone tell me if the following code is initializing
> the linked-in driver entry correctly?
> 
>   ErlDrvEntry tun_driver_entry;
> 
>   ErlDrvEntry *driver_init(void)
>   {
>       memset(&tun_driver_entry, 0, sizeof(tun_driver_entry));
>       tun_driver_entry.init = tun_init;
>       tun_driver_entry.start = tun_start;
>       tun_driver_entry.stop = tun_stop;
>       tun_driver_entry.ready_input = tun_input;
>       tun_driver_entry.control = tun_ctl;
>       tun_driver_entry.driver_name = "tun_drv";
>       return &tun_driver_entry;
>   }
> 
> Cheers,
> Luke
> 




More information about the erlang-questions mailing list