Skip to contentSkip to conversation

Using barebox-state as library

DISCUSSION [email protected] 2 participants 2 messages Feb 10, 2021

lore
Share & tools
lore
#0 lore raw

Hey everyone,

I would like to set and read barebox-states during runtime. Unfortunately only a binary is available to be used. But because the variable names and values are from an untrusted environment, I don't like them to be passed to a shell directly. Therefore I would like to use a barebox-state library, which offers some functions, e.g. read_var, set_var, ...

An other approach would be some kind of IPC, e.g. dbus or similar, but I'm not sure if that would fit into the simplicity of the current binary.

Do you see any other possibilities so fetch and set variables from the barebox-state?

Greetings,
Marcel

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#1 lore raw

Hello Marcel,

Quoted 4 lines · On 10.02.21 09:37, [email protected] wrote:

Hey everyone,

I would like to set and read barebox-states during runtime. Unfortunately only a binary is available to be used. But because the variable names and values are from an untrusted environment, I don't like them to be passed to a shell directly.

I can't follow here. Why can't you run barebox-state with the required arguments? That's what e.g. RAUC is doing. It can listen on DBus for e.g. a mark-good and then calls barebox-state with the correct arguments. You can use standard Linux access control mechanisms, so only your daemon's group may use barebox-state.

Quoted 1 line

Therefore I would like to use a barebox-state library, which offers some functions, e.g. read_var, set_var, ...

dt-utils and barebox-sate is GPL2-licensed, so if that's acceptable for your daemon, you could take dt-utils:src/barebox-state.c and replace the argument parsing with whatever. I am not aware whether someone did that before though.

Quoted 5 lines

An other approach would be some kind of IPC, e.g. dbus or similar, but I'm not sure if that would fit into the simplicity of the current binary.

Do you see any other possibilities so fetch and set variables from the barebox-state? Greetings,
Marcel

Cheers,
Ahmad

Quoted 6 lines

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox