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: <alpine.DEB.2.02.1506130015040.2010@localhost6.localdomain6>
Date:	Sat, 13 Jun 2015 00:16:22 +0200 (CEST)
From:	Julia Lawall <julia.lawall@...6.fr>
To:	Thomas Gleixner <tglx@...utronix.de>
cc:	Julia Lawall <julia.lawall@...6.fr>,
	Jiang Liu <jiang.liu@...ux.intel.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Randy Dunlap <rdunlap@...radead.org>,
	Yinghai Lu <yinghai@...nel.org>,
	Borislav Petkov <bp@...en8.de>,
	Jason Cooper <jason@...edaemon.net>,
	Kevin Cernekee <cernekee@...il.com>,
	Arnd Bergmann <arnd@...db.de>,
	Marc Zyngier <marc.zyngier@....com>,
	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
	Tony Luck <tony.luck@...el.com>, x86@...nel.org,
	LKML <linux-kernel@...r.kernel.org>, linux-pci@...r.kernel.org,
	linux-acpi@...r.kernel.org
Subject: Re: [RFC v1 14/25] genirq: Kill the first parameter 'irq' of
 irq_flow_handler_t



On Fri, 12 Jun 2015, Thomas Gleixner wrote:

> On Fri, 12 Jun 2015, Julia Lawall wrote:
> > What is the status of this?  I am close to having a semantic patch that 
> > works.  The current version touches 133 files, but I haven't checked all 
> > of them.  This includes both the local functions and the generic ones, but 
> > not the cases where the name of the handler function is a local variable 
> > or arbitrary expression.  This occurs in around 30 files.
> 
> Jiang sent out a new patch series, but I'm really interested in doing
> a fully automated check. If conversion is possible for some of them,
> fine, but the checking part to find all the places where this needs to
> be applied is the most important to me.
> 
> If you want, just send me that script and I'll give it a test ride.

The results are attached.  The semantic patch is below.  This should be 
run with the argument --in-place.  You need to have ocaml installed.

julia

virtual after_start

@initialize:ocaml@
@@

let tbl = Hashtbl.create(100)
let ltbl = Hashtbl.create(100)

let add_if_not_present f p =
try let _ = Hashtbl.find tbl f in ()
with Not_found ->
   Hashtbl.add tbl f p;
   let it = new iteration() in
   it#add_virtual_rule After_start;
   it#add_virtual_identifier Hf f;
   it#register()

let local_add_if_not_present f file =
try let _ = Hashtbl.find ltbl (f,file) in ()
with Not_found ->
   Hashtbl.add ltbl (f,file) ();
   let it = new iteration() in
   it#set_files [file];
   it#add_virtual_rule After_start;
   it#add_virtual_identifier Hf f;
   it#register()

// ------------------------------------------------------------------------
// Getting started

@h depends on !after_start@
identifier ih != NULL;
local idexpression lih;
expression eh;
expression e1,e2,e3,e4,e5,e6,e7;
position p;
@@

(
__irq_set_handler@p(e1,\(lih\|ih\|eh\),e2,e3)
|
irq_set_handler@p(e1,\(lih\|ih\|eh\))
|
irq_set_chained_handler@p(e1,\(lih\|ih\|eh\))
|
irq_alloc_generic_chip@p(e1,e2,e3,\(lih\|ih\|eh\))
|
irq_alloc_domain_generic_chips@p(e1,e2,e3,e4,\(lih\|ih\|eh\),e5,e6,e7)
|
irq_set_chip_and_handler_name@p(e1,e2,\(lih\|ih\|eh\),e3)
|
irq_set_chip_and_handler@p(e1,e2,\(lih\|ih\|eh\))
|
__irq_set_handler_locked@p(e1,\(lih\|ih\|eh\))
|
__irq_set_chip_handler_name_locked@p(e1,e2,\(lih\|ih\|eh\),e3)
|
__irq_set_preflow_handler@p(e1,\(lih\|ih\|eh\))
)

@localfn@
identifier h.ih;
@@

ih(...) { ... }

@script:ocaml depends on !localfn@
p << h.p;
handler << h.ih;
@@

add_if_not_present handler p

@script:ocaml depends on localfn@
p << h.p;
handler << h.ih;
@@

local_add_if_not_present handler (List.hd p).file

@script:ocaml@
p << h.p;
handler << h.lih;
@@

Printf.eprintf "Local variable: %s:%d %s\n"
   ((List.hd p).file) ((List.hd p).line) handler

@script:ocaml@
p << h.p;
handler << h.eh;
@@

Printf.eprintf "Arbitrary expression: %s:%d %s\n"
   ((List.hd p).file) ((List.hd p).line) handler

// ------------------------------------------------------------------------
// Adjusting functions

@@
identifier virtual.hf,irq;
fresh identifier firq = "__" ## irq;
type T;
@@

hf(T 
- irq
+ firq
  ,...) {
  ... when != irq
      when strict
}

@s@
identifier virtual.hf,irq;
position p1;
type T;
@@

hf(T irq,...) {
  <...
  (irq@p1 = <+...irq...+>)
  ...>
}

@s1@
identifier virtual.hf,irq;
position p1;
expression e;
statement S;
type T;
@@

hf(T irq,...) {
  <...
  for(...; ...; <+...irq@p1 = e...+>) S
  ...>
}

// first parameter is assigned at least once
@r exists@
identifier virtual.hf,irq;
expression e;
type T;
position p,p1 != {s.p1,s1.p1};
@@

hf(T@p irq,...) {
  ... when != irq
      when strict
  irq@p1 = e
  ... when any
}

// no uses of the first parameter before the assignment
@@
identifier virtual.hf,irq;
expression e;
type T;
fresh identifier firq = "__" ## irq;
position r.p,p1 != {s.p1,s1.p1};
@@

hf(T@p 
- irq
+ firq
  ,...) {
  ... when != irq
      when strict
? irq@p1 = e
  ... when any
}

// first parameter is used somewhere
@rr exists@
identifier virtual.hf,irq;
type T;
position p;
@@

hf(T@p irq,...) {
  ...
  irq
  ... when any
}

@@
identifier virtual.hf,irq,desc;
fresh identifier firq = "__" ## irq;
type T,T1;
position rr.p;
@@

hf(T@p 
- irq
+ firq
  ,T1 desc) {
+ unsigned int irq = irq_get_desc_irq(desc);
  ... when any
}
View attachment "res.out" of type "TEXT/PLAIN" (87513 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ