You are not logged in.

#1 2021-07-19 18:17:18

Sapiens
Member
Registered: 2021-07-05
Posts: 52

[SOLVED] Start application with additional parameters.

Hi everyone,

I want to start certain applications with the hardened malloc implementation, also using firejail.
In the past I edited the .desktop files to include the command I wanted to use to start applications. However since then I switched to a different application launcher setting and also was told that editing the .desktop files is bad style, I am looking for a more solid way.

I wanted to asked how and where to properly set things so that my application launcher 'rofi' starts applications properly. I am unsure what I am looking to do is even called which makes it hard for me to search the wiki.

firejail --env=LD_PRELOAD='/usr/lib/libhardened_malloc.so' /usr/bin/firefox

Thanks in advance!

Last edited by Sapiens (2021-07-20 19:28:06)

Offline

#2 2021-07-19 19:58:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,502
Website

Re: [SOLVED] Start application with additional parameters.

Sapiens wrote:

... and also was told that editing the .desktop files is bad style

Wearing socks with sandals is bad style.  Editting desktop files is precisely how you customize how programs are launched by any tool that uses desktop files.  Just be sure to edit versions / copies under your home directory as instructed in the wiki and not the upstream-provided files tracked by pacman.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Online

#3 2021-07-19 20:41:55

adventurer
Member
Registered: 2014-05-04
Posts: 128

Re: [SOLVED] Start application with additional parameters.

There is no need to edit the .desktop file. Just create the file firefox.local in ~/.config/firejail with the entry:

env LD_PRELOAD='/usr/lib/libhardened_malloc.so'

Offline

#4 2021-07-19 21:03:08

Sapiens
Member
Registered: 2021-07-05
Posts: 52

Re: [SOLVED] Start application with additional parameters.

Trilby wrote:

Editting desktop files is precisely how you customize how programs are launched by any tool that uses desktop files.

I see now how this is not clear from my question. I do not use a launcher that is based on .desktop files anymore.

Trilby wrote:

Just be sure to edit versions / copies under your home directory as instructed in the wiki and not the upstream-provided files tracked by pacman.

To make this clear, the files under ~/.local/share/applications are fine, right?

adventurer wrote:

There is no need to edit the .desktop file. Just create the file firefox.local in ~/.config/firejail with the entry:

env LD_PRELOAD='/usr/lib/libhardened_malloc.so'

This is a nice solution, thank you. I also just verified with

ps faux | grep 'firefox'
cat /proc/<firefoxprocessid>/environ

that firefox is correctly started with the variable! Can you please elaborate if this is a method applicable only to firejail or to all other applications as well?

Last edited by Sapiens (2021-07-19 21:05:55)

Offline

#5 2021-07-19 21:06:17

adventurer
Member
Registered: 2014-05-04
Posts: 128

Re: [SOLVED] Start application with additional parameters.

Sapiens wrote:

Can you please elaborate if this is a method applicable only to firejail or to all other applications as well?

Only to Firejail!

Offline

#6 2021-07-20 19:27:50

Sapiens
Member
Registered: 2021-07-05
Posts: 52

Re: [SOLVED] Start application with additional parameters.

adventurer wrote:
Sapiens wrote:

Can you please elaborate if this is a method applicable only to firejail or to all other applications as well?

Only to Firejail!

This will serve me well, still! I am planning to roll out firejail to a few more applications and the ones requiring firejail, are the ones that are in need of a hardened malloc as well. Thank you again for taking the time to answer my questions and help me with the transition to Arch!

Offline

#7 2021-08-30 06:25:58

IrvineHimself
Member
From: Scotland
Registered: 2016-08-21
Posts: 275

Re: [SOLVED] Start application with additional parameters.

Sapiens wrote:
firejail --env=LD_PRELOAD='/usr/lib/libhardened_malloc.so' /usr/bin/firefox

I came across this recent post while searching on a related topic. It should be noted that, (for Firefox,)  the above does nothing.

"To successfully replace Firefox memory allocator you should either use LD_PRELOAD _with_ a --disable-jemalloc build OR Firefox's replace_malloc functionality"

see also

Irvine


Mods: Please note, the post is recent, and the above is important

Edit: I believe you would add the "--diasable-jemalloc" flag here in the PKGBUILD

ac_add_options --prefix=/usr
ac_add_options --enable-release
ac_add_options --enable-hardening
ac_add_options --enable-optimize
ac_add_options --enable-rust-simd
ac_add_options --enable-linker=lld
ac_add_options --disable-elf-hack
ac_add_options --disable-bootstrap
??? <ac_add_options --diasable-jemalloc> ???

# Branding
ac_add_options 

Last edited by IrvineHimself (2021-08-30 06:35:56)


Et voilà, elle arrive. La pièce, le sous, peut-être qu'il arrive avec vous!

Offline

Board footer

Powered by FluxBB