Mittwoch, 10. Dezember 2014

[solved] Symantec Backup Exec on linux 3.x kernel [fixed]

I just wanted to publish some findings about a problem, which encountered at work, for which there is a simple fix, I could not find somewhere else. And I did not have any other place to publish it, hope google finds it for the right people ;).

At work we use Symantec Backup Exec 2010 to backup our windows machines, but also to backup some data on our (my) Linux servers. After a kernel update, caused by updating from Debian Squeeze to Debian Wheezy, the Backup Exec client beremote failed to start (sorry for the layout mess, but I want google to find it):

ksh # /opt/VRTSralus/bin/beremote
GetIfAddrs(LINUX): failed err = 11
*** glibc detected *** /opt/VRTSralus/bin/beremote: free(): invalid pointer: 0xb5ff84a4 ***
======= Backtrace: =========
Reverting back to a 2.x kernel solved the problem. As I needed the new kernel for other reasons, reverting back was no option.
So I asked google and discovered, that only Backup Exec 2014 would work with 3.x kernels. Not nice, as we did not want to upgrade all our environment just because of the linux client.

Time for some strace and gdb sessions.

It was not too difficult to detect, that some ioctrl call was the last thing, happening before the crash. Some more searching on the internet revealed, that the following kernel patch is responsible for the crash: Interesting parts:

- err = -EINVAL;
+ err = -ENOTTY;

- return -EINVAL;
+ return -ENOTTY;

- return -EINVAL;
+ return -ENOTTY;
So now a call returns a different code, which seems to cause a crash in beremote. Who coded beremote!?
Nevertheless, I patched the kernel 3.x to return the old value and beremote started working again.
But this might have effects on other software, which expects the new (correct) return code and I did not want to manually build every new kernel on all of my machines.
Looking at the crash output above, it is clear, that the problem is in

Time for some disassembler sessions.

It's been a while, since I last read assembler code, but seems like I am old enough, to still know such stuff ;).

.text:0001FF05   call    _ioctl
.text:0001FF0A   add     esp, 10h
.text:0001FF0D   test    eax, eax
.text:0001FF0F   jns     short loc_1FF26
.text:0001FF11   call    ___errno_location
.text:0001FF16   cmp     dword ptr [eax], 16h
.text:0001FF19   jnz     loc_2026C
EINVAL is defined as 22, hex 0x16. As this is the only place, where such a compare happens, lets patch it! Fire up your favorite hex editor and have a look at offset 0x1ff10:
0001ff10: 15 E8 5A DA FE FF 83 38 16 0F 85 4D 03 00 00 C7
Ah there is a 0x16!

Time to patch beremote!

Now we replace it with the correct value for ENOTTY, which is 0x19!

And .. now beremote starts again and can do backups, even on newer kernels! So, if you have the same problem and google brought you here: The patch above works for the following file versions:
ksh # shasum beremote
c11b9872438ffbca29f5bf5af9288eb994f92bd0  beremote


sh # shasum


390312 beremote
  • Be sure to just apply the patch, if you have exactly those files.
  • If you have a different version, have alook above, that is why I wrote down all that stuff. You should be able to search for the above hex values and find 0x16 yourself.
  • If not, you should know, where to look in the disassembly.
  • If not, maybe you should upgrade to Backup Exec 1024 ;).
If I saved you a lot of trouble and/or a lot of money, there is a donate button on, which you may also use for this patch ;). But of course, this patch is for free!

1 Kommentar: