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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130402141604.GD1952@ghostprotocols.net>
Date:	Tue, 2 Apr 2013 11:16:04 -0300
From:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
To:	Namhyung Kim <namhyung@...nel.org>
Cc:	Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf: fix bug in isupper() and islower()

Em Mon, Apr 01, 2013 at 03:19:28PM +0900, Namhyung Kim escreveu:
> On Fri, 29 Mar 2013 12:29:50 -0700, Sukadev Bhattiprolu wrote:
> > Subject: [PATCH] perf: fix bug in isupper() and islower()

> > One of the reasons 'perf test' is failing on Power appears to be due to
> > a bug in isupper().

> > isupper(c) and islower(c) should be checking 'c' against the mask 0x20.
> > Instead they are checking sane_ctype[c] which causes isupper() to be true
> > for lower case letters.

> Indeed!
> Acked-by: Namhyung Kim <namhyung@...nel.org>

But can we try to use the same defs as for the kernel? Or at least sync
this code against git.git, that is where it comes from?

There we have:

#define islower(x) sane_iscase(x, 1)
#define isupper(x) sane_iscase(x, 0)

#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)

static inline int sane_iscase(int x, int is_lower)
{
        if (!sane_istest(x, GIT_ALPHA))
                return 0;

        if (is_lower)
                return (x & 0x20) != 0;
        else
                return (x & 0x20) == 0;
}
----------------------------------------------------------------------------

In the kernel we have instead:

include/linux/ctype.h

#define _U      0x01    /* upper */
#define __ismask(x) (_ctype[(int)(unsigned char)(x)])
#define isupper(c)      ((__ismask(c)&(_U)) != 0)

----------------------------------------------------------------------------

I'm merging this fix now, as it improves things, but this seemingly
needless speciations looks insane, would be great to have at least
tools/perf/  using the same stuff as its landlord, the kernel.

- Arnaldo
--
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