Closed suntong closed 10 years ago
Im getting the same error when running 'make test' on 13.04. Which the source already contains a prebuilt 'shc' binary already compiled (you can delete it and just run 'make shc' to create a new one if you want). Then you should just be able to add 'shc' to /bin or wherever (give executable permissions), and then run as mentioned in the README
This will create 2 file as output; example.sh.x example.sh.x.c
Then just rename example.sh.x to example
But ill leave this open and see whats causing 'make test' to fail and ill update the README
Thanks for the swift respond. Is this Mr. Francisco Javier Rosales García?
I downloaded shc-3.8.9 from http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9.tgz, 20536B in size, which doesn't come with prebuilt 'shc' binary:
-rw-r----- 1 3846 2012-05-07 05:59 CHANGES -rw-r----- 1 17982 1996-05-09 12:34 Copying -rw-r----- 1 1941 2012-04-28 06:21 makefile -rwxr-x--- 1 336 2003-02-21 15:29 match -rwxr-x--- 1 155 2003-06-19 12:43 pru.sh -rw-r----- 1 24936 2012-05-07 06:06 shc-3.8.9.c -rw-r----- 1 3136 2004-07-08 11:45 shc.1 -rw-r----- 1 1544 2003-06-19 11:12 shc.README -rw-r----- 1 4558 2004-07-08 11:46 shc.html -rwxr-x--- 1 138 2004-11-12 15:32 test.bash -rwxr-x--- 1 52 2003-06-19 12:44 test.csh -rwxr-x--- 1 142 2008-01-18 05:54 test.ksh*
then run as mentioned in the README
shc -r -f example.sh
Following your advice, I tried with the test.bash that comes with the tgz file:
shc -r -f test.bash
This will create 2 file as output; example.sh.x example.sh.x.c
and get 2 files:
-rwx-wx--x 1 11296 2013-10-19 16:11 test.bash.x* -rw-rw---- 1 9934 2013-10-19 16:11 test.bash.x.c
Then just rename example.sh.x to example...
when I run test.bash.x, I get:
$ test.bash.x* test.bash.x: Operation not permitted Killed
Hmm, im not able to reproduce that one.. (make sure executable permissions are set and if shc (or even the compiled test binary) isnt in your PATH, try below
$ ./shc -r -f test.bash $ ./test.bash.x
Then it outputs the test script
echo '$@ is ' $@ is echo 'command line: ./test.bash.x ' command line: ./test.bash.x echo 'hello world' hello world echo '[32246] PAUSED... Hit return!' [32246] PAUSED... Hit return! read DUMMY
exit 0
im not able to reproduce that one..
I think you are using the prebuilt 'shc' binary. Could you remove it and compile from the source please?
thanks
rm test.bash.x* rm shc make ./shc -r -f test.bash ./test.bash.x
Im still unable to reproduce..
$ rm shc $ make shc cc -Wall shc.c -o shc $ ./shc -r -f test.bash $ ./test.bash.x
echo '$@ is ' $@ is echo 'command line: ./test.bash.x ' command line: ./test.bash.x echo 'hello world' hello world echo '[511] PAUSED... Hit return!' [511] PAUSED... Hit return! read DUMMY
exit 0
Ah, I should have include the outputs when posting what I tried. I retry them after I posted the "I think you are ..." comment. So, we get conflict results using exactly the same command sequence. Hmm... what's your current system? I remember you said,
Im getting the same error when running 'make test' on 13.04.
Could you try that exact command sequence on Ubuntu 13.04 please?
Im running Linux Mint 15 (raring 13.04) with custom kernel 3.11-1.dmz.1-liquorix-amd64 .. Ive tried the shc compiler on various OSs, all works fine, I havent tried 'make test' on those since i just compile and use the shc to compile bash/sh scripts into binaries and its always worked fine. Ive compiled probably 20+ scripts on my current system with the current source, no problems (except just running 'make test')
Thanks a lot for your detailed explanation.
Hmm... everything looks so strange. So maybe it's kernel? I'm just using the official Ubuntu 13.04 vanilla kernel. But wait, you said only 'make test' doesn't work for you, what's so special about that match shell script? Maybe the shebang? OK, just for the record:
$ rm -v shc
removed 'shc'
$ make shc
cc -Wall shc.c -o shc
$ CFLAGS="-Wall " ./shc -r -v -f test.bash
shc shll=bash
shc [-i]=-c
shc [-x]=exec '%s' "$@"
shc [-l]=
shc opts=-x
shc: cc -Wall test.bash.x.c -o test.bash.x
shc: strip test.bash.x
shc: chmod go-r test.bash.x
$ ./test.bash.x
./test.bash.x: Operation not permitted
Killed
$ CFLAGS="-Wall " ./shc -r -v -f match
shc shll=sh
shc [-i]=-c
shc [-x]=exec '%s' "$@"
shc [-l]=
shc opts=
shc: cc -Wall match.x.c -o match.x
shc: strip match.x
shc: chmod go-r match.x
$ ./match.x sh
./match.x: Operation not permitted
Killed
$ head -1 test.bash match
==> test.bash <==
#!/bin/bash -x
==> match <==
#!/bin/sh
$ ls -l /bin/bash /bin/sh
-rwxr-xr-x 1 root root 959168 2013-03-30 11:37 /bin/bash
lrwxrwxrwx 1 root root 4 2012-08-15 06:41 /bin/sh -> dash
$ apt-cache policy bash
bash:
Installed: 4.2-5ubuntu3
Candidate: 4.2-5ubuntu3
Version table:
*** 4.2-5ubuntu3 0
500 http://us.archive.ubuntu.com/ubuntu/ raring/main amd64 Packages
100 /var/lib/dpkg/status
$ strace -f -o /tmp/shc test.bash.x
test.bash.x: Operation not permitted
$ cat /tmp/shc
32578 execve("./test.bash.x", ["test.bash.x"], [/* 125 vars */]) = 0
32578 brk(0) = 0x1938000
32578 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
32578 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb399054000
32578 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
32578 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
32578 fstat(3, {st_mode=S_IFREG|0644, st_size=74614, ...}) = 0
32578 mmap(NULL, 74614, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb399041000
32578 close(3) = 0
32578 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
32578 open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
32578 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\37\2\0\0\0\0\0"..., 832) = 832
32578 fstat(3, {st_mode=S_IFREG|0755, st_size=1848024, ...}) = 0
32578 mmap(NULL, 3961912, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb398a6c000
32578 mprotect(0x7fb398c2a000, 2093056, PROT_NONE) = 0
32578 mmap(0x7fb398e29000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1bd000) = 0x7fb398e29000
32578 mmap(0x7fb398e2f000, 17464, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fb398e2f000
32578 close(3) = 0
32578 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb399040000
32578 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb39903e000
32578 arch_prctl(ARCH_SET_FS, 0x7fb39903e740) = 0
32578 mprotect(0x7fb398e29000, 16384, PROT_READ) = 0
32578 mprotect(0x601000, 4096, PROT_READ) = 0
32578 mprotect(0x7fb399056000, 4096, PROT_READ) = 0
32578 munmap(0x7fb399041000, 74614) = 0
32578 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fb39903ea10) = 32579
32578 wait4(32579,
32579 getppid() = 32578
32579 close(0) = 0
32579 open("/proc/32578/as", O_RDWR|O_EXCL) = -1 ENOENT (No such file or directory)
32579 ptrace(PTRACE_ATTACH, 32578, 0, 0) = -1 EPERM (Operation not permitted)
32579 dup(2) = 0
32579 fcntl(0, F_GETFL) = 0x8002 (flags O_RDWR|O_LARGEFILE)
32579 brk(0) = 0x1938000
32579 brk(0x1959000) = 0x1959000
32579 fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
32579 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb399053000
32579 lseek(0, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
32579 write(0, "test.bash.x: Operation not permi"..., 37) = 37
32579 close(0) = 0
32579 munmap(0x7fb399053000, 4096) = 0
32579 kill(32578, SIGKILL) = 0
32579 exit_group(0) = ?
32579 getppid() = 32578 32579 close(0) = 0 32579 open("/proc/32578/as", O_RDWR|O_EXCL) = -1 ENOENT (No such file or directory) 32579 ptrace(PTRACE_ATTACH, 32578, 0, 0) = -1 EPERM (Operation not permitted)
looks to me it's trying to ptrace parent pid, but in CHANGES:
$ grep -B2 ptrace CHANGES
3.3 Thu Jan 24 21:27:07 CET 2002
Prevent to ptrace the process.
Just to make the story full, it fails as well in Ubuntu 13.10, with the vanilla official kernel.
NAME="Ubuntu" VERSION="13.10, Saucy Salamander"
$ cat /proc/version Linux version 3.9.0-1-generic (buildd@roseapple) (gcc version 4.8.0 (Ubuntu 4.8.0-6ubuntu1) ) #5-Ubuntu SMP Wed May 8 20:52:54 UTC 2013 $ uname -rsm Linux 3.9.0-1-generic i686
ptrace protection is enabled by default on latest (debian) kernels. To avoid "killing" of the process you have to:
echo 0 > /proc/sys/kernel/yama/ptrace_scope
(src: http://serverfault.com/a/507368) but this applies to the destination box as well, the generated executable needs that flag disabled as well. :(
Annoying. This means that there's a probem with the output. Turned off on my build and the compiled scripts started working.
Problem found. Basically, the "compiler" sets on ptrace support always in spite of the command line flag because of #if directive misuse (#if !TRACEABLE is a no-no, period. It should be #if defined(foo) or #if !defined(foo) and has been for a while now...) so it's exposing it all the time regardless of the command line flag.
I pushed a commit fixing the #if usage pointed out by madscientist42. If someone can test and let me know if this issue is resolved id appreciate it!
I found this situation tomorrow. After changing to root (sudo su), I can perform name.sh.x success.
The #if fix works. Previously, I needed to compile with the -T command line flag.
Thanks @chrand.
This issue is now closed.
So you are saying it's not merged into 14.04 Ubuntu official repository with shc? I'm having this issue on this OS.
shc Version 3.8.9b
@cadavre,
what's your full output of apt-cache show shc
and apt-cache policy shc
?
shc -T -f script.sh try this you will get the exect results.
Hi All
I am having an issue with either shc or linux for a bash script. I have encrypted my bash script.
Checking that shc in installed correctly:
./shc -v
shc parse(-f): No source file specified
shc Usage: shc [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-rvDTCAh] -f script
Checking that my bash script works:
./file_dist.sh Starting File Distribution PID File Exists Destination Box Reachable Source & Dest Input Parameters Exists Source Dir Exists Backup Dir Exists or Created if not bzip2 is Installed Files have been Transmitted Successfully and backed up Script done. PID file has been removed
Encrypting the script:
./shc -f file_dist.sh
Output:
ls -l file_dist.* -rwxr-xr-x 1 root root 3168 Oct 4 14:06 file_dist.sh -rwx--x--x 1 root root 15248 Oct 4 14:07 file_dist.sh.x -rw-r--r-- 1 root root 26773 Oct 4 14:07 file_dist.sh.x.c
I run my encrypted script as root and it works:
./file_dist.sh.x Starting File Distribution PID File Exists Destination Box Reachable Source & Dest Input Parameters Exists Source Dir Exists Backup Dir Exists or Created if not bzip2 is Installed Files have been Transmitted Successfully and backed up Script done. PID file has been removed
I have a user called ff-dist, I can execute the original script from this user:
./file_dist.sh Starting File Distribution PID File Exists Destination Box Reachable Source & Dest Input Parameters Exists Source Dir Exists Backup Dir Exists or Created if not bzip2 is Installed Files have been Transmitted Successfully and backed up Script done. PID file has been removed
However any help with this would be great, this is the output I get below, when running as the user and executing the bash script.
./file_dist.sh.x ./file_dist.sh.x: Operation not permitted Killed
Thanks in advanced!
@Nick777818, do a strace
as normal user and post back what is not permitted.
@suntong
Please see below. (I am a first time poster not sure if all this noise is required).
ff-dist@ld1559e001:/opt/scripts$ strace bash file_dist.sh.x execve("/bin/bash", ["bash", "file_dist.sh.x"], [/ 25 vars /]) = 0 brk(0) = 0xd8a000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5bedc53000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=93131, ...}) = 0 mmap(NULL, 93131, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5bedc3c000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libtinfo.so.5", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\303\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=167096, ...}) = 0 mmap(NULL, 2264288, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5bed80a000 mprotect(0x7f5bed82f000, 2093056, PROT_NONE) = 0 mmap(0x7f5beda2e000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x24000) = 0x7f5beda2e000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\16\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0644, st_size=14664, ...}) = 0 mmap(NULL, 2109744, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5bed606000 mprotect(0x7f5bed609000, 2093056, PROT_NONE) = 0 mmap(0x7f5bed808000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f5bed808000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P \2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1840928, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5bedc3b000 mmap(NULL, 3949248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5bed241000 mprotect(0x7f5bed3fb000, 2097152, PROT_NONE) = 0 mmap(0x7f5bed5fb000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x7f5bed5fb000 mmap(0x7f5bed601000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f5bed601000 close(3) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5bedc39000 arch_prctl(ARCH_SET_FS, 0x7f5bedc39740) = 0 mprotect(0x7f5bed5fb000, 16384, PROT_READ) = 0 mprotect(0x7f5bed808000, 4096, PROT_READ) = 0 mprotect(0x7f5beda2e000, 16384, PROT_READ) = 0 mprotect(0x6ef000, 4096, PROT_READ) = 0 mprotect(0x7f5bedc55000, 4096, PROT_READ) = 0 munmap(0x7f5bedc3c000, 93131) = 0 open("/dev/tty", O_RDWR|O_NONBLOCK) = 3 close(3) = 0 brk(0) = 0xd8a000 brk(0xd8b000) = 0xd8b000 open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=7477840, ...}) = 0 mmap(NULL, 7477840, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5becb1f000 close(3) = 0 brk(0xd8c000) = 0xd8c000 brk(0xd8d000) = 0xd8d000 getuid() = 1002 getgid() = 1002 geteuid() = 1002 getegid() = 1002 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 brk(0xd8e000) = 0xd8e000 open("/proc/meminfo", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5bedc52000 read(3, "MemTotal: 3885340 kB\nMemF"..., 1024) = 1024 close(3) = 0 munmap(0x7f5bedc52000, 4096) = 0 brk(0xd8f000) = 0xd8f000 rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f5bed277cb0}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGCHLD, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f5bed277cb0}, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f5bed277cb0}, 8) = 0 rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f5bed277cb0}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7f5bed277cb0}, {SIG_DFL, [], SA_RESTORER, 0x7f5bed277cb0}, 8) = 0 rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x7f5bed277cb0}, {SIG_DFL, [], 0}, 8) = 0 rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x7f5bed277cb0}, {SIG_DFL, [], SA_RESTORER, 0x7f5bed277cb0}, 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigaction(SIGQUIT, {SIG_IGN, [], SA_RESTORER, 0x7f5bed277cb0}, {SIG_DFL, [], SA_RESTORER, 0x7f5bed277cb0}, 8) = 0 uname({sys="Linux", node="ld1559e001.ww.lessondesk.com", ...}) = 0 brk(0xd90000) = 0xd90000 brk(0xd91000) = 0xd91000 stat("/opt/scripts", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 getpid() = 3175 open("/usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=26258, ...}) = 0 mmap(NULL, 26258, PROT_READ, MAP_SHARED, 3, 0) = 0x7f5bedc4c000 close(3) = 0 brk(0xd92000) = 0xd92000 getppid() = 3172 stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat("/usr/local/sbin/bash", 0x7ffdaa523500) = -1 ENOENT (No such file or directory) stat("/usr/local/bin/bash", 0x7ffdaa523500) = -1 ENOENT (No such file or directory) stat("/usr/sbin/bash", 0x7ffdaa523500) = -1 ENOENT (No such file or directory) stat("/usr/bin/bash", 0x7ffdaa523500) = -1 ENOENT (No such file or directory) stat("/sbin/bash", 0x7ffdaa523500) = -1 ENOENT (No such file or directory) stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=1021112, ...}) = 0 stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=1021112, ...}) = 0 geteuid() = 1002 getegid() = 1002 getuid() = 1002 getgid() = 1002 access("/bin/bash", X_OK) = 0 stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=1021112, ...}) = 0 geteuid() = 1002 getegid() = 1002 getuid() = 1002 getgid() = 1002 access("/bin/bash", R_OK) = 0 stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=1021112, ...}) = 0 stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=1021112, ...}) = 0 geteuid() = 1002 getegid() = 1002 getuid() = 1002 getgid() = 1002 access("/bin/bash", X_OK) = 0 stat("/bin/bash", {st_mode=S_IFREG|0755, st_size=1021112, ...}) = 0 geteuid() = 1002 getegid() = 1002 getuid() = 1002 getgid() = 1002 access("/bin/bash", R_OK) = 0 brk(0xd93000) = 0xd93000 brk(0xd94000) = 0xd94000 getpgrp() = 3172 rt_sigaction(SIGCHLD, {0x4464c0, [], SA_RESTORER|SA_RESTART, 0x7f5bed277cb0}, {SIG_DFL, [], SA_RESTORER|SA_RESTART, 0x7f5bed277cb0}, 8) = 0 getrlimit(RLIMIT_NPROC, {rlim_cur=15032, rlim_max=15032}) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 open("file_dist.sh.x", O_RDONLY) = 3 ioctl(3, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7ffdaa5237e0) = -1 ENOTTY (Inappropriate ioctl for device) lseek(3, 0, SEEK_CUR) = 0 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\2\0>\0\1\0\0\0p\r@\0\0\0\0\0"..., 80) = 80 open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 4 fstat(4, {st_mode=S_IFREG|0644, st_size=2570, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5bedc4b000 read(4, "# Locale name alias data base.\n#"..., 4096) = 2570 brk(0xd95000) = 0xd95000 brk(0xd96000) = 0xd96000 read(4, "", 4096) = 0 close(4) = 0 munmap(0x7f5bedc4b000, 4096) = 0 open("/usr/share/locale/en_US.UTF-8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en_US.utf8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en_US/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en.UTF-8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en.utf8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale-langpack/en_US.UTF-8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale-langpack/en_US.utf8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale-langpack/en_US/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale-langpack/en.UTF-8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale-langpack/en.utf8/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale-langpack/en/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory) write(2, "file_dist.sh.x: file_dist.sh.x: "..., 59file_dist.sh.x: file_dist.sh.x: cannot execute binary file ) = 59 exit_group(126) = ? +++ exited with 126 +++ ff-dist@ld1559e001:/opt/scripts$ strace ./file_dist.sh.x execve("./file_dist.sh.x", ["./file_dist.sh.x"], [/ 25 vars /]) = 0 brk(0) = 0x18ea000 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc2ae991000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=93131, ...}) = 0 mmap(NULL, 93131, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc2ae97a000 close(3) = 0 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0P \2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1840928, ...}) = 0 mmap(NULL, 3949248, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc2ae3ac000 mprotect(0x7fc2ae566000, 2097152, PROT_NONE) = 0 mmap(0x7fc2ae766000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1ba000) = 0x7fc2ae766000 mmap(0x7fc2ae76c000, 17088, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc2ae76c000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc2ae979000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc2ae977000 arch_prctl(ARCH_SET_FS, 0x7fc2ae977740) = 0 mprotect(0x7fc2ae766000, 16384, PROT_READ) = 0 mprotect(0x601000, 4096, PROT_READ) = 0 mprotect(0x7fc2ae993000, 4096, PROT_READ) = 0 munmap(0x7fc2ae97a000, 93131) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fc2ae977a10) = 3203 wait4(3203, ./file_dist.sh.x: Operation not permitted <unfinished ...> +++ killed by SIGKILL +++ Killed
Oh, then it is definitely a new problem than the above ptrace
issue.
Open another bug rather than following up here @Nick777818 -- the wait4
Operation was not permitted.
Having the same issue with wait4 and clone randomly...
@intika , the bug in OP has been fixed so please do a strace
as normal user and post back what is not permitted. If it's the same as Nick777818's -- the wait4 Operation was not permitted. then
please open another bug rather than following up here.
UPDATE:
Please note that the bug reported here has been fixed.
If it is still happening to you, please do a
strace
as normal user and compare with the two traces posted here. If it's the same as Nick777818's -- the wait4 Operation was not permitted, or anything else,please open another bug rather than following up here.
Original question:
I got "Operation not permitted" when trying to to run "make test", like this:
$ ./match.x sh ./match.x: Operation not permitted Killed
Here are the details:
~/prj/shc-3.8.9$ make make: *\ No rule to make target
shc.c', needed by
shc'. Stop.~/prj/shc-3.8.9$ ln -s shc-3.8.9.c shc.c
~/prj/shc-3.8.9$ make cc -Wall shc.c -o shc * ¿Do you want to probe shc with a test script? * Please try... make test
~/prj/shc-3.8.9$ make test * Compiling script "match" CFLAGS="-Wall " ./shc -v -f match shc: WARNING!! Scripts of length near to (or higher than) the current System limit on "maximum size of arguments to EXEC", could comprise its binary execution. In the current System the call sysconf(_SC_ARG_MAX) returns -1 bytes and your script "match" is 336 bytes length. shc shll=sh shc [-i]=-c shc [-x]=exec '%s' "$@" shc [-l]= shc opts= shc: cc -Wall match.x.c -o match.x shc: strip match.x shc: chmod go-r match.x * Running a compiled test script! * It must show files with substring "sh" in your PATH... ./match.x sh ./match.x: Operation not permitted make: * [make_the_test] Killed
Here is my system:
DISTRIB_ID=Ubuntu DISTRIB_RELEASE=13.04 DISTRIB_CODENAME=raring DISTRIB_DESCRIPTION="Ubuntu 13.04" NAME="Ubuntu" VERSION="13.04, Raring Ringtail"
$ cat /proc/version Linux version 3.8.0-19-generic (buildd@allspice) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) ) #30-Ubuntu SMP Wed May 1 16:35:23 UTC 2013 $ uname -rsm Linux 3.8.0-19-generic x86_64
Thanks