PAX overflow detection after resuming from suspend to RAM

Discuss usability issues, general maintenance, and general support issues for a grsecurity-enabled system.

PAX overflow detection after resuming from suspend to RAM

Postby markusle » Thu Aug 08, 2013 12:46 am

Starting with kernel 3.10.4 and the grsecurity-2.9.1-3.10.4-201308011855.patch I get the below messages in the logs after resuming from suspend to RAM indicating that PAX has detected a size overflow. Unfortunately, resuming with this leaves the machine in an unhappy state and forces me to reboot. The last kernel which suspended fine is 3.10.3 with the grsecurity-2.9.1-3.10.3-201307261236.patch.

The latest kernel (3.10.5) and grsec patch grsecurity-2.9.1-3.10.5-201308052154.patch continue to show this issue. I have conforimed that a vanilla 3.10.5 kernel with the identical kernel config (sans PAX/grsec options) appears to suspend fine.

Unfortunately, I don't quite know how to interpret this PAX message and how to properly deal with it so any hints would
be greatly appreaciated.

Code: Select all
Aug  7 23:04:04 localhost kernel: [  103.566010] PAX: size overflow detected i
n function calc_aperfmperf_ratio /home/markus/local/kernel/3.10.5/linux-3.10.5
-nimrod-1/arch/x86/include/asm/processor.h:970 cicus.22_21 min, count: 12
Aug  7 23:04:04 localhost kernel: [  103.566014] CPU: 2 PID: 867 Comm: cat Not
 tainted 3.10.5-nimrod-1 #1
Aug  7 23:04:04 localhost kernel: [  103.566015] Hardware name: LENOVO 4177CTO
/4177CTO, BIOS 83ET63WW (1.33 ) 07/29/2011
Aug  7 23:04:04 localhost kernel: [  103.566016]  ffffffffa0101224 ffffffffa01
01224 ffffffffa01011b0 ffffffff81117c71
Aug  7 23:04:04 localhost kernel: [  103.566019]  ffff88020b21f500 ffff88020ad
b3b88 0000000000000003 ffff88020b21f500
Aug  7 23:04:04 localhost kernel: [  103.566021]  ffffffffa010115b 00000001989
fcd1b 000000019b7fe03e ffffffff8142c456
Aug  7 23:04:04 localhost kernel: [  103.566022] Call Trace:
Aug  7 23:04:04 localhost kernel: [  103.566027]  [<ffffffffa0101224>] ? cpufr
eq_get_measured_perf+0x1b4/0x27b [mperf]
Aug  7 23:04:04 localhost kernel: [  103.566030]  [<ffffffffa0101224>] ? cpufr
eq_get_measured_perf+0x1b4/0x27b [mperf]
Aug  7 23:04:04 localhost kernel: [  103.566033]  [<ffffffffa01011b0>] ? cpufr
eq_get_measured_perf+0x140/0x27b [mperf]
Aug  7 23:04:04 localhost kernel: [  103.566035]  [<ffffffff81117c71>] ? repor
t_size_overflow+0x31/0x40
Aug  7 23:04:04 localhost kernel: [  103.566038]  [<ffffffffa010115b>] ? cpufr
eq_get_measured_perf+0xeb/0x27b [mperf]
Aug  7 23:04:04 localhost kernel: [  103.566040]  [<ffffffff8142c456>] ? __cpu
freq_cpu_get+0x76/0xc0
Aug  7 23:04:04 localhost kernel: [  103.566042]  [<ffffffff8142c5d4>] ? __cpu
freq_driver_getavg+0x54/0xa0
Aug  7 23:04:04 localhost kernel: [  103.566044]  [<ffffffff81431340>] ? dbs_c
heck_cpu+0x170/0x1d0
Aug  7 23:04:04 localhost kernel: [  103.566047]  [<ffffffff814317e0>] ? cpufr
eq_governor_dbs+0x440/0x7e0
Aug  7 23:04:04 localhost kernel: [  103.566049]  [<ffffffff8142d5f9>] ? __cpu
freq_governor+0x49/0x100
Aug  7 23:04:04 localhost kernel: [  103.566051]  [<ffffffff8142d848>] ? __cpu
freq_set_policy+0x198/0x1d0
Aug  7 23:04:04 localhost kernel: [  103.566053]  [<ffffffff8142e1c2>] ? store
_scaling_governor+0xe2/0x1e0
Aug  7 23:04:04 localhost kernel: [  103.566055]  [<ffffffff8142ecf0>] ? cpufr
eq_update_policy+0x120/0x120
Aug  7 23:04:04 localhost kernel: [  103.566057]  [<ffffffff8142d410>] ? store
+0x60/0xa0
Aug  7 23:04:04 localhost kernel: [  103.566059]  [<ffffffff81182f3f>] ? sysfs
_write_file+0x17f/0x230
Aug  7 23:04:04 localhost kernel: [  103.566061]  [<ffffffff81111593>] ? vfs_w
rite+0xf3/0x270
Aug  7 23:04:04 localhost kernel: [  103.566064]  [<ffffffff811120a8>] ? SyS_write+0x48/0xa0
Aug  7 23:04:04 localhost kernel: [  103.566066]  [<ffffffff815f86e3>] ? system_call_fastpath+0x18/0x1d
Aug  7 23:04:04 localhost kernel: [  103.566069]  [<ffffffff815f8713>] ? sysret_check+0x26/0x61
Aug  7 23:04:04 localhost logger: ACPI group/action undefined: processor / LNXCPU:00
Aug  7 23:04:04 localhost logger: ACPI group/action undefined: processor / LNXCPU:01
Aug  7 23:04:04 localhost logger: ACPI group/action undefined: processor / LNXCPU:02
Aug  7 23:04:04 localhost logger: ACPI group/action undefined: processor / LNXCPU:03
markusle
 
Posts: 7
Joined: Wed Aug 07, 2013 11:44 pm

Re: PAX overflow detection after resuming from suspend to RA

Postby ephox » Thu Aug 08, 2013 9:51 am

Could you send me the result of the following patch please?:
Code: Select all
--- arch/x86/include/asm/processor.h.orig       2013-08-08 15:38:42.512016207 +0200
+++ arch/x86/include/asm/processor.h    2013-08-08 15:46:16.576006075 +0200
@@ -967,9 +967,12 @@
                                    struct aperfmperf *new)
 {
        u64 aperf = new->aperf - old->aperf;
-       u64 mperf = new->mperf - old->mperf;
+       u64 mperf;
        unsigned long ratio = aperf;
 
+       printk(KERN_ERR "PAXI new: %lx old: %lx\n", new->mperf, old->mperf);
+       mperf = new->mperf - old->mperf;
+
        mperf >>= APERFMPERF_SHIFT;
        if (mperf)
                ratio = div64_u64(aperf, mperf);

ephox
 
Posts: 134
Joined: Tue Mar 20, 2012 4:36 pm

Re: PAX overflow detection after resuming from suspend to RA

Postby markusle » Thu Aug 08, 2013 1:03 pm

Thanks a lot for your quick reply. Using your patch on top of 3.10.5 and grsecurity-2.9.1-3.10.5-201308052154.patch
I get for

CPU 0:
Code: Select all
Aug  8 12:50:44 localhost kernel: [   96.568150] PAXI new: 1656e9da2 old: 57af09d44
Aug  8 12:50:44 localhost kernel: [   96.568153] PAX: size overflow detected in function calc_aperfmperf_ratio /home/markus/local/kernel/3.10.5/linux-3.10.5-nimrod-2/arch/x86/include/asm/processor.h:974 cicus.22_24 min, count: 12
Aug  8 12:50:44 localhost kernel: [   96.568156] CPU: 0 PID: 873 Comm: cat Not tainted 3.10.5-nimrod-1 #1
Aug  8 12:50:44 localhost kernel: [   96.568157] Hardware name: LENOVO 4177CTO/4177CTO, BIOS 83ET63WW (1.33 ) 07/29/2011
Aug  8 12:50:44 localhost kernel: [   96.568158]  ffffffffa0101270 ffffffffa0101270 ffffffffa01011e0 ffffffff81117ba1
Aug  8 12:50:44 localhost kernel: [   96.568161]  ffff8802149eeb00 ffff88020aefdbc8 0000000000000003 000000000000f3c0
Aug  8 12:50:44 localhost kernel: [   96.568163]  ffffffffa0101182 ffff88021e2cf3c0 00000001621d54fe 00000001656e9da2
Aug  8 12:50:44 localhost kernel: [   96.568165] Call Trace:
Aug  8 12:50:44 localhost kernel: [   96.568171]  [<ffffffffa0101270>] ? cpufreq_get_measured_perf+0x200/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.568175]  [<ffffffffa0101270>] ? cpufreq_get_measured_perf+0x200/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.568178]  [<ffffffffa01011e0>] ? cpufreq_get_measured_perf+0x170/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.568182]  [<ffffffff81117ba1>] ? report_size_overflow+0x31/0x40
Aug  8 12:50:44 localhost kernel: [   96.568186]  [<ffffffffa0101182>] ? cpufreq_get_measured_perf+0x112/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.568188]  [<ffffffff8142be44>] ? __cpufreq_driver_getavg+0x54/0xa0
Aug  8 12:50:44 localhost kernel: [   96.568191]  [<ffffffff81430bb0>] ? dbs_check_cpu+0x170/0x1d0
Aug  8 12:50:44 localhost kernel: [   96.568193]  [<ffffffff81431050>] ? cpufreq_governor_dbs+0x440/0x7e0
Aug  8 12:50:44 localhost kernel: [   96.568195]  [<ffffffff8142ce69>] ? __cpufreq_governor+0x49/0x100
Aug  8 12:50:44 localhost kernel: [   96.568197]  [<ffffffff8142d0b8>] ? __cpufreq_set_policy+0x198/0x1d0
Aug  8 12:50:44 localhost kernel: [   96.568200]  [<ffffffff8142da32>] ? store_scaling_governor+0xe2/0x1e0
Aug  8 12:50:44 localhost kernel: [   96.568202]  [<ffffffff8142e560>] ? cpufreq_update_policy+0x120/0x120
Aug  8 12:50:44 localhost kernel: [   96.568204]  [<ffffffff8142cc80>] ? store+0x60/0xa0
Aug  8 12:50:44 localhost kernel: [   96.568207]  [<ffffffff81182e5f>] ? sysfs_write_file+0x17f/0x230
Aug  8 12:50:44 localhost kernel: [   96.568209]  [<ffffffff811114c3>] ? vfs_write+0xf3/0x270
Aug  8 12:50:44 localhost kernel: [   96.568211]  [<ffffffff81111fd8>] ? SyS_write+0x48/0xa0
Aug  8 12:50:44 localhost kernel: [   96.568215]  [<ffffffff815f7c63>] ? system_call_fastpath+0x18/0x1d



CPU 1:
Code: Select all
Aug  8 12:50:44 localhost kernel: [   96.564676] PAXI new: 19abc486b old: e4b1
261be
Aug  8 12:50:44 localhost kernel: [   96.564681] PAX: size overflow detected i
n function calc_aperfmperf_ratio /home/markus/local/kernel/3.10.5/linux-3.10.5
-nimrod-2/arch/x86/include/asm/processor.h:974 cicus.22_24 min, count: 12
Aug  8 12:50:44 localhost kernel: [   96.564685] CPU: 1 PID: 870 Comm: cat Not
 tainted 3.10.5-nimrod-1 #1
Aug  8 12:50:44 localhost kernel: [   96.564686] Hardware name: LENOVO 4177CTO
/4177CTO, BIOS 83ET63WW (1.33 ) 07/29/2011
Aug  8 12:50:44 localhost kernel: [   96.564688]  ffffffffa0101270 ffffffffa01
01270 ffffffffa01011e0 ffffffff81117ba1
Aug  8 12:50:44 localhost kernel: [   96.564691]  ffff880214a97400 ffff88020ae
e9b38 0000000000000000 000000000000f3c0
Aug  8 12:50:44 localhost kernel: [   96.564693]  ffffffffa0101182 ffff88021e2
0f3c0 0000000170e5ad5b 000000019abc486b
Aug  8 12:50:44 localhost kernel: [   96.564695] Call Trace:
Aug  8 12:50:44 localhost kernel: [   96.564708]  [<ffffffffa0101270>] ? cpufr
eq_get_measured_perf+0x200/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.564711]  [<ffffffffa0101270>] ? cpufr
eq_get_measured_perf+0x200/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.564714]  [<ffffffffa01011e0>] ? cpufr
eq_get_measured_perf+0x170/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.564718]  [<ffffffff81117ba1>] ? repor
t_size_overflow+0x31/0x40
Aug  8 12:50:44 localhost kernel: [   96.564722]  [<ffffffffa0101182>] ? cpufr
eq_get_measured_perf+0x112/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.564725]  [<ffffffff8142be44>] ? __cpu
freq_driver_getavg+0x54/0xa0
Aug  8 12:50:44 localhost kernel: [   96.564728]  [<ffffffff81430bb0>] ? dbs_c
heck_cpu+0x170/0x1d0
Aug  8 12:50:44 localhost kernel: [   96.564730]  [<ffffffff81431050>] ? cpufr
eq_governor_dbs+0x440/0x7e0
Aug  8 12:50:44 localhost kernel: [   96.564733]  [<ffffffff8142ce69>] ? __cpu
freq_governor+0x49/0x100
Aug  8 12:50:44 localhost kernel: [   96.564735]  [<ffffffff8142d0b8>] ? __cpu
freq_set_policy+0x198/0x1d0
Aug  8 12:50:44 localhost kernel: [   96.564737]  [<ffffffff8142da32>] ? store
_scaling_governor+0xe2/0x1e0
Aug  8 12:50:44 localhost kernel: [   96.564740]  [<ffffffff8142e560>] ? cpufr
eq_update_policy+0x120/0x120
Aug  8 12:50:44 localhost kernel: [   96.564742]  [<ffffffff8142cc80>] ? store
+0x60/0xa0
Aug  8 12:50:44 localhost kernel: [   96.564745]  [<ffffffff81182e5f>] ? sysfs
_write_file+0x17f/0x230
Aug  8 12:50:44 localhost kernel: [   96.564748]  [<ffffffff811114c3>] ? vfs_w
rite+0xf3/0x270
Aug  8 12:50:44 localhost kernel: [   96.564751]  [<ffffffff81111fd8>] ? SyS_w
rite+0x48/0xa0
Aug  8 12:50:44 localhost kernel: [   96.564755]  [<ffffffff815f7c63>] ? syste
m_call_fastpath+0x18/0x1d


CPU 3 (the logs seems to list two CPU 3s instead of CPU2 and CPU3, not sure why)
Code: Select all
Aug  8 12:50:44 localhost kernel: [   96.565895] PAXI new: 15a213d1f old: 52dfbfc7f
Aug  8 12:50:44 localhost kernel: [   96.565900] PAX: size overflow detected in function calc_aperfmperf_ratio /home/markus/local/kernel/3.10.5/linux-3.10.5-nimrod-2/arch/x86/include/asm/processor.h:974 cicus.22_24 min, count: 12
Aug  8 12:50:44 localhost kernel: [   96.565904] CPU: 3 PID: 871 Comm: cat Not tainted 3.10.5-nimrod-1 #1
Aug  8 12:50:44 localhost kernel: [   96.565906] Hardware name: LENOVO 4177CTO/4177CTO, BIOS 83ET63WW (1.33 ) 07/29/2011
Aug  8 12:50:44 localhost kernel: [   96.565908]  ffffffffa0101270 ffffffffa0101270 ffffffffa01011e0 ffffffff81117ba1
Aug  8 12:50:44 localhost kernel: [   96.565912]  ffff8802149ee800 ffff88020aecdb48 0000000000000001 000000000000f3c0
Aug  8 12:50:44 localhost kernel: [   96.565915]  ffffffffa0101182 ffff88021e24f3c0 00000001570c6826 000000015a213d1f
Aug  8 12:50:44 localhost kernel: [   96.565918] Call Trace:
Aug  8 12:50:44 localhost kernel: [   96.565927]  [<ffffffffa0101270>] ? cpufreq_get_measured_perf+0x200/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.565933]  [<ffffffffa0101270>] ? cpufreq_get_measured_perf+0x200/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.565937]  [<ffffffffa01011e0>] ? cpufreq_get_measured_perf+0x170/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.565941]  [<ffffffff81117ba1>] ? report_size_overflow+0x31/0x40
Aug  8 12:50:44 localhost kernel: [   96.565947]  [<ffffffffa0101182>] ? cpufreq_get_measured_perf+0x112/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.565950]  [<ffffffff8142be44>] ? __cpufreq_driver_getavg+0x54/0xa0
Aug  8 12:50:44 localhost kernel: [   96.565953]  [<ffffffff81430bb0>] ? dbs_check_cpu+0x170/0x1d0
Aug  8 12:50:44 localhost kernel: [   96.565957]  [<ffffffff81431050>] ? cpufreq_governor_dbs+0x440/0x7e0
Aug  8 12:50:44 localhost kernel: [   96.565961]  [<ffffffff8142ce69>] ? __cpufreq_governor+0x49/0x100
Aug  8 12:50:44 localhost kernel: [   96.565964]  [<ffffffff8142d0b8>] ? __cpufreq_set_policy+0x198/0x1d0
Aug  8 12:50:44 localhost kernel: [   96.565967]  [<ffffffff8142da32>] ? store_scaling_governor+0xe2/0x1e0
Aug  8 12:50:44 localhost kernel: [   96.565970]  [<ffffffff8142e560>] ? cpufreq_update_policy+0x120/0x120
Aug  8 12:50:44 localhost kernel: [   96.565973]  [<ffffffff8142cc80>] ? store+0x60/0xa0
Aug  8 12:50:44 localhost kernel: [   96.565977]  [<ffffffff81182e5f>] ? sysfs_write_file+0x17f/0x230
Aug  8 12:50:44 localhost kernel: [   96.565980]  [<ffffffff811114c3>] ? vfs_write+0xf3/0x270
Aug  8 12:50:44 localhost kernel: [   96.565984]  [<ffffffff81111fd8>] ? SyS_write+0x48/0xa0
Aug  8 12:50:44 localhost kernel: [   96.565988]  [<ffffffff815f7c63>] ? system_call_fastpath+0x18/0x1d
Aug  8 12:50:44 localhost kernel: [   96.565992]  [<ffffffff815f7c93>] ? sysret_check+0x26/0x61



CPU 3
Code: Select all
Aug  8 12:50:44 localhost kernel: [   96.567172] PAXI new: 15b223c29 old: 6bc54242b
Aug  8 12:50:44 localhost kernel: [   96.567177] PAX: size overflow detected in function calc_aperfmperf_ratio /home/markus/local/kernel/3.10.5/linux-3.10.5-nimrod-2/arch/x86/include/asm/processor.h:974 cicus.22_24 min, count: 12
Aug  8 12:50:44 localhost kernel: [   96.567180] CPU: 3 PID: 872 Comm: cat Not tainted 3.10.5-nimrod-1 #1
Aug  8 12:50:44 localhost kernel: [   96.567182] Hardware name: LENOVO 4177CTO/4177CTO, BIOS 83ET63WW (1.33 ) 07/29/2011
Aug  8 12:50:44 localhost kernel: [   96.567185]  ffffffffa0101270 ffffffffa0101270 ffffffffa01011e0 ffffffff81117ba1
Aug  8 12:50:44 localhost kernel: [   96.567188]  ffff8802149ef100 ffff88020b0ffbc8 0000000000000002 000000000000f3c0
Aug  8 12:50:44 localhost kernel: [   96.567191]  ffffffffa0101182 ffff88021e28f3c0 00000001578160a0 000000015b223c29
Aug  8 12:50:44 localhost kernel: [   96.567194] Call Trace:
Aug  8 12:50:44 localhost kernel: [   96.567201]  [<ffffffffa0101270>] ? cpufreq_get_measured_perf+0x200/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.567207]  [<ffffffffa0101270>] ? cpufreq_get_measured_perf+0x200/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.567211]  [<ffffffffa01011e0>] ? cpufreq_get_measured_perf+0x170/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.567216]  [<ffffffff81117ba1>] ? report_size_overflow+0x31/0x40
Aug  8 12:50:44 localhost kernel: [   96.567220]  [<ffffffffa0101182>] ? cpufreq_get_measured_perf+0x112/0x2cb [mperf]
Aug  8 12:50:44 localhost kernel: [   96.567224]  [<ffffffff8142be44>] ? __cpufreq_driver_getavg+0x54/0xa0
Aug  8 12:50:44 localhost kernel: [   96.567227]  [<ffffffff81430bb0>] ? dbs_check_cpu+0x170/0x1d0
Aug  8 12:50:44 localhost kernel: [   96.567231]  [<ffffffff81431050>] ? cpufreq_governor_dbs+0x440/0x7e0
Aug  8 12:50:44 localhost kernel: [   96.567234]  [<ffffffff8142ce69>] ? __cpufreq_governor+0x49/0x100
Aug  8 12:50:44 localhost kernel: [   96.567238]  [<ffffffff8142d0b8>] ? __cpufreq_set_policy+0x198/0x1d0
Aug  8 12:50:44 localhost kernel: [   96.567241]  [<ffffffff8142da32>] ? store_scaling_governor+0xe2/0x1e0
Aug  8 12:50:44 localhost kernel: [   96.567244]  [<ffffffff8142e560>] ? cpufreq_update_policy+0x120/0x120
Aug  8 12:50:44 localhost kernel: [   96.567248]  [<ffffffff8142cc80>] ? store+0x60/0xa0
Aug  8 12:50:44 localhost kernel: [   96.567252]  [<ffffffff81182e5f>] ? sysfs_write_file+0x17f/0x230
Aug  8 12:50:44 localhost kernel: [   96.567256]  [<ffffffff811114c3>] ? vfs_write+0xf3/0x270
Aug  8 12:50:44 localhost kernel: [   96.567259]  [<ffffffff81111fd8>] ? SyS_write+0x48/0xa0
Aug  8 12:50:44 localhost kernel: [   96.567263]  [<ffffffff815f7c63>] ? system_call_fastpath+0x18/0x1d
markusle
 
Posts: 7
Joined: Wed Aug 07, 2013 11:44 pm

Re: PAX overflow detection after resuming from suspend to RA

Postby ephox » Thu Aug 08, 2013 1:57 pm

Thanks for the report, this will be fixed in the next PaX version.
ephox
 
Posts: 134
Joined: Tue Mar 20, 2012 4:36 pm

Re: PAX overflow detection after resuming from suspend to RA

Postby markusle » Thu Aug 08, 2013 2:53 pm

Terrific - thanks so much for your help. I really appreciate it.
markusle
 
Posts: 7
Joined: Wed Aug 07, 2013 11:44 pm


Return to grsecurity support