maxwells_daemon
01-30-2005, 03:05 PM
Hi,
I have found a fix to the problem which causes an "Illegal Instruction" error on Series 1 TiVos (at least with UK software version 2.5.5). The fix allows built-in and newly compiled TiVo programs to perform a number of functions (notably DNS and passwd lookups) that previously had to be hacked around.
The fix and other programs mentioned here can be found on my TiVo software page (http://homepage.ntlworld.com/maxwells.daemon/tivo/software.html).
Without the fix, programs that don't have an explicit workaround (eg. with libtivohack (http://www.xse.com/leres/tivo/downloads/libtivohack/)) crash. To use a couple of random examples
TiVo ~ > route.tivo
route_info, afname=inet, options=33
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
Illegal Instruction
TiVo ~ > id
uid=0Illegal Instruction
("route" is part of the standard TiVo installation, though it's renamed to route.tivo by the TurboNET upgrade (http://www.9thtee.com/tivoupgrades.htm), and "id" is from tivobin.tgz (http://tivo.stevejenkins.com/downloads/)).
With the fixed shared libraries in /var/hack/lib, these programs work correctly (assuming some reasonable settings in /etc/passwd and /etc/hosts).
TiVo ~ > export LD_LIBRARY_PATH=/var/hack/lib
TiVo ~ > route.tivo
route_info, afname=inet, options=33
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 32767 0 0 eth1
default my.router 0.0.0.0 UG 0 0 0 eth1
TiVo ~ > id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon)
OK, those are trivial examples because more useful commands have been made to work after a fashion by linking to libtivohack. But with the fixed libc, it is now possible to build fully functional Unix tools, with little or no source-code modification necessary. I have built GNU InetUtils, procps, and TinyLogin (nearly) out of the box (OK, I modified InetUtils because I found some bugs that weren't TiVo specific, and I modified procps because of the floating-point error I reported earlier (http://www.dealdatabase.com/forum/showthread.php?t=40793)).
TiVo ~ > ping www.cern.ch
PING webr2.cern.ch (137.138.28.230): 56 data bytes
64 bytes from 137.138.28.230: icmp_seq=0 ttl=112 time=170.268 ms
64 bytes from 137.138.28.230: icmp_seq=1 ttl=112 time=161.671 ms
--- webr2.cern.ch ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 161.671/165.969/170.268/4.299 ms
TiVo ~ > rcp maxwell@mypc:mfs_bin.ppc-20041213a.tar.bz2 .
TiVo ~ > /var/hack/sbin/inetd
With inetd running, the the TiVo can run various daemons with full login capability, eg.
mypc ~ > rsh tivo uname -a
Linux tims-tivo 2.1.24-TiVo-2.5 #14 Wed Oct 8 12:06:25 MDT 2003 ppc unknown
mypc ~ > telnet tivo
Trying 192.168.1.150...
Connected to tivo.
Escape character is '^]'.
Linux 2.1.24-TiVo-2.5 (tims-tivo) (ttyp1)
tims-tivo login: root
Password:
TiVo ~ >
and so on.
The libc error occurred whenever a program tried to execute any of the lookup functions implemented via the C Library's Name Service Switch (NSS) (http://www.gnu.org/software/libc/manual/html_node/Name-Service-Switch.html) scheme (passwd, group, hosts, protocols, services, etc). This bug is present in both the TiVo 2.5.5 standard libc and in other rebuilt libraries (such as from tivoutils (http://tivoutils.sourceforge.net/)). I'd be interested to know whether it is also present in later TiVo PowerPC software versions (3.0+).
The fix was very simple: for some unaccountable reason, nss_lookup_function's body (in libc/nss/nsswitch.c) had been removed in TiVo's official TiVo-2.5.x-toolchain.tar.gz. Without this, a random function pointer was returned, so when this was executed, it's not surprising that an Illegal Instruction ensued. I wonder whether this was random stupidity on a TiVo programmer's part, or some clumsy (but effective :( ) plan to make hacking more difficult. Anyway I restored the missing code, and you can download the recompiled libraries from my web page (http://homepage.ntlworld.com/maxwells.daemon/tivo/software.html).
Tim.
I have found a fix to the problem which causes an "Illegal Instruction" error on Series 1 TiVos (at least with UK software version 2.5.5). The fix allows built-in and newly compiled TiVo programs to perform a number of functions (notably DNS and passwd lookups) that previously had to be hacked around.
The fix and other programs mentioned here can be found on my TiVo software page (http://homepage.ntlworld.com/maxwells.daemon/tivo/software.html).
Without the fix, programs that don't have an explicit workaround (eg. with libtivohack (http://www.xse.com/leres/tivo/downloads/libtivohack/)) crash. To use a couple of random examples
TiVo ~ > route.tivo
route_info, afname=inet, options=33
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
Illegal Instruction
TiVo ~ > id
uid=0Illegal Instruction
("route" is part of the standard TiVo installation, though it's renamed to route.tivo by the TurboNET upgrade (http://www.9thtee.com/tivoupgrades.htm), and "id" is from tivobin.tgz (http://tivo.stevejenkins.com/downloads/)).
With the fixed shared libraries in /var/hack/lib, these programs work correctly (assuming some reasonable settings in /etc/passwd and /etc/hosts).
TiVo ~ > export LD_LIBRARY_PATH=/var/hack/lib
TiVo ~ > route.tivo
route_info, afname=inet, options=33
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 32767 0 0 eth1
default my.router 0.0.0.0 UG 0 0 0 eth1
TiVo ~ > id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon)
OK, those are trivial examples because more useful commands have been made to work after a fashion by linking to libtivohack. But with the fixed libc, it is now possible to build fully functional Unix tools, with little or no source-code modification necessary. I have built GNU InetUtils, procps, and TinyLogin (nearly) out of the box (OK, I modified InetUtils because I found some bugs that weren't TiVo specific, and I modified procps because of the floating-point error I reported earlier (http://www.dealdatabase.com/forum/showthread.php?t=40793)).
TiVo ~ > ping www.cern.ch
PING webr2.cern.ch (137.138.28.230): 56 data bytes
64 bytes from 137.138.28.230: icmp_seq=0 ttl=112 time=170.268 ms
64 bytes from 137.138.28.230: icmp_seq=1 ttl=112 time=161.671 ms
--- webr2.cern.ch ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 161.671/165.969/170.268/4.299 ms
TiVo ~ > rcp maxwell@mypc:mfs_bin.ppc-20041213a.tar.bz2 .
TiVo ~ > /var/hack/sbin/inetd
With inetd running, the the TiVo can run various daemons with full login capability, eg.
mypc ~ > rsh tivo uname -a
Linux tims-tivo 2.1.24-TiVo-2.5 #14 Wed Oct 8 12:06:25 MDT 2003 ppc unknown
mypc ~ > telnet tivo
Trying 192.168.1.150...
Connected to tivo.
Escape character is '^]'.
Linux 2.1.24-TiVo-2.5 (tims-tivo) (ttyp1)
tims-tivo login: root
Password:
TiVo ~ >
and so on.
The libc error occurred whenever a program tried to execute any of the lookup functions implemented via the C Library's Name Service Switch (NSS) (http://www.gnu.org/software/libc/manual/html_node/Name-Service-Switch.html) scheme (passwd, group, hosts, protocols, services, etc). This bug is present in both the TiVo 2.5.5 standard libc and in other rebuilt libraries (such as from tivoutils (http://tivoutils.sourceforge.net/)). I'd be interested to know whether it is also present in later TiVo PowerPC software versions (3.0+).
The fix was very simple: for some unaccountable reason, nss_lookup_function's body (in libc/nss/nsswitch.c) had been removed in TiVo's official TiVo-2.5.x-toolchain.tar.gz. Without this, a random function pointer was returned, so when this was executed, it's not surprising that an Illegal Instruction ensued. I wonder whether this was random stupidity on a TiVo programmer's part, or some clumsy (but effective :( ) plan to make hacking more difficult. Anyway I restored the missing code, and you can download the recompiled libraries from my web page (http://homepage.ntlworld.com/maxwells.daemon/tivo/software.html).
Tim.