@@ -844,6 +844,7 @@ struct uprobe_cpu_buffer {
844
844
};
845
845
static struct uprobe_cpu_buffer __percpu * uprobe_cpu_buffer ;
846
846
static int uprobe_buffer_refcnt ;
847
+ #define MAX_UCB_BUFFER_SIZE PAGE_SIZE
847
848
848
849
static int uprobe_buffer_init (void )
849
850
{
@@ -944,9 +945,6 @@ static void __uprobe_trace_func(struct trace_uprobe *tu,
944
945
945
946
WARN_ON (call != trace_file -> event_call );
946
947
947
- if (WARN_ON_ONCE (tu -> tp .size + dsize > PAGE_SIZE ))
948
- return ;
949
-
950
948
if (trace_trigger_soft_disabled (trace_file ))
951
949
return ;
952
950
@@ -1483,6 +1481,11 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs)
1483
1481
esize = SIZEOF_TRACE_ENTRY (is_ret_probe (tu ));
1484
1482
1485
1483
ucb = uprobe_buffer_get ();
1484
+
1485
+ if (WARN_ON_ONCE (tu -> tp .size + dsize > MAX_UCB_BUFFER_SIZE )) {
1486
+ dsize = MAX_UCB_BUFFER_SIZE - tu -> tp .size ;
1487
+ }
1488
+
1486
1489
store_trace_args (ucb -> buf , & tu -> tp , regs , esize , dsize );
1487
1490
1488
1491
if (trace_probe_test_flag (& tu -> tp , TP_FLAG_TRACE ))
@@ -1518,6 +1521,11 @@ static int uretprobe_dispatcher(struct uprobe_consumer *con,
1518
1521
esize = SIZEOF_TRACE_ENTRY (is_ret_probe (tu ));
1519
1522
1520
1523
ucb = uprobe_buffer_get ();
1524
+
1525
+ if (WARN_ON_ONCE (tu -> tp .size + dsize > MAX_UCB_BUFFER_SIZE )) {
1526
+ dsize = MAX_UCB_BUFFER_SIZE - tu -> tp .size ;
1527
+ }
1528
+
1521
1529
store_trace_args (ucb -> buf , & tu -> tp , regs , esize , dsize );
1522
1530
1523
1531
if (trace_probe_test_flag (& tu -> tp , TP_FLAG_TRACE ))
0 commit comments