strace | strace for android and binaries for most architectures

 by   ipduh C Version: Current License: Non-SPDX

kandi X-RAY | strace Summary

kandi X-RAY | strace Summary

strace is a C library. strace has no bugs, it has no vulnerabilities and it has low support. However strace has a Non-SPDX License. You can download it from GitHub.

this is strace - a diagnostic, debugging and instructional userspace utility with a traditional command-line interface for linux. it is used to monitor and tamper with interactions between processes and the linux kernel, which include system calls, signal deliveries, and changes of process state. the operation of strace is made possible by the kernel feature known as ptrace. strace is released under a berkeley-style license at the request of paul kranenburg; see the file copying for details. see the file credits for a list of authors and other contributors. see the file install for compilation and installation instructions. see the file news
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              strace has a low active ecosystem.
              It has 12 star(s) with 5 fork(s). There are 3 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 0 have been closed. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of strace is current.

            kandi-Quality Quality

              strace has 0 bugs and 0 code smells.

            kandi-Security Security

              strace has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              strace code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              strace has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              strace releases are not available. You will need to build from source code and install.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of strace
            Get all kandi verified functions for this library.

            strace Key Features

            No Key Features are available at this moment for strace.

            strace Examples and Code Snippets

            No Code Snippets are available at this moment for strace.

            Community Discussions

            QUESTION

            BPF / XDP: 'bpftool batch file' returns 'Error: reading batch file failed: Operation not permitted'
            Asked 2022-Mar-29 at 00:11

            I have a docker container with an XDP program loaded on it. I also have a batch file for the bpftool to run. When I run bpftool batch file tmp_bpftool.txt, I get Error: reading batch file failed: Operation not permitted. I am the root in the container. So, what could possibly be the problem?

            The batch file is as below: (512 updates on map 59 and 1 update on map 58)

            ...

            ANSWER

            Answered 2022-Mar-29 at 00:11

            TL;DR: Your map update works fine. The message is a bug in bpftool.

            Bpftool updates the maps just as you would expect; and then, after processing all the batch file, it checks errno. If errno is 0, it supposes that everything went fine, and it's good. If not, it prints strerror(errno) so you can see what went wrong when processing the file.

            errno being set is not due to your map updates. I'm not entirely sure of what's happening to it. The bug was seemingly introduced with commit cf9bf714523d ("tools: bpftool: Allow unprivileged users to probe features"), where we manipulate process capabilities with libcap. Having a call to cap_get_proc() in feature.c is apparently enough for the executable to pick it up and to run some checks on capabilities that are supported, or not, on the system even if we're not doing any probing. I'm observing the following calls with strace:

            Source https://stackoverflow.com/questions/71608181

            QUESTION

            Why do I get extra system calls when compiling code directly to an executable vs. compiling to an object file and then manually linking?
            Asked 2022-Mar-06 at 12:40

            I want to compile this C code with the GNU C Compiler on Ubuntu without linking any standard libraries, having only the following code execute.

            ...

            ANSWER

            Answered 2022-Mar-06 at 12:40

            I found out what is happening.

            If I compile the code with cc example.c -ffreestanding -nostartfiles -O3 -o example the compiler makes a dynamically linked executable. Dynamically linked executables have an .interp section. That is what I was seeing in my objdump -D.

            Dynamically linked executables are executing via the program interpreter and the dynamic linker. The additional system calls I saw, came from the dynamic linker. I still do not know why the executable wants to dynamically link anything in a program that does not link any libraries and wants to be freestanding.

            If you do not want the extra system calls from the dynamic linker - you should give gcc the extra -static option. The compiler does not automatically do this if there is no dynamic linking happening.

            Source https://stackoverflow.com/questions/71367486

            QUESTION

            Is it possible to trace my shell(bash, fish, zsh)?
            Asked 2022-Mar-01 at 22:44

            I am running archlinux(arcolinux distro to be specific) everything is fine but one little tiny problem which annoys me the problem is every time i open a terminal this pops us at the top of the terminal

            "Linux pengu 5.15.25-1-lts x86_64 unknown"

            I know this is a uname command with custom flags however I don't have that in my config.fish(I use fish shell(I run fish with bash i), I am aware that every time I open a my fish shell the stuff in my config.fish run, is there anything I am missing or what? here is my config.fish:

            {

            ...

            ANSWER

            Answered 2022-Mar-01 at 19:17

            strace can attach to a process using -p:

            Source https://stackoverflow.com/questions/71313211

            QUESTION

            How can I track down what is causing `go build` to take a long time?
            Asked 2022-Feb-10 at 21:11

            Running it with -v does not really tell me what the problem is. It takes about 20s before printing even a single line.

            Running it under strace outputs a lot of noise, and strace does not run on Mac OS.

            Removing dependencies to see if they are the problem would be a ridiculous amount of work.

            ...

            ANSWER

            Answered 2022-Feb-10 at 21:11

            QUESTION

            Linux: let a process fail, if it does opens a file for writing
            Asked 2022-Feb-08 at 11:49

            I would like a command-line-tool to fail if it opens a particular file for writing.

            Is there a way I can modify the environment (maybe via cgroups) of the command-line tool, so that the command/process gets (for example) "permission denied"?

            chmod a-w file does not work. The process seems to unlink() and then re-create the file.

            I know that I can watch the syscalls of a process with strace. But is there a way to alter some calls, so that the process gets a different result?

            Background: unittesting ...

            ANSWER

            Answered 2022-Jan-20 at 15:01

            strace has an option called -e inject or simply --inject which can be used to alter system calls of the tracee. (See manpage here)

            In particular, in can be combined with the -P option to only trace syscalls accessing a specified path.

            Source https://stackoverflow.com/questions/70773791

            QUESTION

            EADDRNOTAVAIL even after using IP_FREEBIND?
            Asked 2022-Feb-02 at 16:48

            I was under the impression that under Linux you could bind to a non-local address as long as you set the IP_FREEBIND socket option, but that's not the behavior I'm seeing:

            ...

            ANSWER

            Answered 2022-Feb-02 at 16:48

            Unfortunately, it seems that it is not possible to bind a raw IP socket to a non-local, non-broadcast and non-multicast address, regardless of IP_FREEBIND. Since I see inet_addr("w.x.y.z") in your strace output, I assume that this is exactly what you're trying to do and w.x.y.z is a non-local unicast address, thus your bind syscall fails.

            This seems in accordance with man 7 raw:

            A raw socket can be bound to a specific local address using the bind(2) call. If it isn't bound, all packets with the specified IP protocol are received. In addition, a raw socket can be bound to a specific network device using SO_BINDTODEVICE; see socket(7).

            Indeed, looking at the kernel source code, in raw_bind() we can see the following check:

            Source https://stackoverflow.com/questions/70329671

            QUESTION

            I compiled R from source and it doesn't find certificates
            Asked 2022-Jan-14 at 17:25

            I am deploying multiple R versions on multiple virtual desktops. I've built 3.6.3 and 4.1.2 R from source on Ubuntu 18.04.3 LTS. None of them finds the system-wide Rprofile.site file in /etc/R or the system certificates in /usr/share/ca-certificates. However R (3.4.4) installed with APT has no such problems. I used Ansible, but for the sake of this question I reproduced the deployment for one host with a shell script.

            ...

            ANSWER

            Answered 2022-Jan-14 at 17:25

            Finally I found the solution:

            Since both system has the arch and OS. I cross copied the R compiled installations between them. The R which was compiled on the problematic system, but was run on the correct one gave the warnings below after the calling of the install.packages("renv", repos="https://cran.wu.ac.at/")

            Source https://stackoverflow.com/questions/70707843

            QUESTION

            Python3 Ptrace duplicate syscalls
            Asked 2022-Jan-14 at 12:44

            I'm trying to build a simple version of starce, which shows you the first x syscalls a process made. The problem is that currently it seems like every syscall appears twice (except execve and exit_group).

            This is the code I use to get the syscalls:

            ...

            ANSWER

            Answered 2022-Jan-14 at 12:44

            After digging a bit in other threads here, I found that every syscall is supposed to appear twice, once before it was called, and another time after it was called.
            So the solution will be to simply to add the syscall to the list only once every two iterations.

            Source https://stackoverflow.com/questions/70709659

            QUESTION

            Why is Netcat throws forward host lookup failed: Unknown host while using execve in assembly?
            Asked 2021-Dec-29 at 14:12

            I have been learning buffer overflows and i am trying to execute the following command through shellcode /bin/nc -e /bin/sh -nvlp 4455. Here is my assembly code:

            ...

            ANSWER

            Answered 2021-Dec-29 at 14:12

            As you can see in strace, the execve command executes as: execve("/bin//nc", ["/bin//nc", "/bin//nc-e //bin/bash -nvlp 4455"], NULL) = 0 It seems to be taking the whole /bin//nc-e //bin/bash -nvlp 4455 as a single argument and thus thinks it's a hostname. In order to get around that, the three argv[] needed for execve() is pushed seperately. argv[]=["/bin/nc", "-e/bin/bash", "-nvlp4455"] These arguments are each pushed into edx, ecx, and ebx. since ebx needs to be /bin/nc, which was already done in the original code. we just needed to push 2nd and 3rd argv[] into ecx and edx and push it into stack. After that we just copy the whole stack into ecx, and then xor edx,edx to set edx as NULL.

            Here is the correct solution:

            Source https://stackoverflow.com/questions/70503475

            QUESTION

            AWX all jobs stop processing and hang indefinitely -- why
            Asked 2021-Dec-21 at 14:42
            Problem

            We've had a working Ansible AWX instance running on v5.0.0 for over a year, and suddenly all jobs stop working -- no output is rendered. They will start "running" but hang indefinitely without printing out any logging.

            The AWX instance is running in a docker compose container setup as defined here: https://github.com/ansible/awx/blob/5.0.0/INSTALL.md#docker-compose

            Observations

            Standard troubleshooting such as restarting of containers, host OS, etc. hasn't helped. No configuration changes in either environment.

            Upon debugging an actual playbook command, we observe that the command to run a playbook from the UI is like the below:

            ssh-agent sh -c ssh-add /tmp/awx_11021_0fmwm5uz/artifacts/11021/ssh_key_data && rm -f /tmp/awx_11021_0fmwm5uz/artifacts/11021/ssh_key_data && ansible-playbook -vvvvv -u ubuntu --become --ask-vault-pass -i /tmp/awx_11021_0fmwm5uz/tmppo7rcdqn -e @/tmp/awx_11021_0fmwm5uz/env/extravars playbook.yml

            That's broken down into three commands in sequence:

            1. ssh-agent sh -c ssh-add /tmp/awx_11021_0fmwm5uz/artifacts/11021/ssh_key_data
            2. rm -f /tmp/awx_11021_0fmwm5uz/artifacts/11021/ssh_key_data
            3. ansible-playbook -vvvvv -u ubuntu --become --ask-vault-pass -i /tmp/awx_11021_0fmwm5uz/tmppo7rcdqn -e @/tmp/awx_11021_0fmwm5uz/env/extravars playbook.yml

            You can see in part 3, the -vvvvv is the debugging argument -- however, the hang is happening on command #1. Which has nothing to do with ansible or AWX specifically, but it's not going to get us much debugging info.

            I tried doing an strace to see what is going on, but for reasons given below, it is pretty difficult to follow what it is actually hanging on. I can provide this output if it might help.

            Analysis

            So one natural question with command #1 -- what is 'ssh_key_data'?

            Well it's what we set up to be the Machine credential in AWX (an SSH key) -- it hasn't changed in a while and it works just fine when used in a direct SSH command. It's also apparently being set up by AWX as a file pipe:

            prw------- 1 root root 0 Dec 10 08:29 ssh_key_data

            Which starts to explain why it could be potentially hanging (if nothing is being read in from the other side of the pipe).

            Running a normal ansible-playbook from command line (and supplying the SSH key in a more normal way) works just fine, so we can still deploy, but only via CLI right now -- it's just AWX that is broken.

            Conclusions

            So the question then becomes "why now"? And "how to debug"? I have checked the health of awx_postgres, and verified that indeed the Machine credential is present in an expected format (in the main_credential table). I have also verified that can use ssh-agent on the awx_task container without the use of that pipe keyfile. So it really seems to be this piped file that is the problem -- but I haven't been able to glean from any logs where the other side of the pipe (sender) is supposed to be or why they aren't sending the data.

            ...

            ANSWER

            Answered 2021-Dec-13 at 04:21

            Had the same issue starting this Friday in the same timeframe as you. Turned out that Crowdstrike (falcon sensor) Agent was the culprit. I'm guessing they pushed a definition update that is breaking or blocking fifo pipes. When we stopped the CS agent, AWX started working correctly again, with no issues. See if you are running a similar security product.

            Source https://stackoverflow.com/questions/70320452

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install strace

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/ipduh/strace.git

          • CLI

            gh repo clone ipduh/strace

          • sshUrl

            git@github.com:ipduh/strace.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link