lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <54062A22.6090804@eng.utah.edu>
Date:	Tue, 02 Sep 2014 14:35:46 -0600
From:	Scotty Bauer <sbauer@....utah.edu>
To:	linux-kernel@...r.kernel.org
Subject: Compat sysinfo syscall (kernel/sys.c) relying on undefined behavior?

 am getting acquainted with the linux kernel and to do so I've been browsing the source.


In the compat version of sysinfo, kernel/sys.c we see the following:

COMPAT_SYSCALL_DEFINE1(sysinfo, struct compat_sysinfo __user *, info)
{
    struct sysinfo s;

    do_sysinfo(&s);

    /* Check to see if any memory value is too large for 32-bit and scale
     *  down if needed
     */
    if ((s.totalram >> 32) || (s.totalswap >> 32)) {
        int bitcount = 0;

...


s.totalram is a u32, and the standard says:
"If the value of the right operand is negative or is greater than or equal to the width 
of the promoted left operand, the behavior is undefined."

Is there some promotion, compiler flag, something obvious that I am missing, or is this a 
problem?


Best,
Scotty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ