Commit 7ef4c19
smackfs: restrict bytes count in smackfs write functions
syzbot found WARNINGs in several smackfs write operations where
bytes count is passed to memdup_user_nul which exceeds
GFP MAX_ORDER. Check count size if bigger than PAGE_SIZE.
Per smackfs doc, smk_write_net4addr accepts any label or -CIPSO,
smk_write_net6addr accepts any label or -DELETE. I couldn't find
any general rule for other label lengths except SMK_LABELLEN,
SMK_LONGLABEL, SMK_CIPSOMAX which are documented.
Let's constrain, in general, smackfs label lengths for PAGE_SIZE.
Although fuzzer crashes write to smackfs/netlabel on 0x400000 length.
Here is a quick way to reproduce the WARNING:
python -c "print('A' * 0x400000)" > /sys/fs/smackfs/netlabel
Reported-by: [email protected]
Signed-off-by: Sabyrzhan Tasbolatov <[email protected]>
Signed-off-by: Casey Schaufler <[email protected]>1 parent 1048ba8 commit 7ef4c19
1 file changed
Lines changed: 19 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1167 | 1167 | | |
1168 | 1168 | | |
1169 | 1169 | | |
1170 | | - | |
| 1170 | + | |
1171 | 1171 | | |
1172 | 1172 | | |
1173 | 1173 | | |
| |||
1427 | 1427 | | |
1428 | 1428 | | |
1429 | 1429 | | |
1430 | | - | |
| 1430 | + | |
1431 | 1431 | | |
1432 | 1432 | | |
1433 | 1433 | | |
| |||
1834 | 1834 | | |
1835 | 1835 | | |
1836 | 1836 | | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | + | |
1837 | 1841 | | |
1838 | 1842 | | |
1839 | 1843 | | |
| |||
2005 | 2009 | | |
2006 | 2010 | | |
2007 | 2011 | | |
| 2012 | + | |
| 2013 | + | |
| 2014 | + | |
2008 | 2015 | | |
2009 | 2016 | | |
2010 | 2017 | | |
| |||
2092 | 2099 | | |
2093 | 2100 | | |
2094 | 2101 | | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
2095 | 2105 | | |
2096 | 2106 | | |
2097 | 2107 | | |
| |||
2648 | 2658 | | |
2649 | 2659 | | |
2650 | 2660 | | |
| 2661 | + | |
| 2662 | + | |
| 2663 | + | |
| 2664 | + | |
2651 | 2665 | | |
2652 | 2666 | | |
2653 | 2667 | | |
| |||
2740 | 2754 | | |
2741 | 2755 | | |
2742 | 2756 | | |
| 2757 | + | |
2743 | 2758 | | |
2744 | 2759 | | |
2745 | 2760 | | |
2746 | 2761 | | |
| 2762 | + | |
| 2763 | + | |
2747 | 2764 | | |
2748 | 2765 | | |
2749 | 2766 | | |
| |||
0 commit comments