Skip to content

Commit

Permalink
8293232: Fix race condition in pkcs11 SessionManager
Browse files Browse the repository at this point in the history
Backport-of: 67f31bb90b62fafc71e18c4c10e0f7e1b6896dc4
  • Loading branch information
zzambers authored and Paul Hohensee committed Mar 13, 2023
1 parent e80528b commit 939741c
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -207,7 +207,12 @@ void demoteObjSession(Session session) {
// will be added to correct pool on release, nothing to do now
return;
}
opSessions.release(session);
// Objects could have been added to this session by other thread between
// check in Session.removeObject method and objSessions.remove call
// higher. Therefore releaseSession method, which performs additional
// check for objects, is used here to avoid placing this session
// in wrong pool due to race condition.
releaseSession(session);
}

private Session openSession() throws PKCS11Exception {
Expand Down

3 comments on commit 939741c

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@zzambers
Copy link
Contributor Author

Choose a reason for hiding this comment

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

/backport jdk8u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 939741c Mar 13, 2023

Choose a reason for hiding this comment

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

@zzambers Could not automatically backport 939741c0 to openjdk/jdk8u-dev due to conflicts in the following files:

  • jdk/src/share/classes/sun/security/pkcs11/SessionManager.java

Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk8u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.

# Fetch the up-to-date version of the target branch
$ git fetch --no-tags https://git.openjdk.org/jdk8u-dev master:master

# Check out the target branch and create your own branch to backport
$ git checkout master
$ git checkout -b zzambers-backport-939741c0

# Fetch the commit you want to backport
$ git fetch --no-tags https://git.openjdk.org/jdk11u-dev 939741c0a0a4a5ce2c68d14b15e1f42563bc653d

# Backport the commit
$ git cherry-pick --no-commit 939741c0a0a4a5ce2c68d14b15e1f42563bc653d
# Resolve conflicts now

# Commit the files you have modified
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport 939741c0a0a4a5ce2c68d14b15e1f42563bc653d'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk8u-dev with the title Backport 939741c0a0a4a5ce2c68d14b15e1f42563bc653d.

Please sign in to comment.