Code Monkey home page Code Monkey logo

Comments (3)

catb0t avatar catb0t commented on August 28, 2024

I'm not intimately familiar with shc (or FreeBSD, lol) but I assume it stats itself, its directory, or some character device like /dev/null

Missing a system call name is kind of interesting though, I guess it's likely that shc compiled a call to libc's stat wrapper for the FBSD system call and that name was resolved differently, at a different offset, in a different shared library, etc etc by the ELF interpreter on the minimal system

(that capital letter in Stat is kind of interesting, i hope that's an artifact and not a problem)

if you have a C compiler on the target system, can you compile and run a small program like this? (it works on Linux, hopefully on FreeBSD)

#include <sys/stat.h>
#include <unistd.h>
#include <sys/syscall.h>
#include <errno.h> 
#include <stdio.h>

int main (int argc, char** argv) {
  struct stat s;
  if (stat(argv[0], &s)) { 
    perror("stat #1");
    return 1;
  }
  if (syscall(SYS_stat, argv[0], &s)) { 
    perror("stat #2");
    return 1;
  }
}

if it compiles and runs and file ./stat says dynamically linked then the problem is a version or address mismatch for the symbol and / or library that loads the stat symbol between your two systems, and you might have to force static linking when shc compiles.

(if it attempted to actually compile a call to a symbol named stat@FBSD_15 or something, then it really is a version mismatch)

from shc.

intika avatar intika commented on August 28, 2024

Can you test with the last version with the flag 'H'
Also compile your bash without any additional flag and try again
Also with the same unprotected binary, can you run strace your-binary and report back

from shc.

SMIncBrett avatar SMIncBrett commented on August 28, 2024

Yes, this was a user error on my part. Once I ran with -r this issue disappeared.

from shc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.