-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
segmentation violation
message when passing Dockerfile
via --rootfs
option with a bad location of the Kraftfile
to kraft build
#2035
Comments
Root Cause: You Might Fix it by :
2)Gracefully Handle Missing Files: The --rootfs path is valid (even if it’s just a placeholder). if rootfsPath == "Dockerfile" && !fileExists(rootfsPath) { 3)Error Handling in Build Process: The builderKraftfileRuntime should not be initialized if the Kraftfile is missing. Instead, it should handle the error prior to attempting to prepare the build. 4)Improved Error Messaging: 5)Reproduce and Test: After applying these changes, try to reproduce the error by providing invalid paths and check that the application now exits with clear error messages instead of a crash. 6)Potential Fix in Code (Example): func (b *builderKraftfileRuntime) Prepare(ctx context.Context, args ...interface{}) error {
}
func (b *builderKraftfileRuntime) Prepare(ctx context.Context, args ...interface{}) error {
} func fileExists(path string) bool { |
Thanks, @bishnushah0909 , for the input. I'll let @craciunoiuc and @nderjung comment here, as they have a better view of the source code. |
GitHub-Fixes: unikraft#2035 Signed-off-by: Cezar Craciunoiu <[email protected]>
Describe the bug
This is a quite specific setup that results in a
segmentation violation
message being outputted bykraft build
. The command must feature:a) the
--rootfs
option with a path using theDockerfile
word; the path may be correct or notb) the
--kraftfile
/-K
option with a path to a missingKraftfile
, i.e. the path is incorectRunning the command will result in a
SIGSEGV
being delivered, and asegmentation violation
message being outputted.Steps to reproduce
Use the command below anywhere. No need for valid paths:
kraft build --rootfs ./Dockerfile -K /Kraftfile .
It will result in a
segmentation violation
message being delivered. TheDockerfile
may exist or not.Note that the
--rootfs
option must be passed a string with theDockefile
argument. These commands result in the same behavior:The path to the
Kraftfile
(the argument to the-K
option) must be an missing path. These commands result in the same behavior, as long as theKraftfile
path is incorrect:This behavior will not happen if:
A. the
Kraftfile
exists andB. the
Kraftfile
contains thespec
and therootfs
options insideFor example, this happens:
Expected behavior
The command should print out an error such as missing
Kraftfile
or badly formattedKraftfile
, instead of issuing asegmentation violation
message.Which architectures were you using or does this bug affect?
No response
Which operating system were you using or does this bug affect?
linux/debian
Relevant log output
The text was updated successfully, but these errors were encountered: