Linux下安装Sybase ASE时的环境变量LD_POINTER_GUARD的含义

晨曦之光 发布于 2012/04/12 12:53
阅读 268
收藏 0

去年就听说,这个环境变量可以不用设置了,是从15.0.3或者以上版本开始。但我还是将信将疑。

 

LD_POINTER_GUARD这个环境变量,作用是什么呢?

 

ASE在linux下,遇到glibc2.4以及更新版本的glibc库时,碰到了问题,结果通过设置这个环境变量为0或者1,得到一个workround,去绕过这个问题。到底是什么问题呢?

有一个CR#CR 479363,专门解决这个问题。15.0.2 ESD #4 and 15.0.1 Cluster Edition ESD #2.

 

是什么导致这个问题呢?

ASE实现了自己的内部使用的线程库,从一个线程切换到另一个线程(在Linux上),我们常常用到标准的跳转调用setjmp/logjmp。setjmp实际上只是获取当前上下文的一个快照,这个快照(jump缓冲)后来会被传递给longjmp,以用于跳转回到以前的上下文。这个小技巧可以让线程能够获取在共享内存里的相关栈数据,允许这些线程在多个操作系统进程之间调度。当创建一个新线程,但是没有合适的jump缓冲去跳转时,需要手动创建一个,并将栈指针放到共享内存里,这就是问题所在。

 

在glibc2.4里,有一个变化是把栈指针放到了jump缓冲里。setjmp会把当前的栈指针放到jump缓冲里,然后longjmp会取出栈指针,由于初始的栈指针是人为创建的,因此初始的jump缓冲保存的是一个未经修改的栈指针,当longjmp获取这个栈指针时,则会导致crash。

 

If you are going to be using ASE 12.5 or ASE 15 with the upcomingRed Hat Enterprise Linux 5.0, there are two CRs that you need to knowabout:

  1. CR 450004 – XP Server and Backupserver (64bit)
  2. CR 432482 – ASE 15

The problem is the result of using the jmp() and longjmp() functions in the GNU C Library version 2.4 (glibc 2.4).

setjmp() and longjmp() are useful for dealing witherrors and interrupts encountered in a low-level subroutine of aprogram. setjmp() saves the stack context/environment in env for lateruse by longjmp(). The stack context will be invalidated if the functionwhich called setjmp() returns.

Starting in glibc 2.4, the jmpbuf is unavailable due to a securityexploit known for several years.  Restricting access to the jmpbuf wasan effort by the glibc maintainers to ‘close this hole’ by forcing theapplication writers to use the sigsetjmp() and siglongjmp() instead.

The problem with using sigsetjmp() and siglongjmp() is that theyaren’t thread safe.  This is supposed to be fixed in glibc 2.6according to a contact at Sybase but Sybase *does* have a workaroundfor this issue and will be putting it into the ASE v15 codeline whenthey perform the RHEL 5 certification sometime next year.

I wasn’t able to find much information the supposed exploit.  I only found a few newsgroup posts that didn’t provide any details.

 

Michael Peppler maintains the ASE on Linux FAQ.  It contains a workaround for various distributions of Linux:

Installing/Running ASE on systems with glibc 2.4.x (Fedora Core 5, etc)

ASE (12.5.x, 15.x) will not run on a system with glibc 2.4.x (that’sFedora Core 5 and later, among others). Here is a work-around, suppliedby “Chris” in sybase.public.ase.linux:

Symptoms of the problem are ASE’s failing to build when you run theinstaller, or “Segmentation Fault” when trying to start an ASEinstance. The Seg Fault happens right after Engine ) is brought onlinein the error log.
If you are running Fedora Core 5 or 6
You will need to set the environment variable LD_POINTER_GUARD to 0, in your sybase .profile, as follows:

export LD_POINTER_GUARD=0  (Fedora, Redhat系列)

Alternatively, just export this from the shell. If you haven’t builtany ASE’s yet, you’ll need to export this before running the installer,otherwise ASE will fail to build. If you are trying to boot an alreadyinstalled ASE, then put it in your .profile / .bash_profile or exportit as an environment variable before starting ASE.
If you are running Ubuntu / Kubuntu “Edgy”
You will need to set the environment variable LD_POINTER_GUARD to 1 in your sybase .profile, as follows:

export LD_POINTER_GUARD=1 (Ubuntu系列,现在似乎可以不要这个参数了)

I googled around a bit trying to find out what the LD_POINTER_GUARDthingie did and ran across a posting / blog where it talked aboutinsome glibc versions it’s backwards … RedHat just made a change Iguess and that’s why you have to set it to “0″ for Fedora and “1″ forUbuntu / Kubuntu / Debian (glibc 2.4). Same info applies if you arebuilding a new ASE.
If you are running Suse 10.1 You will need to set the environment variable LD_POINTER_GUARD to 1 in your sybase .profile, as follows:

export LD_POINTER_GUARD=1 (SuSE系列)

Same discussion as for Ubuntu.
I’ve tried all of the above they all work with the workaround listed.Happy ASE-ing! I’ve tested all of the above distros (sorry it took meso long, was on the road a lot over the last several weeks) and theyallow ASE to boot; the workaround should be valid for ASE 15.x and 12.x(prolly even for 11.x if you wanted to try).

UPDATE: Workaround for all current versions of ASEathttp://froebe.net/blog/2008/06/26/how-to-install-and-run-sybase-adaptive-server-enterprise-1254-and-150x-on-ubuntu-linux-804-jeos-hardy-heron-using-chroot-environment/

 

 

 

 


原文链接:http://blog.csdn.net/iihero/article/details/5473097
加载中
返回顶部
顶部