Bug 9260 - 修复dctcp_update_alpha()相关bug
Summary: 修复dctcp_update_alpha()相关bug
Status: NEW
Alias: None
Product: Anolis OS 8
Classification: Anolis OS
Component: kernel - anck-5.10 (show other bugs) kernel - anck-5.10
Version: ---
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: maqiao_mq
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-30 19:36 UTC by HLjksuga
Modified: 2024-05-30 19:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description HLjksuga inspur_group 2024-05-30 19:36:00 UTC
Description of problem:
tcp: Fix shift-out-of-bounds in dctcp_update_alpha().

In dctcp_update_alpha(), we use a module parameter dctcp_shift_g
    as follows:

      alpha -= min_not_zero(alpha, alpha >> dctcp_shift_g);
      ...
      delivered_ce <<= (10 - dctcp_shift_g);

    It seems syzkaller started fuzzing module parameters and triggered
    shift-out-of-bounds [0] by setting 100 to dctcp_shift_g:

      memcpy((void*)0x20000080,
             "/sys/module/tcp_dctcp/parameters/dctcp_shift_g\000", 47);
      res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000080ul,
                    /*flags=*/2ul, /*mode=*/0ul);
      memcpy((void*)0x20000000, "100\000", 4);
      syscall(__NR_write, /*fd=*/r[0], /*val=*/0x20000000ul, /*len=*/4ul);

    Let's limit the max value of dctcp_shift_g by param_set_uint_minmax().

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Comment 1 小龙 admin 2024-05-30 19:45:29 UTC
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/3300