#define MAX_STR 128
char d_path_buf[MAX_STR] = {};
bpf_d_path(&file->f_path , d_path_buf , MAX_STR);
I am using bpf_d_path helper function to extract full path. path "/proc/4581/cmdline" is printed twice, separated by numerous empty lines.
return value shows here that bpf_d_path wrote 19 char but when i printed all char one by one it shows path then empty spaces and the path again (path___path).
kernel 6.5.0-14-generic
char (loop value)
node-1346 [005] ...11 28932.918673: bpf_trace_printk: / 0
node-1346 [005] ...11 28932.918674: bpf_trace_printk: p 1
node-1346 [005] ...11 28932.918675: bpf_trace_printk: r 2
node-1346 [005] ...11 28932.918676: bpf_trace_printk: o 3
node-1346 [005] ...11 28932.918677: bpf_trace_printk: c 4
node-1346 [005] ...11 28932.918677: bpf_trace_printk: / 5
node-1346 [005] ...11 28932.918678: bpf_trace_printk: 6 6
node-1346 [005] ...11 28932.918680: bpf_trace_printk: 6 7
node-1346 [005] ...11 28932.918680: bpf_trace_printk: 6 8
node-1346 [005] ...11 28932.918681: bpf_trace_printk: 2 9
node-1346 [005] ...11 28932.918682: bpf_trace_printk: / 10
node-1346 [005] ...11 28932.918683: bpf_trace_printk: c 11
node-1346 [005] ...11 28932.918684: bpf_trace_printk: m 12
node-1346 [005] ...11 28932.918685: bpf_trace_printk: d 13
node-1346 [005] ...11 28932.918685: bpf_trace_printk: l 14
node-1346 [005] ...11 28932.918686: bpf_trace_printk: i 15
node-1346 [005] ...11 28932.918687: bpf_trace_printk: n 16
node-1346 [005] ...11 28932.918688: bpf_trace_printk: e 17
node-1346 [005] ...11 28932.918689: bpf_trace_printk:
node-1346 [005] ...11 28932.918690: bpf_trace_printk:
node-1346 [005] ...11 28932.918690: bpf_trace_printk:
node-1346 [005] ...11 28932.918691: bpf_trace_printk:
node-1346 [005] ...11 28932.918692: bpf_trace_printk:
node-1346 [005] ...11 28932.918693: bpf_trace_printk:
node-1346 [005] ...11 28932.918694: bpf_trace_printk:
node-1346 [005] ...11 28932.918694: bpf_trace_printk:
node-1346 [005] ...11 28932.918696: bpf_trace_printk:
node-1346 [005] ...11 28932.918697: bpf_trace_printk:
node-1346 [005] ...11 28932.918697: bpf_trace_printk:
node-1346 [005] ...11 28932.918698: bpf_trace_printk:
node-1346 [005] ...11 28932.918698: bpf_trace_printk:
node-1346 [005] ...11 28932.918700: bpf_trace_printk:
node-1346 [005] ...11 28932.918700: bpf_trace_printk:
node-1346 [005] ...11 28932.918701: bpf_trace_printk:
node-1346 [005] ...11 28932.918702: bpf_trace_printk:
node-1346 [005] ...11 28932.918703: bpf_trace_printk:
node-1346 [005] ...11 28932.918704: bpf_trace_printk:
node-1346 [005] ...11 28932.918705: bpf_trace_printk:
node-1346 [005] ...11 28932.918706: bpf_trace_printk:
node-1346 [005] ...11 28932.918706: bpf_trace_printk:
node-1346 [005] ...11 28932.918707: bpf_trace_printk:
node-1346 [005] ...11 28932.918708: bpf_trace_printk:
node-1346 [005] ...11 28932.918709: bpf_trace_printk:
node-1346 [005] ...11 28932.918710: bpf_trace_printk:
node-1346 [005] ...11 28932.918710: bpf_trace_printk:
node-1346 [005] ...11 28932.918711: bpf_trace_printk:
node-1346 [005] ...11 28932.918712: bpf_trace_printk:
node-1346 [005] ...11 28932.918713: bpf_trace_printk:
node-1346 [005] ...11 28932.918714: bpf_trace_printk:
node-1346 [005] ...11 28932.918714: bpf_trace_printk:
node-1346 [005] ...11 28932.918715: bpf_trace_printk:
node-1346 [005] ...11 28932.918716: bpf_trace_printk:
node-1346 [005] ...11 28932.918717: bpf_trace_printk:
node-1346 [005] ...11 28932.918718: bpf_trace_printk:
node-1346 [005] ...11 28932.918718: bpf_trace_printk:
node-1346 [005] ...11 28932.918719: bpf_trace_printk:
node-1346 [005] ...11 28932.918720: bpf_trace_printk:
node-1346 [005] ...11 28932.918721: bpf_trace_printk:
node-1346 [005] ...11 28932.918722: bpf_trace_printk:
node-1346 [005] ...11 28932.918722: bpf_trace_printk:
node-1346 [005] ...11 28932.918723: bpf_trace_printk:
node-1346 [005] ...11 28932.918725: bpf_trace_printk:
node-1346 [005] ...11 28932.918726: bpf_trace_printk:
node-1346 [005] ...11 28932.918726: bpf_trace_printk:
node-1346 [005] ...11 28932.918727: bpf_trace_printk:
node-1346 [005] ...11 28932.918728: bpf_trace_printk:
node-1346 [005] ...11 28932.918729: bpf_trace_printk:
node-1346 [005] ...11 28932.918730: bpf_trace_printk:
node-1346 [005] ...11 28932.918731: bpf_trace_printk:
node-1346 [005] ...11 28932.918731: bpf_trace_printk:
node-1346 [005] ...11 28932.918732: bpf_trace_printk:
node-1346 [005] ...11 28932.918732: bpf_trace_printk:
node-1346 [005] ...11 28932.918734: bpf_trace_printk:
node-1346 [005] ...11 28932.918735: bpf_trace_printk:
node-1346 [005] ...11 28932.918736: bpf_trace_printk:
node-1346 [005] ...11 28932.918736: bpf_trace_printk:
node-1346 [005] ...11 28932.918737: bpf_trace_printk:
node-1346 [005] ...11 28932.918738: bpf_trace_printk:
node-1346 [005] ...11 28932.918738: bpf_trace_printk:
node-1346 [005] ...11 28932.918739: bpf_trace_printk:
node-1346 [005] ...11 28932.918740: bpf_trace_printk:
node-1346 [005] ...11 28932.918740: bpf_trace_printk:
node-1346 [005] ...11 28932.918741: bpf_trace_printk:
node-1346 [005] ...11 28932.918742: bpf_trace_printk:
node-1346 [005] ...11 28932.918743: bpf_trace_printk:
node-1346 [005] ...11 28932.918744: bpf_trace_printk:
node-1346 [005] ...11 28932.918744: bpf_trace_printk:
node-1346 [005] ...11 28932.918745: bpf_trace_printk:
node-1346 [005] ...11 28932.918746: bpf_trace_printk:
node-1346 [005] ...11 28932.918747: bpf_trace_printk:
node-1346 [005] ...11 28932.918748: bpf_trace_printk:
node-1346 [005] ...11 28932.918749: bpf_trace_printk:
node-1346 [005] ...11 28932.918749: bpf_trace_printk:
node-1346 [005] ...11 28932.918750: bpf_trace_printk:
node-1346 [005] ...11 28932.918751: bpf_trace_printk:
node-1346 [005] ...11 28932.918752: bpf_trace_printk:
node-1346 [005] ...11 28932.918753: bpf_trace_printk:
node-1346 [005] ...11 28932.918754: bpf_trace_printk:
node-1346 [005] ...11 28932.918755: bpf_trace_printk:
node-1346 [005] ...11 28932.918756: bpf_trace_printk:
node-1346 [005] ...11 28932.918756: bpf_trace_printk:
node-1346 [005] ...11 28932.918757: bpf_trace_printk:
node-1346 [005] ...11 28932.918758: bpf_trace_printk:
node-1346 [005] ...11 28932.918759: bpf_trace_printk:
node-1346 [005] ...11 28932.918760: bpf_trace_printk:
node-1346 [005] ...11 28932.918760: bpf_trace_printk:
node-1346 [005] ...11 28932.918761: bpf_trace_printk:
node-1346 [005] ...11 28932.918762: bpf_trace_printk:
node-1346 [005] ...11 28932.918763: bpf_trace_printk:
node-1346 [005] ...11 28932.918764: bpf_trace_printk: / 109
node-1346 [005] ...11 28932.918765: bpf_trace_printk: p 110
node-1346 [005] ...11 28932.918766: bpf_trace_printk: r 111
node-1346 [005] ...11 28932.918766: bpf_trace_printk: o 112
node-1346 [005] ...11 28932.918768: bpf_trace_printk: c 113
node-1346 [005] ...11 28932.918768: bpf_trace_printk: / 114
node-1346 [005] ...11 28932.918769: bpf_trace_printk: 6 115
node-1346 [005] ...11 28932.918770: bpf_trace_printk: 6 116
node-1346 [005] ...11 28932.918770: bpf_trace_printk: 6 117
node-1346 [005] ...11 28932.918771: bpf_trace_printk: 2 118
node-1346 [005] ...11 28932.918773: bpf_trace_printk: / 119
node-1346 [005] ...11 28932.918774: bpf_trace_printk: c 120
node-1346 [005] ...11 28932.918774: bpf_trace_printk: m 121
node-1346 [005] ...11 28932.918775: bpf_trace_printk: d 122
node-1346 [005] ...11 28932.918776: bpf_trace_printk: l 123
node-1346 [005] ...11 28932.918776: bpf_trace_printk: i 124
node-1346 [005] ...11 28932.918777: bpf_trace_printk: n 125
node-1346 [005] ...11 28932.918778: bpf_trace_printk: e 126
node-1346 [005] ...11 28932.918778: bpf_trace_printk:
Not sure what causing this. if any one have anything please let me know
I was expecting simple full path