compiled linux library (.so) is executable lazarus / 66-Unix ---------------------------------------------------------------------- Чебурашка · 2023-05-11 12:35 Hello, in debian (maybe someone might want to check in other linuxes) why when compiling either under lazaruz, or lazbuild, or even doing fpc -s + ppas.sh, if the object to be produced is a .so, it results 755? Normally libraries are 644 (at least in debian). Ok there are some that can be directly executed, maybe is it for this reason? ---------------------------------------------------------------------- marcov · 2023-05-11 14:18 It's the linker that creates the file ? Maybe it is the dlltool that does the installing of the library that sets the permissions ? ---------------------------------------------------------------------- Чебурашка · 2023-05-11 16:01 Quote from: marcov on May 11, 2023, 04:18:30 pmIt's the linker that creates the file ? Maybe it is the dlltool that does the installing of the library that sets the permissions ? I found that "gcc -c" makes the output file non executable, so it is possible to have the final result not executable (despite default is yes). I will try on a alpine linux to see how fpc+lazarus do. I suspect it's a config of the deb. I will tell after. ---------------------------------------------------------------------- Fred vS · 2023-05-11 16:12 Hello. Maybe it is a executable compiled with 'hardening' and became a "executable library": https://wiki.freepascal.org/hardening ---------------------------------------------------------------------- MarkMLl · 2023-05-14 08:57 Looking at Debian 12 ("Bookworm") because of something in another thread, I note Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i -rw-r--r-- 1 root root      283 Apr 10 09:35 libc.so-rwxr-xr-x 1 root root  1922136 Apr 10 09:35 libc.so.6  where libc.so is actually a linker script. So I don't know what's really going on, but I think we need to be prepared for some traditional unix weirdness. MarkMLl ---------------------------------------------------------------------- Чебурашка · 2023-05-15 09:21 Quote from: MarkMLl on May 14, 2023, 10:57:32 amSo I don't know what's really going on, but I think we need to be prepared for some traditional unix weirdness. I found same on deb 11, also I tried to run it, here's a few nice output lines: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i user@debian-11:~$ /lib/x86_64-linux-gnu/libc-2.31.soGNU C Library (Debian GLIBC 2.31-13+deb11u5) stable release version 2.31.Copyright (C) 2020 Free Software Foundation, Inc.This is free software; see the source for copying conditions.There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR APARTICULAR PURPOSE.Compiled by GNU CC version 10.2.1 20210110.libc ABIs: UNIQUE IFUNC ABSOLUTEFor bug reporting instructions, please see:.  While libm is not executable: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i user@debian-11:~$ ls /lib/x86_64-linux-gnu/libm.* -l-rw-r--r-- 1 root root 132 Oct 14  2022 /lib/x86_64-linux-gnu/libm.a-rw-r--r-- 1 root root 140 Oct 14  2022 /lib/x86_64-linux-gnu/libm.solrwxrwxrwx 1 root root  12 Oct 14  2022 /lib/x86_64-linux-gnu/libm.so.6 -> libm-2.31.so user@debian-11:~$ ls /lib/x86_64-linux-gnu/libm-2.31.so -l-rw-r--r-- 1 root root 1321344 Oct 14  2022 /lib/x86_64-linux- gnu/libm-2.31.so  I would bet there is a logic on this, debian is very careful to these things. ---------------------------------------------------------------------- MarkMLl · 2023-05-15 10:35 Quote from: Чебурашка on May 15, 2023, 11:21:22 amI would bet there is a logic on this, debian is very careful to these things. I have an /extremely/ vague recollection that libc is executable specifically so that it can report the version of the core system- level libraries. Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i # find /lib /usr/lib -type f -name '*so.*' -ls 2> /dev/null | grep rwx | less 12846584    208 -rwxr-xr-x   1 root     root        210968 Apr 10 09:35 /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 12846588   1880 -rwxr-xr-x   1 root     root       1922136 Apr 10 09:35 /usr/lib/x86_64-linux-gnu/libc.so.6 # find /lib /usr/lib -type f -name '*so' -ls 2> /dev/null | grep rwx | less 13388759     40 -rwxr-xr-x   1 root     root        39152 Jan 22 05:37 /usr/lib/grass82/bin/v.net.iso 12848415     76 -rwxr-xr-x   1 root   root        74688 Feb 12 22:57 /usr/lib/klibc- XX6cASCB7KZyJWpIJW79y94XHBY.so  However when I do a brute-force search over the entire system I find a whole lot of stuff that I've either compiled locally (e.g. Mozilla Kompozer) or installed into a Docker container (various microcontroller and FPGA stuff) which have most if not all of their .so libraries marked executable. That obviously boils down either to multiple projects' build methodology, or to a default option in ld (or possibly install or equivalent which handled the final placement). MarkMLl ---------------------------------------------------------------------- Чебурашка · 2023-05-15 15:12 Quote from: Fred vS on May 11, 2023, 06:12:04 pmHello. Maybe it is a executable compiled with 'hardening' and became a "executable library": https://wiki.freepascal.org/hardening These are the options in project (omitting paths to unit+inc) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i /usr/bin/fpc-MObjFPC-Scghi-Cg-g-gl-gh-gt-l-vewnhibq-vm6058,3124,3123[ ... ]  so seems is not this case. ---------------------------------------------------------------------- Fred vS · 2023-05-15 15:17 May I ask what result you get if you do on console?: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $> file yourbinary ---------------------------------------------------------------------- Чебурашка · 2023-05-15 15:38 Quote from: Fred vS on May 15, 2023, 05:17:46 pmMay I ask what result you get if you do on console?: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i $> file yourbinary Sure (just renamed lib to libxyz): Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i [user@deb-9]# file libxyz-i386-linux.solibxyz-i386-linux.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped ---------------------------------------------------------------------- Fred vS · 2023-05-15 16:03 Quote from: Чебурашка on May 15, 2023, 05:38:55 pmCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i [user@deb-9]# file libxyz-i386-linux.solibxyz-i386-linux.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped  Indeed, it is not hardened ( should be "LSB pie"). So, sorry, I dont know why your library is set as 755. ---------------------------------------------------------------------- Raskaton · 2023-07-03 20:57 1. Check Project options "Miscellaneous" -> "Project is runnable" https://wiki.freepascal.org/IDE_Window:_Project_Options#Project_is_run nable 2. May be, if in IDE Compiler Options disable flag "Apply conventions" and set target as "project.so" affect this too.