Skip to contentSkip to conversation

tpm: fix locality and power saving handling

PATCH Applied Tomas Winkler 2 participants 13 messages Feb 14, 2018 – Mar 23, 2018

Subsystems (3)

v3 of 7 Applied Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v3 cover tpm: fix locality and power saving handling

Devices that support locality has failed to transmit due to reserved order of locality request and cmdReady/goIdle handshake. The cmdReady/goIdle should be performed on the requested locality.

The first patch corrects the locality and power-save order, adds required polling for completion of goIdle and locality relinquish.

The second patch removes cmdRead/goIdle handshake from runtime_pm as it's rather a part of TPM2 protocol then true device power management, and on device it's no longer optional.

Tomas Winkler (2):
tpm: cmd_ready command can be issued only after granting locality
tpm: separate cmd_ready/go_idle from runtime_pm

 drivers/char/tpm/tpm-interface.c |  28 +++++--
 drivers/char/tpm/tpm_crb.c       | 157 +++++++++++++++++++++++----------------
 drivers/char/tpm/tpm_tis_core.c  |   4 +-
 include/linux/tpm.h              |   4 +-
 4 files changed, 122 insertions(+), 71 deletions(-)
Signature · 6 lines
2.14.3

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#1 lore raw

PATCH v3 1/2 tpm: cmd_ready command can be issued only after granting locality

The correct sequence is to first request locality and only after that perform cmd_ready handshake, otherwise the hardware will drop the subsequent message as from the device point of view the cmd_ready handshake wasn't performed. Symmetrically locality has to be relinquished only after going idle handshake has completed, this requires that go_idle has to poll for the completion and as well locality relinquish has to poll for completion so it is not overridden in back to back commands flow.

The issue is only visible on devices that support multiple localities.

---
V2: poll for locality relinquish completion
V3: 1. Print error message upon locality relinquish failure
2. Don't override rc code on error path with locality relinquish return value.

 drivers/char/tpm/tpm-interface.c |  21 +++++---
 drivers/char/tpm/tpm_crb.c       | 108 +++++++++++++++++++++++++++------------
 drivers/char/tpm/tpm_tis_core.c  |   4 +-
 include/linux/tpm.h              |   2 +-
 4 files changed, 94 insertions(+), 41 deletions(-)
drivers/char/tpm/tpm-interface.c +15 -6
index 9e80a953d693..f47b29c1a963 100644
@@ -422,8 +422,6 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
 	if (!(flags & TPM_TRANSMIT_UNLOCKED))
 		mutex_lock(&chip->tpm_mutex);
 
-	if (chip->dev.parent)
-		pm_runtime_get_sync(chip->dev.parent);
 
 	if (chip->ops->clk_enable != NULL)
 		chip->ops->clk_enable(chip, true);
@@ -439,6 +437,9 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
 		chip->locality = rc;
 	}
 
+	if (chip->dev.parent)
+		pm_runtime_get_sync(chip->dev.parent);
+
 	rc = tpm2_prepare_space(chip, space, ordinal, buf);
 	if (rc)
 		goto out;
@@ -499,17 +500,25 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
 	rc = tpm2_commit_space(chip, space, ordinal, buf, &len);
 
 out:
+	if (chip->dev.parent)
+		pm_runtime_put_sync(chip->dev.parent);
+
 	if (need_locality && chip->ops->relinquish_locality) {
-		chip->ops->relinquish_locality(chip, chip->locality);
+		/* this coud be on error path, don't override error code */
+		int l_rc = chip->ops->relinquish_locality(chip, chip->locality);
+
+		if (l_rc) {
+			dev_err(&chip->dev, "%s: relinquish_locality: error %d\n",
+				__func__, l_rc);
+			rc = l_rc;
+		}
 		chip->locality = -1;
 	}
+
 out_no_locality:
 	if (chip->ops->clk_enable != NULL)
 		chip->ops->clk_enable(chip, false);
 
-	if (chip->dev.parent)
-		pm_runtime_put_sync(chip->dev.parent);
-
 	if (!(flags & TPM_TRANSMIT_UNLOCKED))
 		mutex_unlock(&chip->tpm_mutex);
 	return rc ? rc : len;
drivers/char/tpm/tpm_crb.c +75 -33

192 lines not on this page · raw message

drivers/char/tpm/tpm_tis_core.c +3 -1
index 183a5f54d875..a22b12adbdfd 100644
@@ -143,11 +143,13 @@ static bool check_locality(struct tpm_chip *chip, int l)
 	return false;
 }
 
-static void release_locality(struct tpm_chip *chip, int l)
+static int release_locality(struct tpm_chip *chip, int l)
 {
 	struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
 
 	tpm_tis_write8(priv, TPM_ACCESS(l), TPM_ACCESS_ACTIVE_LOCALITY);
+
+	return 0;
 }
 
 static int request_locality(struct tpm_chip *chip, int l)
include/linux/tpm.h +1 -1
index bcdd3790e94d..06639fb6ab85 100644
@@ -44,7 +44,7 @@ struct tpm_class_ops {
 	bool (*update_timeouts)(struct tpm_chip *chip,
 				unsigned long *timeout_cap);
 	int (*request_locality)(struct tpm_chip *chip, int loc);
-	void (*relinquish_locality)(struct tpm_chip *chip, int loc);
+	int (*relinquish_locality)(struct tpm_chip *chip, int loc);
 	void (*clk_enable)(struct tpm_chip *chip, bool value);
 };
 
Signature · 6 lines
2.14.3

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

Re: [PATCH 1/2 v3] tpm: cmd_ready command can be issued only after granting locality

drivers/char/tpm/tpm-interface.c ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space, · line 508

Quoted 4 lines · Tomas Winkler
drivers/char/tpm/tpm-interface.c +2 -1
 	if (need_locality && chip->ops->relinquish_locality) {
-		chip->ops->relinquish_locality(chip, chip->locality);
+		/* this coud be on error path, don't override error code */
+		int l_rc = chip->ops->relinquish_locality(chip, chip->locality);

All local variable declarations must be in the beginning of the function.

drivers/char/tpm/tpm-interface.c ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space, · line 514

Quoted 6 lines
drivers/char/tpm/tpm-interface.c +6 -0
+
+		if (l_rc) {
+			dev_err(&chip->dev, "%s: relinquish_locality: error %d\n",
+				__func__, l_rc);
+			rc = l_rc;
+		}

Your comment about not overriding error code is incorrect.

The value of 'rc' should be never overridden, which kind of supports to "just print" behavior that we had for a locality error.

Is your fix somehow dependent on changing relinquish_locality() behavior? If not, please remove this change. If you want to contribute such behavioral change, you should make a separate patch of it.

Now it's like a trojan horse bundled inside a bug fix.

/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

RE: [PATCH 1/2 v3] tpm: cmd_ready command can be issued only after granting locality

Quoted 8 lines · Tomas Winkler

drivers/char/tpm/tpm-interface.c ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space, · line 508

Quoted 4 lines
drivers/char/tpm/tpm-interface.c +2 -1
 	if (need_locality && chip->ops->relinquish_locality) {
-		chip->ops->relinquish_locality(chip, chip->locality);
+		/* this coud be on error path, don't override error code */
+		int l_rc = chip->ops->relinquish_locality(chip, chip->locality);

All local variable declarations must be in the beginning of the function.

Who says?

Quoted 10 lines

drivers/char/tpm/tpm-interface.c ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,

Quoted 4 lines
drivers/char/tpm/tpm-interface.c +3 -0
+
+		if (l_rc) {
+			dev_err(&chip->dev, "%s: relinquish_locality: error

%d\n",

drivers/char/tpm/tpm-interface.c ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space, · line 514

Quoted 3 lines
drivers/char/tpm/tpm-interface.c +3 -0
+				__func__, l_rc);
+			rc = l_rc;
+		}

Your comment about not overriding error code is incorrect.

Please explain?

Quoted 2 lines

The value of 'rc' should be never overridden, which kind of supports to "just print" behavior that we had for a locality error.

You are not consistent, you've agreed with propagating it to user space. The error will be propagated in case of an error in locality relinquish the device is pretty much in non functional state and provious errors do not matter much, but rc value won't be modified if locality_reliquish succeeds.

Quoted 3 lines

Is your fix somehow dependent on changing relinquish_locality() behavior? If not, please remove this change. If you want to contribute such behavioral change, you should make a separate patch of it.

The issue is structural, this is required just because the relinquish locality is inside the error path handling.

Quoted 1 line

Now it's like a trojan horse bundled inside a bug fix.

Not sure I understand your methaphore.
Please review again.

Thanks
Tomas

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH 1/2 v3] tpm: cmd_ready command can be issued only after granting locality

Quoted 4 lines · Tomas
Quoted 2 lines

All local variable declarations must be in the beginning of the function.

Who says?

It is coherent how we have everything else.

It is much easier to see the stack allocation this way when the allocation is only done in the beginning of each function. If you really need to do such pattern, then it would be a better idea to consider an additional helper function.

Quoted 3 lines
Quoted 1 line

Your comment about not overriding error code is incorrect.

Please explain?

'l_rc' overrides 'rc' in the case when both are non-zero.

Quoted 9 lines
Quoted 3 lines

The value of 'rc' should be never overridden, which kind of supports to "just
print" behavior that we had for a locality error.

You are not consistent, you've agreed with propagating it to user space. The error will be propagated in case of an error in locality relinquish the device is pretty much in non functional state and provious errors do not matter much, but rc value won't be modified if locality_reliquish succeeds.

Well, sometimes you fail to notice things and I failed to notice the collision above. The commit message does not describe why 'l_rc' overrides 'rc' in the case when both are non-zero. What was the reasoning, which made you end up with this priority order? Why is 'l_rc' more important than 'rc'?

My take is that does it really make sense have this change as part of a high priority bug fix that should be as localized as possible? Seems like a non-trivial problem by itself.

/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

RE: [PATCH 1/2 v3] tpm: cmd_ready command can be issued only after granting locality

Quoted 8 lines · Tomas
Quoted 4 lines
Quoted 2 lines

All local variable declarations must be in the beginning of the function.

Who says?

It is coherent how we have everything else.

I will have to care about its value out of the scope where the variable existence is not relevant.

Quoted 4 lines

It is much easier to see the stack allocation this way when the allocation is only done in the beginning of each function. If you really need to do such pattern, then it would be a better idea to consider an additional helper function.

The code block decides whether to modify 'rc'. I'm not sure if additional function will make
the code cleaner, on the opposite.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Your comment about not overriding error code is incorrect.

Please explain?

'l_rc' overrides 'rc' in the case when both are non-zero.

Yes, that's been the intention, we cannot return more than one value. l_rc if set it has hire priority.

Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

The value of 'rc' should be never overridden, which kind of supports to "just print" behavior that we had for a locality error.

You are not consistent, you've agreed with propagating it to user space. The error will be propagated in case of an error in locality relinquish the device is pretty much in non functional state and provious errors do not matter much, but rc value won't be modified if locality_reliquish succeeds.

Quoted 5 lines

Well, sometimes you fail to notice things and I failed to notice the collision above. The commit message does not describe why 'l_rc'
overrides 'rc' in the case when both are non-zero. What was the reasoning, which made you end up with this priority order? Why is 'l_rc' more important than 'rc'?

Because, it's fatal. I'm not sure it's matter much what the previous error was, it cannot be recovered That's my understanding of this flow.

Quoted 3 lines

My take is that does it really make sense have this change as part of a high priority bug fix that should be as localized as possible?
Seems like a non-trivial problem by itself.

Yes, the issue here is that also an error path can fail. Now what is the correct return value..

In any case, in order to resolve this dispute, I will post a version when the error is just prints out, Once, however fatal the error is, it's very unlikely that it will happen.
Second the driver will find the device not responding in a subsequent command.

Not perfect, but at least we will have functional driver.

Thanks
Tomas

????{.n?+???????+%?????????w??{.n?+????{??????????v?^?)????w*jg??????????j????G?????? ???j:+v???w?j?m????????w?????f???h?????????

#6 lore raw

Re: [PATCH 1/2 v3] tpm: cmd_ready command can be issued only after granting locality

Quoted 52 lines · Tomas
Quoted 8 lines · Tomas
Quoted 4 lines
Quoted 2 lines

All local variable declarations must be in the beginning of the function.

Who says?

It is coherent how we have everything else.

I will have to care about its value out of the scope where the variable existence is not relevant.

Quoted 4 lines

It is much easier to see the stack allocation this way when the allocation is only done in the beginning of each function. If you really need to do such pattern, then it would be a better idea to consider an additional helper function.

The code block decides whether to modify 'rc'. I'm not sure if additional function will make
the code cleaner, on the opposite.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Your comment about not overriding error code is incorrect.

Please explain?

'l_rc' overrides 'rc' in the case when both are non-zero.

Yes, that's been the intention, we cannot return more than one value. l_rc if set it has hire priority.

Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

The value of 'rc' should be never overridden, which kind of supports to "just print" behavior that we had for a locality error.

You are not consistent, you've agreed with propagating it to user space. The error will be propagated in case of an error in locality relinquish the device is pretty much in non functional state and provious errors do not matter much, but rc value won't be modified if locality_reliquish succeeds.

Quoted 5 lines

Well, sometimes you fail to notice things and I failed to notice the collision above. The commit message does not describe why 'l_rc'
overrides 'rc' in the case when both are non-zero. What was the reasoning, which made you end up with this priority order? Why is 'l_rc' more important than 'rc'?

Because, it's fatal. I'm not sure it's matter much what the previous error was, it cannot be recovered That's my understanding of this flow.

Quoted 3 lines

My take is that does it really make sense have this change as part of a high priority bug fix that should be as localized as possible?
Seems like a non-trivial problem by itself.

Yes, the issue here is that also an error path can fail. Now what is the correct return value..

Quoted 9 lines

In any case, in order to resolve this dispute, I will post a version when the error is just prints out, Once, however fatal the error is, it's very unlikely that it will happen.
Second the driver will find the device not responding in a subsequent command.

Not perfect, but at least we will have functional driver.

Thanks
Tomas

Please add my tested by to next version. Thanks.

/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Tested-by
#7 lore raw

Re: [PATCH 1/2 v3] tpm: cmd_ready command can be issued only after granting locality

In reply to Jarkko Sakkinen
Quoted 25 lines · Jarkko Sakkinen
Quoted 7 lines · Tomas Winkler
(quoted diff) +0 -1
 	if (need_locality && chip->ops->relinquish_locality) {
-		chip->ops->relinquish_locality(chip, chip-
Quoted 1 line

locality);

(quoted diff) +1 -0
+		/* this coud be on error path, don't override

error code */

(quoted diff) +1 -0
+		int l_rc = chip->ops->relinquish_locality(chip,

chip->locality);

All local variable declarations must be in the beginning of the function.

drivers/char/tpm/tpm-interface.c ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space, · line 514

Quoted 7 lines
drivers/char/tpm/tpm-interface.c +3 -0
+
+		if (l_rc) {
+			dev_err(&chip->dev, "%s:

relinquish_locality: error %d\n",

drivers/char/tpm/tpm-interface.c +3 -0
+				__func__, l_rc);
+			rc = l_rc;
+		}

Your comment about not overriding error code is incorrect.

The value of 'rc' should be never overridden, which kind of supports to "just print" behavior that we had for a locality error.

Quoted 6 lines

Is your fix somehow dependent on changing relinquish_locality() behavior? If not, please remove this change. If you want to contribute
such behavioral change, you should make a separate patch of it.

Now it's like a trojan horse bundled inside a bug fix.

[And while doing this noticed a flaw in my test suite:
https://github.com/jsakkine-intel/tpm2-scripts/issues/3]

/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

PATCH v3 2/2 tpm: separate cmd_ready/go_idle from runtime_pm

In reply to Tomas Winkler

We cannot use go_idle cmd_ready commands via runtime_pm handles as with the introduction of localities this is no longer an optional feature, while runtime pm can be not enabled.
Though cmd_ready/go_idle provides power saving feature, it's also part of TPM2 protocol and should be called explicitly.
This patch exposes cmd_read/go_idle via tpm class ops and removes runtime pm support as it is not used by any driver.

---
V2: resent
V3: resent

 drivers/char/tpm/tpm-interface.c | 15 ++++++---
 drivers/char/tpm/tpm_crb.c       | 69 +++++++++++++++++-----------------------
 include/linux/tpm.h              |  2 ++
 3 files changed, 42 insertions(+), 44 deletions(-)
drivers/char/tpm/tpm-interface.c +10 -5
index f47b29c1a963..0b6c9641df56 100644
@@ -29,7 +29,6 @@
 #include <linux/mutex.h>
 #include <linux/spinlock.h>
 #include <linux/freezer.h>
-#include <linux/pm_runtime.h>
 #include <linux/tpm_eventlog.h>
 
 #include "tpm.h"
@@ -437,8 +436,11 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
 		chip->locality = rc;
 	}
 
-	if (chip->dev.parent)
-		pm_runtime_get_sync(chip->dev.parent);
+	if (chip->ops->cmd_ready) {
+		rc = chip->ops->cmd_ready(chip);
+		if (rc)
+			goto out;
+	}
 
 	rc = tpm2_prepare_space(chip, space, ordinal, buf);
 	if (rc)
@@ -500,8 +502,11 @@ ssize_t tpm_transmit(struct tpm_chip *chip, struct tpm_space *space,
 	rc = tpm2_commit_space(chip, space, ordinal, buf, &len);
 
 out:
-	if (chip->dev.parent)
-		pm_runtime_put_sync(chip->dev.parent);
+	if (chip->ops->go_idle) {
+		rc = chip->ops->go_idle(chip);
+		if (rc)
+			goto out;
+	}
 
 	if (need_locality && chip->ops->relinquish_locality) {
 		/* this coud be on error path, don't override error code */
drivers/char/tpm/tpm_crb.c +30 -39

158 lines not on this page · raw message

include/linux/tpm.h +2 -0
index 06639fb6ab85..8eb5e5ebe136 100644
@@ -43,6 +43,8 @@ struct tpm_class_ops {
 	u8 (*status) (struct tpm_chip *chip);
 	bool (*update_timeouts)(struct tpm_chip *chip,
 				unsigned long *timeout_cap);
+	int (*go_idle)(struct tpm_chip *chip);
+	int (*cmd_ready)(struct tpm_chip *chip);
 	int (*request_locality)(struct tpm_chip *chip, int loc);
 	int (*relinquish_locality)(struct tpm_chip *chip, int loc);
 	void (*clk_enable)(struct tpm_chip *chip, bool value);
Signature · 6 lines
2.14.3

--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by on v3 2/2
#9 lore raw

Re: [PATCH 2/2 v3] tpm: separate cmd_ready/go_idle from runtime_pm

Quoted 8 lines · Tomas Winkler

We cannot use go_idle cmd_ready commands via runtime_pm handles as with the introduction of localities this is no longer an optional feature, while runtime pm can be not enabled.
Though cmd_ready/go_idle provides power saving feature, it's also part of TPM2 protocol and should be called explicitly.
This patch exposes cmd_read/go_idle via tpm class ops and removes runtime pm support as it is not used by any driver.

Quoted 4 lines

---
V2: resent
V3: resent

Only the cover letter needs a backlog but the code change looks good to me.

/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Tested-by
#10 lore raw

Re: [PATCH 2/2 v3] tpm: separate cmd_ready/go_idle from runtime_pm

Quoted 16 lines · Jarkko Sakkinen
Quoted 10 lines · Tomas Winkler

We cannot use go_idle cmd_ready commands via runtime_pm handles as with the introduction of localities this is no longer an optional
feature, while runtime pm can be not enabled.
Though cmd_ready/go_idle provides power saving feature, it's also part of
TPM2 protocol and should be called explicitly.
This patch exposes cmd_read/go_idle via tpm class ops and removes runtime pm support as it is not used by any driver.

Quoted 4 lines

---
V2: resent
V3: resent

Quoted 4 lines

Only the cover letter needs a backlog but the code change looks good to me.

/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw

Re: [PATCH 2/2 v3] tpm: separate cmd_ready/go_idle from runtime_pm

Quoted 17 lines · Jarkko Sakkinen
Quoted 16 lines · Jarkko Sakkinen
Quoted 14 lines · Tomas Winkler

We cannot use go_idle cmd_ready commands via runtime_pm handles as with the introduction of localities this is no longer an optional
feature, while runtime pm can be not enabled.
Though cmd_ready/go_idle provides power saving feature, it's also part of
TPM2 protocol and should be called explicitly.
This patch exposes cmd_read/go_idle via tpm class ops and removes runtime pm support as it is not used by any driver.

---
V2: resent
V3: resent

Quoted 8 lines
Quoted 4 lines

Only the cover letter needs a backlog but the code change looks good to me.

/Jarkko

Applied.

/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#12 lore raw

Re: [PATCH 2/2 v3] tpm: separate cmd_ready/go_idle from runtime_pm

Quoted 23 lines · Jarkko Sakkinen
Quoted 22 lines · Jarkko Sakkinen
Quoted 20 lines · Jarkko Sakkinen
Quoted 10 lines · Tomas Winkler

We cannot use go_idle cmd_ready commands via runtime_pm handles as with the introduction of localities this is no longer an optional
feature, while runtime pm can be not enabled.
Though cmd_ready/go_idle provides power saving feature, it's also part of
TPM2 protocol and should be called explicitly.
This patch exposes cmd_read/go_idle via tpm class ops and removes runtime pm support as it is not used by any driver.

Quoted 4 lines

---
V2: resent
V3: resent

Only the cover letter needs a backlog but the code change looks good to me.

Quoted 7 lines
Quoted 3 lines

/Jarkko

Applied.

/Jarkko

This commit breaks my smoke tests on Kabylake [1] so I need to drop it. The bug fix for locality works without any issues.

[1]

$ python -m unittest -v tpm2_smoke
test_seal_with_auth (tpm2_smoke.SmokeTest) ... ok
test_seal_with_policy (tpm2_smoke.SmokeTest) ... ok
test_seal_with_too_long_auth (tpm2_smoke.SmokeTest) ... ok
test_too_short_cmd (tpm2_smoke.SmokeTest) ... ok
test_unseal_with_wrong_auth (tpm2_smoke.SmokeTest) ... ok
test_unseal_with_wrong_policy (tpm2_smoke.SmokeTest) ... ok
test_flush_context (tpm2_smoke.SpaceTest) ... ERROR
test_get_handles (tpm2_smoke.SpaceTest) ... ERROR
test_invalid_cc (tpm2_smoke.SpaceTest) ... ok
test_make_two_spaces (tpm2_smoke.SpaceTest) ... ERROR

======================================================================
ERROR: test_flush_context (tpm2_smoke.SpaceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tpm2_smoke.py", line 185, in test_flush_context
space1.flush_context(root1)
File "tpm2.py", line 517, in flush_context
self.send_cmd(cmd)
File "tpm2.py", line 378, in send_cmd
raise ProtocolError(cc, rc)
ProtocolError: TPM_RC_UNKNOWN: cc=0x00000165, rc=0x00000165

======================================================================
ERROR: test_get_handles (tpm2_smoke.SpaceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tpm2_smoke.py", line 195, in test_get_handles
space2.create_root_key()
File "tpm2.py", line 562, in create_root_key

    return struct.unpack('>I', self.send_cmd(cmd)[10:14])[0]

File "tpm2.py", line 378, in send_cmd
raise ProtocolError(cc, rc)
ProtocolError: TPM_RC_UNBALANCED: cc=0x00000131, rc=0x00000131

======================================================================
ERROR: test_make_two_spaces (tpm2_smoke.SpaceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "tpm2_smoke.py", line 171, in test_make_two_spaces
root3 = space2.create_root_key()
File "tpm2.py", line 562, in create_root_key

    return struct.unpack('>I', self.send_cmd(cmd)[10:14])[0]

File "tpm2.py", line 378, in send_cmd
raise ProtocolError(cc, rc)
ProtocolError: TPM_RC_UNBALANCED: cc=0x00000131, rc=0x00000131

----------------------------------------------------------------------
Ran 10 tests in 44.545s

FAILED (errors=3)

/Jarkko
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html