dumpable | Serialization without any serialization codes in C | Serialization library
kandi X-RAY | dumpable Summary
kandi X-RAY | dumpable Summary
dumpable - Serialization without any serialization codes in C++.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of dumpable
dumpable Key Features
dumpable Examples and Code Snippets
Community Discussions
Trending Discussions on dumpable
QUESTION
Is it possible to do the equivalent of prctl(PR_SET_DUMPABLE, 0)
, but for other process, e.g. a child process, or one that was exec
'd? The program below demonstrates that the dumpable flag is not inherited by a process that was execv
'd.
ANSWER
Answered 2019-Feb-27 at 20:02I don't want others to be able to read this process data from
/proc
. Is there some alternative way to do this?
The contents of the per-process subdirectories in /proc
are ordinarily owned by the effective uid and effective gid of the corresponding process. The only documented condition in which that's different is when the process's dumpable
attribute has a value different from 1.
The reason I want this is that I have a program which runs as a regular user and reads sensitive data (passwords) from stdin
If the program in question runs as a regular user that you can choose, then the easiest thing to do is to choose a for-purpose user with a private primary group. For the purpose of /proc
access, that should be about as good as setting the process non-dumpable or running it as root. Maybe better, if the process wants to be able to read from its own /proc
entry. This is pretty natural, too. It does not, however, serve the primary purpose of turning off the dumpable
flag -- i.e. to prevent the process from dumping core.
If the program itself is under your control, then you can simply modify it to issue an appropriate prctl()
call. I suppose that this is not your case.
Otherwise, the program cannot be modified and must be runnable by arbitrary users. According to the prctl()
documentation, there are four ways other than calling prctl()
to cause a process's dumpable
flag to be turned off:
The process's effective user or group ID is changed.
The process's filesystem user or group ID is changed (see credentials(7)).
The process executes (execve(2)) a set-user-ID or set- group-ID program, resulting in a change of either the effective user ID or the effective group ID.
The process executes (execve(2)) a program that has file capabilities (see capabilities(7)), but only if the permitted capabilities gained exceed those already permitted for the process.
These all describe situations in which the process is differently affected by access controls than ordinary processes started by the same user, which comes back around to my original suggestion of arranging for appropriate access control simply by controlling the user as which the program runs. After all, who cares if a random user runs the program and is able to retrieve secrets that they themselves entered? An issue arises only if other people can be tricked into divulging secrets to the program. But if you're considering this alternative then you've already rejected the easy option.
With the program ultimately being launched by a non-privileged user, changing its effective or filesystem credentials, even via a wrapper program, is not a viable alternative by itself. You're left, then, with making the program SUID or SGID, or assigning it capabilities that you can rely on differing from the user's normal ones. Note that the SUID / SGID target, if you go that way, does not need to be root; it just needs to be different from the user's own. This does, however, return again to having a designated identity for the program to run as.
The capabilites option requires your system to support capabilities, of course. If it doesn't then SUID / SGID is your only remaining option. Both of these are controlled by attributes attached to the program binary in the filesystem, so they do not require you to modify the program itself.
QUESTION
I try to implement a proc_macro Dump
, which is similar to serdes Serialize
.
For this purpose I have a crate foo
which contains my "primitive" structs (P1
and P2
in this case) which should only be dumpable.
Next I do have a foo_derive
crate which contains the procedural macro itself.
Because I want to support multiple formats I have a third crate foo_dump
which contains the trait definition of Dump
(e.g. this struct can be dumped) and Dumper
(this is something the backend should implement).
Very straight forward until this point.
When I now want to compile it, I get this error:
...ANSWER
Answered 2019-Jan-08 at 12:23Thanks to @Boiethious comment and his help in chat I was able to come up with a solution, which involes introducing a new crate foo_core
which contains the structs P1
and P2
.
So what I did was:
- Removing
P1
andP2
fromfoo
and putting them intofoo_core
- Removing the dependency
foo_dump
fromfoo_derive
so it only depends onsyn
andquote
anymore - Adding
foo_core
as a dependency infoo
andfoo_dump
- Adding the dependency
foo_dump
tofoo
(you can see the full list of changes in the git history).
The final dependency chain now looks like this:
QUESTION
I have this small program:
...ANSWER
Answered 2017-Oct-23 at 20:26Any suid process will default to have its /proc/self
directory owned by root for security reasons (to prevent users from inducing a core dump and inspecting its memory for valuable info).
You can set the owner after a suid
by manually making the process dumpable with the prctl PR_SET_DUMPABLE
.
Here's proc(5)
, containing a description of what's going on and how to affect it:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install dumpable
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page