WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Suggestion for core modification  (Read 10291 times)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11705
Re: Suggestion for core modification
« Reply #15 on: August 12, 2021, 10:36:48 AM »
Hi Roberto A. Foglietta
I did it before and it did not work either with CC and CXX. ...
I did a little poking around in the tarball.

Try this:
Code: [Select]
make menuconfig
Hit  Enter  on the  Settings  menu entry.
Scroll down to  Additional CFLAGS  and hit  Enter.
Type in the additional flags you want and hit  Enter.

Proceed with your normal build and see if it took the extra flags.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11050
Re: Suggestion for core modification
« Reply #16 on: August 12, 2021, 11:44:08 AM »
The SUID separation is a security matter. If an adversary manages to write to that conf file, or the conf file logic is buggy -> havoc.

It also avoids some bug, which I do not remember the details of. You will have to search the forum if you want to know more about that.
The only barriers that can stop you are the ones you create yourself.

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Suggestion for core modification
« Reply #17 on: August 12, 2021, 11:53:58 AM »
@curaga

Security? We are speaking about a system that by default allows sudo -s without password!  ;)

About bugs, I did not find anything searching in the forum with "SUID separation" or "busybox.conf"

Possibly, it might be the right time to rethink about it?

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11050
Re: Suggestion for core modification
« Reply #18 on: August 13, 2021, 01:37:50 AM »
You are correct that we have sudo, but having sudo as a known decision does not mean other things need to be left open.

No, the bug was serious, breaking many scripts.
The only barriers that can stop you are the ones you create yourself.

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Suggestion for core modification
« Reply #19 on: August 13, 2021, 08:58:17 AM »
No, the bug was serious, breaking many scripts.

The TinyCore Editor produce a single file busybox, I will test it. You might give it a try, also.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11705
Re: Suggestion for core modification
« Reply #20 on: August 13, 2021, 02:55:18 PM »
Hi Roberto A. Foglietta
... I wish to receive a suggestion to use -Os because I tried to add to CFLAGS but it is ignored. ...
Did you try adding  -Os  using the method I described here:
http://forum.tinycorelinux.net/index.php/topic,25191.msg160770.html#msg160770

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Suggestion for core modification
« Reply #21 on: August 13, 2021, 06:27:46 PM »
Hi Roberto A. Foglietta
... I wish to receive a suggestion to use -Os because I tried to add to CFLAGS but it is ignored. ...
Did you try adding  -Os  using the method I described here:
http://forum.tinycorelinux.net/index.php/topic,25191.msg160770.html#msg160770

Yes but I did not manage to get below 624 kb with my configuration (which is busybox + busybox.suid together)

http://forum.tinycorelinux.net/index.php/topic,25191.msg160768.html#msg160768

The possible explanation and results are reported in the post above.

What do you think about my patches: trap ERR + global $LINENO?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11705
Re: Suggestion for core modification
« Reply #22 on: August 14, 2021, 11:26:23 AM »
Hi Roberto A. Foglietta
... What do you think about my patches: trap ERR + global $LINENO?
At 14000+ lines in  ash.c , that' a lot to take in. I don't fully understand everything that's going on in  ash.c, so I'm
not in much of a position to comment on your patches. I did notice you were fighting some recursion issues, which
tends to make life more interesting. ::)

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Suggestion for core modification
« Reply #23 on: August 14, 2021, 11:38:10 AM »
I did notice you were fighting some recursion issues, which tends to make life more interesting. ::)

trap "function_that_can_fail()" ERR

As you can see, if the function called by the trap will fail the trap starts again. So recursion is not allowed.
What about trap in trap? It might happen: if the exit handler fails or the error handle exit the other trap starts.
Quite interesting job...

I have developed 5 patches that let me use the same syntax both in bash and in ash to manage the errors.
No dirty tricks anymore! :-)

I hope you will apply. Obviously, I submitted to busybox m-list, also.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11705
Re: Suggestion for core modification
« Reply #24 on: August 14, 2021, 11:49:02 AM »
Hi Roberto A. Foglietta
... I did not manage to get below 624 kb with my configuration ...
There may be a couple of other ways to reduce size:
1. Use  sstrip  instead of strip.
2. Set  Additional LDFLAGS  in  make menuconfig.

I did a small writeup on specifying which linker script the linker uses (LDFLAGS) and the impact on executable size:
http://forum.tinycorelinux.net/index.php/topic,23623.0.html

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Suggestion for core modification
« Reply #25 on: August 14, 2021, 11:26:40 PM »
Hi Roberto A. Foglietta
... I did not manage to get below 624 kb with my configuration ...
There may be a couple of other ways to reduce size:
1. Use  sstrip  instead of strip.
2. Set  Additional LDFLAGS  in  make menuconfig.

1. sstrip reduce the size by 3KB: 624KB -> 621KB
2. I have just one linker script available on ubuntu (for each architecture)


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11705
Re: Suggestion for core modification
« Reply #26 on: August 14, 2021, 11:54:33 PM »
Hi Roberto A. Foglietta
You could try copying  /usr/local/lib/ldscripts/elf_i386.xbn  and  /usr/local/lib/ldscripts/elf_x86_64.xbn  from Tinycore. They
are provided by  binutils.tcz.

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Suggestion for core modification
« Reply #27 on: August 15, 2021, 12:20:32 PM »
Hi Roberto A. Foglietta
You could try copying  /usr/local/lib/ldscripts/elf_i386.xbn  and  /usr/local/lib/ldscripts/elf_x86_64.xbn  from Tinycore. They
are provided by  binutils.tcz.

TinyCore Editor version 0.4.4 runs in TinyCore [1].
So, I can compile busybox directly into TC.

Suggested & patched single file busybox: 580 KB
Much lesser than original busybox+busybox.suid.

Thank you,
-R

[1] https://github.com/robang74/tinycore-editor/archive/refs/tags/v0.4.4.tar.gz

Choose "develop" in tinycore/tinycore.conf and follow the quick start in README.txt
« Last Edit: August 15, 2021, 12:27:43 PM by Roberto A. Foglietta »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11705
Re: Suggestion for core modification
« Reply #28 on: August 15, 2021, 12:42:42 PM »
Hi Roberto A. Foglietta
... Thank you
You are welcome. Using the other linker script shaved off 40K, very nice.

Offline Roberto A. Foglietta

  • Full Member
  • ***
  • Posts: 212
    • personal home page
Re: Suggestion for core modification
« Reply #29 on: August 18, 2021, 03:56:22 AM »
These setting in busybox config

CONFIG_FEATURE_LESS_RAW=y
CONFIG_FEATURE_LESS_ENV=y

are useful to display colors when using git. the size increase is negible