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: <0660a065aad94979a560682cef5d573c@AcuMS.aculab.com>
Date:   Fri, 2 Jul 2021 14:47:47 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Kumar Kartikeya Dwivedi' <memxor@...il.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
CC:     Toke Høiland-Jørgensen <toke@...hat.com>,
        "Alexei Starovoitov" <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        "Andrii Nakryiko" <andrii@...nel.org>,
        Jesper Dangaard Brouer <brouer@...hat.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        John Fastabend <john.fastabend@...il.com>,
        Martin KaFai Lau <kafai@...com>,
        Eric Leblond <eric@...it.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>
Subject: RE: [PATCH net-next v6 2/5] bitops: add non-atomic bitops for
 pointers

From: Kumar Kartikeya Dwivedi
> Sent: 02 July 2021 12:18
> 
> cpumap needs to set, clear, and test the lowest bit in skb pointer in
> various places. To make these checks less noisy, add pointer friendly
> bitop macros that also do some typechecking to sanitize the argument.

Would this work?
#define BIT_OP(val, op) ((typeof (val))((unsigned long)(val) op))

Should let you do:
	ptr = BIT_OP(ptr, | 1);
	ptr = BIT_OP(ptr, & ~1);
	if (BIT_OPT(ptr, & 1))
		...

See https://godbolt.org/z/E57aGK4js

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ