Skip to contentSkip to conversation

HWBKPT FIX: Release the bp slot if arch_validate_hwbkpt_settings() fails.

PATCH In review Mahesh Salgaonkar 2 participants 3 messages Jan 21, 2010 – Jan 29, 2010 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 HWBKPT FIX: Release the bp slot if arch_validate_hwbkpt_settings() fails.

On a given architecture, when hardware breakpoint registration fails due to un-supported access type (read/write/execute), we loose the bp slot since register_perf_hw_breakpoint() does not release the bp slot on failure. Hence, any subsequent hardware breakpoint registration starts failing with 'no space left on device' error.

This patch introduces error handling in register_perf_hw_breakpoint() function and releases bp slot on error.

---

 kernel/hw_breakpoint.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
kernel/hw_breakpoint.c +4 -0
index 50dbd59..c030ae6 100644
@@ -296,6 +296,10 @@ int register_perf_hw_breakpoint(struct perf_event *bp)
 	if (!bp->attr.disabled || !bp->overflow_handler)
 		ret = arch_validate_hwbkpt_settings(bp, bp->ctx->task);
 
+	/* if arch_validate_hwbkpt_settings() fails then release bp slot */
+	if (ret)
+		release_bp_slot(bp);
+
 	return ret;
 }
 
#2 lore raw
Quoted 11 lines · Mahesh Salgaonkar

On a given architecture, when hardware breakpoint registration fails due to un-supported access type (read/write/execute), we loose the bp slot since register_perf_hw_breakpoint() does not release the bp slot on failure. Hence, any subsequent hardware breakpoint registration starts failing with 'no space left on device' error.

This patch introduces error handling in register_perf_hw_breakpoint() function and releases bp slot on error.

Thanks. I'm queuing it.

#3 lore raw

[tip:perf/core] hw_breakpoints: Release the bp slot if arch_validate_hwbkpt_settings() fails.

In reply to Mahesh Salgaonkar
Commit-ID:  b23ff0e9330e4b11e18af984d50573598e10e7f9
Gitweb:     http://git.kernel.org/tip/b23ff0e9330e4b11e18af984d50573598e10e7f9
Author:     Mahesh Salgaonkar <[email protected]>
AuthorDate: Thu, 21 Jan 2010 18:25:16 +0530
Committer:  Frederic Weisbecker <[email protected]>
CommitDate: Thu, 28 Jan 2010 14:15:51 +0100

hw_breakpoints: Release the bp slot if arch_validate_hwbkpt_settings() fails.

On a given architecture, when hardware breakpoint registration fails due to un-supported access type (read/write/execute), we lose the bp slot since register_perf_hw_breakpoint() does not release the bp slot on failure.
Hence, any subsequent hardware breakpoint registration starts failing with 'no space left on device' error.

This patch introduces error handling in register_perf_hw_breakpoint() function and releases bp slot on error.

Cc Ananth N Mavinakayanahalli <[email protected]>
Cc K. Prasad <[email protected]>
Cc Maneesh Soni <[email protected]>

LKML-Reference: <[email protected]>

---
 kernel/hw_breakpoint.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
kernel/hw_breakpoint.c +4 -0
index 50dbd59..c030ae6 100644
@@ -296,6 +296,10 @@ int register_perf_hw_breakpoint(struct perf_event *bp)
 	if (!bp->attr.disabled || !bp->overflow_handler)
 		ret = arch_validate_hwbkpt_settings(bp, bp->ctx->task);
 
+	/* if arch_validate_hwbkpt_settings() fails then release bp slot */
+	if (ret)
+		release_bp_slot(bp);
+
 	return ret;
 }