Program to patch Ultrix 4.1 RISC for more nested symlinks
Ian! D. Allen [CGL]
idallen at watcgl.waterloo.edu
Sat Mar 2 17:54:50 AEST 1991
/*
* Summary: How to increase the allowed nesting of symlinks on Ultrix RISC.
* This patches binaries, so run the other way if you don't like that.
*
* Syntax:
*
* chdir to /sys/MIPS/BINARY, then:
* $0 <ufs_namei.o >ufs_namei.new && cmp -l ufs_namei.o ufs_namei.new
* $0 <nfs_gfsops.o >nfs_gfsops.new && cmp -l nfs_gfsops.o nfs_gfsops.new
*
* Description:
*
* Use this program at your own risk. It works for me on:
* Ultrix V3.1C (Rev. 41) on a DS5400
* ULTRIX V4.1 (Rev. 52) on a DS5400
*
* This silly little program reads a .o file and finds the DEC MIPS/RISC
* assembler instruction:
*
* sltiu r1,r2,9
*
* which just happens to have the bit pattern indicated below.
* This instruction seems to be unique in the Ultrix 4.1 /sys/MIPS/BINARY
* ufs_namei.o and nfs_gfsops.o files, and happens to correspond
* to the test for the number of symlinks allowed. Changing this
* word to be, say, sltiu r1,r2,17 (0x2c410011) will allow 16
* symlinks instead of the current 8. If the program completes
* successfully, the cmp above will find exactly one byte different in the
* two files and you should feel safe in saving and replacing the supplied
* binaries with the new ones. You could use dis(1) to disassemble
* the result, to make really sure. Rebuild your kernel, relax and enjoy.
*
* If you can't wait and like to live more dangerously (of course you do),
* dbx your running kernel, find both sltiu instructions, and patch them.
* This will make the change "in memory" and you'll have to do it on next
* reboot, so remember to patch the real files some time too:
*
* # dbx -k /vmunix
* dbx version 2.0
* Type 'help' for help.
* reading symbolic information ...
* [using memory image in /dev/mem]
* (dbx) &ufs_namei/9999L 0x2c410009
* 800f36d4: 2c410009
* (dbx) assign 0x800f36d4=0x2c410011
* (dbx) &nfs_namei/9999L 0x2c410009
* 80071b68: 2c410009
* (dbx) assign 0x80071b68=0x2c410011
* (dbx) q
*
* You now can nest symlinks 16 deep, at least until the next reboot.
* Remember to patch your ufs_subr.o and nfs_gfsops.o files and rebuild
* your kernel to make the change permanent. If DEC had an
* electronic SPR system, I'd suggest to them that they put the
* MAXSYMLINKS value in an external that one can patch more easily
* or that can be set by options in in param.c.
*
* I don't know if this works on versions of Ultrix other than 3.1C and
* 4.1. I think it should. Someone else can send in the VAX version.
*
* -IAN! idallen at watcgl.waterloo.edu Waterloo Ontario CANADA
*/
#include <stdio.h>
#define r1_r2_9 0x2c410009 /* test for 8 symlinks */
#define r1_r2_new 0x2c410011 /* test for 16 symlinks */
main()
{
register int word;
register int i;
for(word=0;;) {
if( (i=getw(stdin)) == -1 ){
if( ferror(stdin) ){
perror("stdin");
return(1);
}
if( feof(stdin) )
return(0);
}
if( i == r1_r2_9 ){
/* Found the instruction; replace it */
fprintf(stderr,"at 0x%x found 0x%x and used 0x%x\n",
word*4, i, r1_r2_new);
i = r1_r2_new;
}
if( (i=putw(i,stdout)) == EOF ){
if( ferror(stdout) ){
perror("stdout");
return(1);
}
}
++word;
}
/*NOTREACHED*/
}
--
-IAN! (Ian! D. Allen) idallen at watcgl.uwaterloo.ca idallen at watcgl.waterloo.edu
[129.97.128.64] Computer Graphics Lab/University of Waterloo/Ontario/Canada
More information about the Comp.unix.ultrix
mailing list