Skip to content

Fix access denied when killing stopped container#1447

Merged
dcantah merged 1 commit intomicrosoft:masterfrom
gabriel-samfira:fix-access-denied-error-on-kill
Jul 8, 2022
Merged

Fix access denied when killing stopped container#1447
dcantah merged 1 commit intomicrosoft:masterfrom
gabriel-samfira:fix-access-denied-error-on-kill

Conversation

@gabriel-samfira
Copy link
Copy Markdown
Contributor

This change fixes access denied errors when killing an already stopped host process container.

This change also uses errors.Is() to compare errors in various functions of the hcs error package. This allows error wrapping while still properly validating that a wrapped error is of a certain type.

Signed-off-by: Gabriel Adrian Samfira [email protected]

@gabriel-samfira gabriel-samfira requested a review from a team as a code owner July 1, 2022 15:53
Comment thread internal/jobcontainers/process.go Outdated
Comment thread internal/jobcontainers/process.go Outdated
@gabriel-samfira gabriel-samfira force-pushed the fix-access-denied-error-on-kill branch from 4930b4c to 071d095 Compare July 1, 2022 16:19
This change fixes access denied errors when killing an already stopped
host process container.

This change also uses errors.Is() to compare errors in various functions
of the hcs error package. This allows error wrapping while still
properly validating that a wrapped error is of a certain type.

Signed-off-by: Gabriel Adrian Samfira <[email protected]>
@gabriel-samfira gabriel-samfira force-pushed the fix-access-denied-error-on-kill branch from 071d095 to 9e72a85 Compare July 1, 2022 16:45
Copy link
Copy Markdown
Contributor

@helsaawy helsaawy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are switching over to go1.13 style errors, should we also add Is( implementations as well so we can get rid of the getInnerError in all the Is<Error>( functions?

func (e *HcsError) Is(target error) bool {
    target = getInnerError
    return errors.Is(e.Err, target)
}

@dcantah
Copy link
Copy Markdown
Contributor

dcantah commented Jul 7, 2022

@helsaawy Good idea.. wanna take this up as a follow-up?

@helsaawy
Copy link
Copy Markdown
Contributor

helsaawy commented Jul 8, 2022

@helsaawy Good idea.. wanna take this up as a follow-up?

Am I being voluntold? 😅

@dcantah
Copy link
Copy Markdown
Contributor

dcantah commented Jul 8, 2022

LOL possibly.. 😆

@dcantah dcantah merged commit a6e4876 into microsoft:master Jul 8, 2022
kiashok pushed a commit to kiashok/hcsshim that referenced this pull request Jul 11, 2022
This change fixes access denied errors when killing an already stopped
host process container.

This change also uses errors.Is() to compare errors in various functions
of the hcs error package. This allows error wrapping while still
properly validating that a wrapped error is of a certain type.

Signed-off-by: Gabriel Adrian Samfira <[email protected]>
anmaxvl pushed a commit that referenced this pull request Feb 7, 2023
princepereira pushed a commit to princepereira/hcsshim that referenced this pull request Aug 29, 2024
This change fixes access denied errors when killing an already stopped
host process container.

This change also uses errors.Is() to compare errors in various functions
of the hcs error package. This allows error wrapping while still
properly validating that a wrapped error is of a certain type.

Signed-off-by: Gabriel Adrian Samfira <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants