All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] LTP testcase(sysctl02) failed
@ 2020-12-24  5:56 Gao =?unknown-8bit?b?TWVpdGFv77yI6auY546r5rab77yJ?=
  2021-01-05 11:31 ` Cyril Hrubis
  2021-01-15  6:14 ` Joerg Vehlow
  0 siblings, 2 replies; 6+ messages in thread
From: Gao =?unknown-8bit?b?TWVpdGFv77yI6auY546r5rab77yJ?= @ 2020-12-24  5:56 UTC (permalink / raw)
  To: ltp

All:

I am currently condulting Ltp test for our own yocto project, now I encouter below error.

sysctl02_sh                                        FAIL       1
sysctl02 1 TFAIL: /proc/sys/fs/file-max overflows and is set to 0
sysctl02 2 TINFO: trying to set fs.file-max=18446744073709551615
sysctl02 2 TPASS: /proc/sys/fs/file-max keeps old value (33398)
sysctl02 3 TINFO: trying to set fs.file-max=9223372036854775808
sysctl02 3 TFAIL: /proc/sys/fs/file-max overflows and is set to 0
sysctl02 4 TCONF: kernel doesn't support KASAN

after investigated it, this testcase is for bufffer overflow, I checked source code (kernel 4.19),
all of required patched had been applied, I dig into it and found new patch applied as flow , that might make testcase failed

commit b227f15712691096027163a4600a7af1c4864320
Author: Christian Brauner <christian@brauner.io>
Date:   Thu Mar 7 16:29:43 2019 -0800

    sysctl: handle overflow for file-max

    [ Upstream commit 32a5ad9c22852e6bd9e74bdec5934ef9d1480bc5 ]

    Currently, when writing

      echo 18446744073709551616 > /proc/sys/fs/file-max

    /proc/sys/fs/file-max will overflow and be set to 0.  That quickly
    crashes the system.

    This commit sets the max and min value for file-max.  The max value is
    set to long int.  Any higher value cannot currently be used as the
    percpu counters are long ints and not unsigned integers.

    Note that the file-max value is ultimately parsed via
    __do_proc_doulongvec_minmax().  This function does not report error when
    min or max are exceeded.  Which means if a value largen that long int is
    written userspace will not receive an error instead the old value will be
    kept.  There is an argument to be made that this should be changed and
    __do_proc_doulongvec_minmax() should return an error when a dedicated min
    or max value are exceeded.  However this has the potential to break
    userspace so let's defer this to an RFC patch.

so is this testcase out of date or something wrong wih my kernel ?
who can help me figure this out? Thanks in advance.


-----------------------------------
Best Regards
Meitao Gao
------------------------------------



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20201224/4393242d/attachment.htm>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] LTP testcase(sysctl02) failed
  2020-12-24  5:56 [LTP] LTP testcase(sysctl02) failed Gao =?unknown-8bit?b?TWVpdGFv77yI6auY546r5rab77yJ?=
@ 2021-01-05 11:31 ` Cyril Hrubis
  2021-01-15  6:14 ` Joerg Vehlow
  1 sibling, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2021-01-05 11:31 UTC (permalink / raw)
  To: ltp

Hi!
> I am currently condulting Ltp test for our own yocto project, now I encouter below error.
> 
> sysctl02_sh                                        FAIL       1
> sysctl02 1 TFAIL: /proc/sys/fs/file-max overflows and is set to 0
> sysctl02 2 TINFO: trying to set fs.file-max=18446744073709551615
> sysctl02 2 TPASS: /proc/sys/fs/file-max keeps old value (33398)
> sysctl02 3 TINFO: trying to set fs.file-max=9223372036854775808
> sysctl02 3 TFAIL: /proc/sys/fs/file-max overflows and is set to 0
> sysctl02 4 TCONF: kernel doesn't support KASAN
> 
> after investigated it, this testcase is for bufffer overflow, I checked source code (kernel 4.19),
> all of required patched had been applied, I dig into it and found new patch applied as flow , that might make testcase failed
> 
> commit b227f15712691096027163a4600a7af1c4864320
> Author: Christian Brauner <christian@brauner.io>
> Date:   Thu Mar 7 16:29:43 2019 -0800
> 
>     sysctl: handle overflow for file-max

...

> so is this testcase out of date or something wrong wih my kernel ?
> who can help me figure this out? Thanks in advance.

If you look into the testcase source there is a comment that the test is
a regression test for this commit as well.

Also if I remember correctly if you manage to overflow and set the
file-max to 0 the system will crash sooner or later. So if the test
manages to set it to 0 your kernel is either missing this patch or the
bug has been reintroduced.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] LTP testcase(sysctl02) failed
  2020-12-24  5:56 [LTP] LTP testcase(sysctl02) failed Gao =?unknown-8bit?b?TWVpdGFv77yI6auY546r5rab77yJ?=
  2021-01-05 11:31 ` Cyril Hrubis
@ 2021-01-15  6:14 ` Joerg Vehlow
  2021-01-15  8:29   ` [LTP] 答复: " Gao =?unknown-8bit?b?TWVpdGFv77yI6auY546r5rab77yJ?=
  2021-01-15 12:49   ` [LTP] " Cyril Hrubis
  1 sibling, 2 replies; 6+ messages in thread
From: Joerg Vehlow @ 2021-01-15  6:14 UTC (permalink / raw)
  To: ltp

Hi Gao,

On 12/24/2020 6:56 AM, Gao Meitao????? wrote:
>
> after investigated it, this testcase is for bufffer overflow, I 
> checked source code (kernel 4.19),
>
> all of required patched had been applied, I dig into it and found new 
> patch applied as flow , that might make testcase failed
>
> so is this testcase out of date or something wrong wih my kernel ?
>
> who can help me figure this out? Thanks in advance.
>
I also saw this on 4.19. From the mailing list of the kernel, it looks 
like there was some confusion when they ported the patches back to 4.19.
I do not find the mails on the mailing list anymore. But the commit 
7f2923c from master is missing IIRC.
Christian Brauner made two changes:
1. Prevent over and underflow by just keeping the old value (7f2923c 
together with 32a5ad9c). This introduced a kasan bug fixed in 9002b21
2. Return EINVAL, if an overflow or underflow of the new value is 
detected (e260ad01f)

 From what I remember Christian wanted the first change completely 
backported to 4.19 (7f2923c, 32a5ad9c and 9002b21) and he wanted to omit 
the change done in e260ad01f, because that changed the behavior of the 
interface towards the user.
But when the changed were backported to 4.19, the commit 32a5ad9c, 
9002b21 and e260ad01f were backported. Since 7f2923c is the commit, that 
really enables over- and underflow detection, this is not backported and 
all the other commit (including e260ad01f) have no effect.

At the time I found this, I had no time to find out how and where to 
report this.
@Cyril I guess you may know how and who to report this to?

J?rg

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] 答复:  LTP testcase(sysctl02) failed
  2021-01-15  6:14 ` Joerg Vehlow
@ 2021-01-15  8:29   ` Gao =?unknown-8bit?b?TWVpdGFv77yI6auY546r5rab77yJ?=
  2021-01-15 12:49   ` [LTP] " Cyril Hrubis
  1 sibling, 0 replies; 6+ messages in thread
From: Gao =?unknown-8bit?b?TWVpdGFv77yI6auY546r5rab77yJ?= @ 2021-01-15  8:29 UTC (permalink / raw)
  To: ltp

Hi Joery:

	Thanks for your information and clearing this out, Ah, I am not alone with this.
	After I checked this patch (7f2923c), found that it seem be necessary , so patch it into my codebase.


Best wishes.
-----------------------------------
Best Regards
Meitao Gao
021-6109-2999 ext. 8300
------------------------------------



-----????-----
???: Joerg Vehlow [mailto:lkml@jv-coder.de] 
????: 2021?1?15? 14:14
???: Gao Meitao?????; ltp@lists.linux.it; Cyril Hrubis
??: Re: [LTP] LTP testcase(sysctl02) failed

Hi Gao,

On 12/24/2020 6:56 AM, Gao Meitao????? wrote:
>
> after investigated it, this testcase is for bufffer overflow, I 
> checked source code (kernel 4.19),
>
> all of required patched had been applied, I dig into it and found new 
> patch applied as flow , that might make testcase failed
>
> so is this testcase out of date or something wrong wih my kernel ?
>
> who can help me figure this out? Thanks in advance.
>
I also saw this on 4.19. From the mailing list of the kernel, it looks like there was some confusion when they ported the patches back to 4.19.
I do not find the mails on the mailing list anymore. But the commit 7f2923c from master is missing IIRC.
Christian Brauner made two changes:
1. Prevent over and underflow by just keeping the old value (7f2923c together with 32a5ad9c). This introduced a kasan bug fixed in 9002b21 2. Return EINVAL, if an overflow or underflow of the new value is detected (e260ad01f)

 From what I remember Christian wanted the first change completely backported to 4.19 (7f2923c, 32a5ad9c and 9002b21) and he wanted to omit the change done in e260ad01f, because that changed the behavior of the interface towards the user.
But when the changed were backported to 4.19, the commit 32a5ad9c,
9002b21 and e260ad01f were backported. Since 7f2923c is the commit, that really enables over- and underflow detection, this is not backported and all the other commit (including e260ad01f) have no effect.

At the time I found this, I had no time to find out how and where to report this.
@Cyril I guess you may know how and who to report this to?

J?rg

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] LTP testcase(sysctl02) failed
  2021-01-15  6:14 ` Joerg Vehlow
  2021-01-15  8:29   ` [LTP] 答复: " Gao =?unknown-8bit?b?TWVpdGFv77yI6auY546r5rab77yJ?=
@ 2021-01-15 12:49   ` Cyril Hrubis
  2021-02-05  9:12     ` Joerg Vehlow
  1 sibling, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2021-01-15 12:49 UTC (permalink / raw)
  To: ltp

Hi!
> @Cyril I guess you may know how and who to report this to?

Patches are proposed for inclusion into stable trees at
stable@vger.kernel.org so I would drop an email there.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [LTP] LTP testcase(sysctl02) failed
  2021-01-15 12:49   ` [LTP] " Cyril Hrubis
@ 2021-02-05  9:12     ` Joerg Vehlow
  0 siblings, 0 replies; 6+ messages in thread
From: Joerg Vehlow @ 2021-02-05  9:12 UTC (permalink / raw)
  To: ltp

Hi,

On 1/15/2021 1:49 PM, Cyril Hrubis wrote:
> Hi!
>> @Cyril I guess you may know how and who to report this to?
> Patches are proposed for inclusion into stable trees at
> stable@vger.kernel.org so I would drop an email there.

Just FYI: I reported this and the patch is now queued for the next 4.19

J?rg

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-05  9:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-24  5:56 [LTP] LTP testcase(sysctl02) failed Gao =?unknown-8bit?b?TWVpdGFv77yI6auY546r5rab77yJ?=
2021-01-05 11:31 ` Cyril Hrubis
2021-01-15  6:14 ` Joerg Vehlow
2021-01-15  8:29   ` [LTP] 答复: " Gao =?unknown-8bit?b?TWVpdGFv77yI6auY546r5rab77yJ?=
2021-01-15 12:49   ` [LTP] " Cyril Hrubis
2021-02-05  9:12     ` Joerg Vehlow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.