Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

358
Vistas
Linux: let a process fail, if it does opens a file for writing

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

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

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.

over 4 years ago · Santiago Trujillo Denunciar

0

Since the calls are honored in the order they are loaded from shared libraries, you can use LD_PRELOAD to load a custom library prior to the system libraries and hijack their execution. This is used by many network card accelerators like OpenOnload from Solarflare/Xilinx.

https://sumit-ghosh.com/articles/hijacking-library-functions-code-injection-ld-preload/

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda