My First Post      My Facebook Profile      My MeOnShow Profile      W3LC Facebook Page      Learners Consortium Group      Job Portal      Shopping @Yeyhi.com

Pages










Tuesday, March 27, 2012

How to solve "Failed to load shared object Sgment Prot after reloc:Permission Denied" Problem in Linux

All of a sudden, I started getting an error on my Linux box. I was mesmerized as to what could be the possible cause. The error message was pretty confusing. It said:
Failed to load shared object. cannot restore sgment prot after reloc permission denied
Initially I thought that this problem over my binaries are coming due to Permission errors. I checked the permissions on directories, binaries, executables. But all were fine. Then I though of running using 'su' or 'sudo' command, but to no avail.


I searched through Internet and found that someone has got a similar error in CentOS too. It so happens that CentOS 5 has the SE Linux feature set to enforcing. So, sometimes when you install CUBRID on CentOS and try to start the cubrid services cubrid service start, you may encounter the following error:
[cubrid@localhost ~]$ cubrid service start
cubrid: error while loading shared libraries: /opt/cubrid/lib/libcubridsa.so.8: cannot restore segment prot after reloc: Permission denied

This error is not limited to installation. It can come while running an application too. It should be remembered that This problem is seen in Linux gcc 4.1.2 i686 i386 GNU/Linux flavors too. Resolution is same. While installation of any package or Starting any service on a RHEL or CentOS based Server you may receive following Error
cannot restore segment prot after reloc: Permission denied

This Error comes when SELinux setting is enabled on the server. Someone even reported this coming from java librarie. The error was while trying to run several programs. For example:
Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/lib/libjpcap.so: /usr/lib/libjpcap.so: cannot restore segment prot after reloc: Permission denied

How to solve Failed to load shared object Sgment Prot after reloc:Permission Denied Problem in Linux
No problems!!
As already told you this comes due to Security-Enhanced Linux (SELinux). It is a Linux feature that provides a mechanism for supporting access control security policies through the use of Linux Security Modules (LSM) in the Linux kernel.
By Default SELinux is set to “enforcing” in CentOS on boot, this can be disabled permanently. To disable it edit file “/etc/selinux/config” and change SELINUX

To temporarily disable enforcement on a running system, type
/usr/sbin/setenforce 0

To permanently disable enforcement during a system startup
change "enforcing" to "disabled" in ''/etc/selinux/config''

It was a great relief to me when I got my control back on my binaries. Cheers!!

Can't locate XML/Simple.pm @INC( @INC in Perl linux

Sometimes you Perl code starts acting weird. You get error as "Can't locate XML/Simple.pm @INC( @IN" . This basically occurs due to a very simple reason:
XML-Simple.pm file missing in Perl linux
For example you can see the snapshot of an error message that I got:

How to solve Can't locate XML/Simple.pm @INC( @INC problem in Perl Linux
How to resolve XML/Simple.pm or Install Simple.pm
simple method to install XML::Simple is as follows:

perl -MCPAN -e 'install "XML::Simple"'

There is yet another test that you may do before installing. This is to check if XML::Simple is installed. For this try:

perl -e 'use XML::Simple;'



There is yet another method that I personally like because of less complexity involved. And as I can see, this is even faster:

Code:
cpan install XML::Simple


I would like to convey to my readers here some bits over the CPAN. This is collected from Internet and following has no intellectual claims by me :)


CPAN is the world-wide archive of perl resources. It consists of about
300 sites that all replicate the same contents around the globe. Many
countries have at least one CPAN site already. The resources found on
CPAN are easily accessible with the CPAN.pm module. If you want to use
CPAN.pm, lots of things have to be configured. Fortunately, most of
them can be determined automatically. If you prefer the automatic
configuration, answer 'yes' below.

The same can be seen in following picture:

If you prefer to enter a dialog instead, you can answer 'no' to this
question and I'll let you configure in small steps one thing after the
other. (Note: you can revisit this dialog anytime later by typing 'o
conf init' at the cpan prompt.)



And doing this solves the problem!!

Monday, March 5, 2012

SCAM : YouTube Service sent you message:

Your video on the TOP of YouTube

YouTube Administration sent you a message: Illegal video warning

etc. etc

This is a new scam that is in rotation these days. BEWARE of this and try not clicking on the link provided.

This weekend I got an email whose subject is as follows---
"""
YouTube Service has sent you a message:
Your video on the TOP of YouTube
To:toughjamy@yahoo.com

http://www.youtube.com/watch?v=xcUE2Gvr&feature=topvideos_mp
You can reply to this message by visiting your inbox.
"""

But on clicking the link and going to said URL. Somehow I didn't click on the click but copied URL to open it in different browser. I landed on a page giving me warning from Youtube itself.
The email originated from




I researched the 'headers' section of email and found the following:
It is spam. If you look at the headers, I guarantee you'll find that it was not sent by YouTube.

""""
X-Apparently-To: toughjamy@yahoo.com via 68.142.200.130; Sun, 04 Mar 2012 19:17:50 -0800
Return-Path:
Received-SPF: none (domain of urc.state.in.us does not designate permitted sender hosts) IG1lc3NhZ2U6IFlvdXIgdmlkZW8gb24gdGhlIFRPUCBvZiBZb3VUdWJlIAog IAoKICAKICAgIAoKICAgICAgCiAgICAgICAgCiAgICAgICAgICAKICAgICAg ICAgICAgCiAgICAgICAgICAgICAgCiAgICAgICAgCiAgICAgICAgCiAgICAg ICAgICBoZWxwIGNlbnRlcgogICAgICAgICAgfCBlLW1haWwgb3B0aW9ucwog ICAgICAgICAgICB8IHJlcG9ydCBzcGFtCiAgICAgICAgCiAgIAEwAQEBAQ--
X-YMailISG: QEsw7QEWLDs1NHRMTHBfsGRrVIRuCV3jp9QQ.7N9BUS7OCtJ fpQrxSU6fN_5nrgXbnAKvsXq3WvrSaqhptInsAhIJX23ZB.PiVlKXZU7ul6T J5Q35WZgKB88380z.7eloCBHqHdr4ytrgWmfMj8Y3ZcszbS9yS1N3wEdjG58 jCQGC9_mumP2_GNHbxVbshQ0lpqqf4Pzfb.UJh1228waZh.x8nRZqvFhNTQX hjIttKX5ykKEaDQCfh1WSvWv.mzZpbjehQ6y0uW7Vbzrta1hZV9AUZiBBB15 X5GrjPRZgN_yIIeFXuqWdEWbd2u7zKJgb2LR965l7uZtvwDBkF98eByJpCwZ 3bTSv12viIdpgsqsdW5525aqgJPJmUfH3j.E.Pi0wM2Xi2CV9pNc6jHTgICU eXswpS91gNJNDET3zNEb.wc2GOt4g8HMQze_4XB81eI3nChAPGE8OOgWQahs jJ_9EZ9DNnGArzaPL1.O68mjulZvfPaJQGdLJMfKsP95HP4OEk0R_RuEZesB A89i2xo1S_GbsmlJdc95Eq7Uw.sk63o4pJGGTmG.HLRXO1vUfTgBZ2FX_FQl ApTMeQAe.sKUCVS1K77.maxmh5hXfNHXul3ODqjCCToVU2RrplWEEKB4kYOA O2H7TJVtd3ceyp7LcVGqCGuDOHYsgrnGZH1M9jNdXXRTScbpGjjyZwcqg0y1 dsE3YwbUKUS1cUM.99kZ63SYTLmHs7fLTSLQFnnJ26jkWGq5Tcn5sStRtehI 1YedQwtU78Xl58JRnUIS8EG.QANKqx_goxcQPQGAbElbxsaQHBWD52Bpjp1y iS5JyW6txwYjhpAwa.AYs6zpAnNzfkraxDKBVc9xGM6XWOx0NA2GwPi0E20M pbjrhDkP_BtCQiGfNG7oeg7zMZ_4c_l1_0B28ITkHqUSXTSilEajB5GJ7Sqj 5ClClMo7UQfHve9NFJc.rN_9PAXhtc.H5hlGSnWysoIP5ac3wuFYdFLC3Mx_ yusPXC4marJ5Nis4Pk_IrVIGKuEhIIfOUVBjGgJTpDjougomLcjaGJHQkI3O AGnLWuIcBkkxh48-
X-Originating-IP: [72.55.174.39]
Authentication-Results: mta1095.mail.sp2.yahoo.com from=youtube.com; domainkeys=neutral (no sig); from=youtube.com; dkim=neutral (no sig)
Received: from 127.0.0.1 (HELO not-assigned.privatedns.com) (72.55.174.39) by mta1095.mail.sp2.yahoo.com with SMTP; Sun, 04 Mar 2012 19:17:50 -0800
Content-Type: text/html; charset="iso-8859-1"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
Subject: YouTube Service sent you a message: Your video on the TOP of YouTube
From: YouTube Service Add sender to Contacts
To: toughjamy@yahoo.com
Message-Id: <20120304221746 .071fe5d9b="" yahoo.com="">
Date: Sun, 4 Mar 2012 22:17:46 +0200 (CEST)
Content-Length: 1835
""""""

So, now i was pretty much qualified to know that this is Scam.

Do also read Youtube Video Scam Support Page redirected from Discussions For IT People

Our Security Team headed by Mohd Anwar Jamal Faiz and *SO* tried to explore other areas where similar emails were in circulation.
(email us on toughjamy@yahoo.com.) [ i removed the second email in 2020]

Not to our surprise, *SO* deduced same problem even in Appstore emails. Its subject is "Your Order cancellation notification"


Many people have reported of getting similar emails. The return address is an "@youtube.com" address, which makes it look legit. The actual links in the one email someone got were different than the one i got, so it's probably a pre-manufactured template or something that a bunch of scammers are using. There's one of these from Apple App Store floating around, too. It reads "Your Order cancellation notification" or some such.

Happy Surfing
-Anwar faiz

Wednesday, February 22, 2012

Check corrupt ZIP file. Integrity, CRC, and Repair too!!

Hi,
This post deals with the corruption that may have creaped into your Zip (or other files like rar, doc, excel, file. During download, or due to some intentional malformation, your zip file may not work properly. You can use following tools to revisit your archived files in zip format.
These tools may prove very useful and handy during your testing process also, in case your tool is not acting in expected manner with some Zip file.

You can visit Recovery Tool Official Website
I have personally found these useful.

Recovery and Repair tools for Zip, RAR, Excel, Outlook, word etc

Tools in discussion are as follows:
1. Recovery Toolbox for Zip - an efficient remedy for damaged zip files
2. Recovery Toolbox for Outlook
3. Recovery Toolbox for RAR
4. Recovery Toolbox for PDF
5. etc etc

Check out more at the given site.

PS: There are several other companies offering such tools. You can judge which is better before buying. These are my choices though!!

Monday, February 20, 2012

Analysis of Valgrind “Still-reachable” memory leak

Valgrind, on Linux and FreeBSD etc, reports “Still reachable” in Memory Leaks section using the memcheck or mc tool. What is REAL Memory Leak and why some leaks are called False Positives?

Many programs use the C++ STL and string classes. Valgrind, at times (rather too often ;) ) reports “still reachable” memory leaks involving these classes at the exit of the program. Ideally, there should be no such occurrence, so what should be done.
To take this article further, one thing that has to be kept in mind that it may not be a bug. Every tool has its own False positives, and Valgrind is no exception. And in this case, this is not even a False positive. It just indicates a possible issue, which may be just intended by the programmer.

This article can be regarded as an extension to the memory leak tutorial on Valgrind. It will make the Software Quality Assurance Engineers and developers more confident on their releases. Here I discuss the Still Reachable part of the Valgrind memcheck report


Let us assume that you started a Valgrind with its memcheck tool, and Valgrind initial logs say as following:
==12078== Memcheck, a memory error detector
==12078== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==12078== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==12078== Command: ./mohd-anwar-faiz-test-tool --helloWorld /targetFolder/
==12078== Parent PID: 1287
--12078-- Valgrind options:
--12078-- --tool=memcheck
--12078-- --leak-check=yes
--12078-- --show-reachable=yes
--12078-- --num-callers=20
--12078-- --track-fds=yes
--12078-- -v
--12078-- --log-file=/perforce/work/mohd-anwar-faiz-test-tool.txt
--12078-- Contents of /proc/version:
--12078-- Arch and hwcaps: AMD64, amd64-sse3-cx16

…, and the processing goes on.

So, this logs simply tells you about the options you used. And, this gives you the confidence that memory leaks will be catched.

Now, let us see what actually a memory leak is in this context. During my stint with Software Product Development companies like Adobe and Symantec, I have really discovered more than one definition to the concept of a "memory leak".

The first says that a "memory leak" happens when, " Some memory that has been allocated is not subsequently freed before the termination of the program." However, I have seen programmers arguing (And that is why probably we hear terms like False Positives. Voila!), that certain memory leaks that fall into above category do not actually pose any threat, and therefore must not be regarded as real "memory leaks". They are NOT REAL “memory leaks”.

Another definition says that a "memory leak" happens when, "Some memory was allocated but that cannot be subsequently freed. This situation may arise if the program no longer holds any pointers to the allocated memory." That is, memory cannot be freed since you no longer have any pointers to that block. Such a condition is then a REAL "memory leak".

Now coming to Valgrind, it uses the latter definition for the term "memory leak". This is the type of leak which may potentially cause real heap depletion, particularly for long lived processes. These can be surfaced by persistence tests. And, tools like Valgrind, AppVerifier, Fortify etc come into roles.




Let us assume that your application gave result as follows:

==12078== LEAK SUMMARY:
==12078== definitely lost: 0 bytes in 0 blocks
==12078== indirectly lost: 0 bytes in 0 blocks
==12078== possibly lost: 0 bytes in 0 blocks
==12078== still reachable: 6,720 bytes in 26 blocks
==12078== suppressed: 0 bytes in 0 blocks

So now, the above sample clearly tells that there are no memory leaks. But, still-reachable section shows some counts. Now here, it must be taken into consideration that the "still reachable" category in the Valgrind's leak report refers to allocations that fall into the category of first definition. It is true that these reported blocks were not freed; But these could have been freed. And that is what is the literal meaning of the term ‘STILL REACHABLE’. So, may be it was intentionally left by the programmer, because in any case the program during all its execution was keeping track of these pointers.

I have been in touch with my former colleague at Tata Consultancy Services over this issue (Thanks to *SO*), and was issued the same advice. Later I googled and found similar conclusion from the Valgrind FAQ document itself. As seen from documents on Valgrind official website itself Valgrind Official Documentation Page, these situations might arise and there is not much to worry about them. Read below, an snippet from their web pages itself:
"
Using GCC, you can force the STL to use malloc and to free memory as soon as possible by globally disabling memory caching. Beware! Doing so will probably slow down your program, sometimes drastically.
• With GCC 2.91, 2.95, 3.0 and 3.1, compile all source using the STL with -D__USE_MALLOC. Beware! This was removed from GCC starting with version 3.3.
• With GCC 3.2.2 and later, you should export the environment variable GLIBCPP_FORCE_NEW before running your program.
• With GCC 3.4 and later, that variable has changed name to GLIBCXX_FORCE_NEW.
There are other ways to disable memory pooling: using the malloc_alloc template with your objects (not portable, but should work for GCC) or even writing your own memory allocators. But all this goes beyond the scope of this FAQ. Start by reading http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#4_4_leak if you absolutely want to do that. But beware: allocators belong to the more messy parts of the STL and people went to great lengths to make the STL portable across platforms. Chances are good that your solution will work on your platform, but not on others.
"

So, what I conclude and do practice is that, there is no need to worry about "still reachable" memory leaks in Valgrind. They do not pose threats as the REAL memory leaks do. Practically these NON-REAL memory leaks have no potential for heap exhaustion. You can revisit the code for gaining more confidence, if your project cycle permits that much time (which I know is rare!! :) ). There is not much need to worry for these still reachable pointers. These allocations were done and the references were kept throughout the process execution cycle. And in the end, the operating system will reclaim these allocated memory after the process termination.

That is it for the day.
-Mohd Anwar Jamal Faiz
Poet and Creative Writer. Software Engineering is both my job and passion. I love what I do!!

Valgrind Version Used: Valgrind-3.6.1 and LibVEX;
Platform Used: FreeBSD 64 bit, Linux, Solaris

To know more about me cheack: Anwar Faiz on MeOnShow